I'm getting a error in my yacc programme .
the error is "integer out of range in '$3' "
i have attached the code please check it and help me.
it is in the line 77
ifst: 'if' '(' expr ')' 'then' '{' expr ';' '}' else '{' expr ';' '}' {$$=makeifnode("if",$3,$7,$12);}//ERROR IS SHOWING HERE
;

Code:
%{
#include <stdio.h>
#include <stdlib.h>
#include "syntree.h"
#include "symtab.h"
//#include "globals.h"
#define NODE struct node*
NODE makeleaf(int);
NODE makebleaf(char*);
NODE makeid(struct table*);
NODE makenode(char*, NODE, NODE);
NODE makeifnode(char* a, NODE, NODE, NODE);
int yylex(void);
void yyerror(char *);
void protraverse(struct node* a);
void evaluate(struct node* a);
%}

%union
{
	int num;
	//char arr[10];
	struct node* nodeptr;
	struct table* tptr;
};
%start prog
%token <num> NUMBER 
%token <tptr> ID
%type <nodeptr> expr stmtlist assignment stmt reads writes ifst
%right '='
%left '<' '>' GE LE NE EE
%left '+' '-' 
%left '*' '/'

%%
prog:		declsec '{' stmtlist '}'	{protraverse($3);printf("\n");evaluate($3);exit(0);}
		;

declsec:	'decl' decllist 'enddecl'	
		;

decllist:	decl
		|decl decllist
		;

decl:		type idlist ';'
		;

type:		'int'
		|'bool'
		;

idlist:		ID		
		|ID ',' idlist
		;



stmtlist:	stmt stmtlist		{$$=makenode("s",$1,$2);}
		|			{$$=NULL;}
		;

stmt:		assignment 		{$$=makenode("s",$1,NULL);}
		|reads	   		{$$=makenode("s",$1,NULL);}
		|writes	   		{$$=makenode("s",$1,NULL);}
		|ifst				{$$=makenode("s",$1,NULL);
		;

assignment:	ID '=' expr ';'		{$$=makenode("=",makeid($1),$3);}		
		;

reads:		'read' '(' ID ')'	';'	{$$=makenode("r",makeid($3),NULL);}
		;

writes:		'write' '(' expr ')' ';'	{$$=makenode("w",$3,NULL);}
		;
ifst:			'if' '(' expr  ')' 'then' '{'  expr  ';' '}' else '{' expr ';' '}'		{$$=makeifnode("if",$3,$7,$12);}//ERROR IS SHOWING HERE
		;
					
expr: 	  NUMBER		{$$=makeleaf($1);}
	  |ID			{$$=makeid($1);}
	  |'true'		{$$=makebleaf("true");}
	  |'false'		{$$=makebleaf("false");}
	  |expr '+' expr	{$$=makenode("+",$1,$3);}
	  |expr '-' expr	{$$=makenode("-",$1,$3);}
	  |expr '*' expr	{$$=makenode("*",$1,$3);}
	  |expr '/' expr	{$$=makenode("/",$1,$3);}
	  |expr  LE expr	{$$=makelnode("<=",$1,$3);}
	  |expr  GE expr	{$$=makelnode(">=",$1,$3);}
	  |expr '>' expr	{$$=makelnode(">",$1,$3);}
	  |expr '<' expr	{$$=makelnode("<",$1,$3);}
	  |expr  NE expr	{$$=makelnode("!=",$1,$3);}
	  |expr  EE expr	{$$=makelnode("==",$1,$3);}
	  ;
%%

void yyerror(char *s)
{ 
    fprintf(stderr, "%s\n", s); 
} 

int main(void) 
{ 
    yyparse(); 
    return 0; 
}