err_syntax23.y revision 303975
1%{ 2int yylex(void); 3static void yyerror(const char *); 4%} 5 6%union { 7 int ival; 8 double dval; 9} 10 11%type <tag2> recur 12 13%token NUMBER 14 15%% 16 17expr : '(' recur ')' 18 { $$ = $2; } 19 ; 20 21recur : NUMBER 22 { $$ = 1; } 23 ; 24 25%% 26 27#include <stdio.h> 28 29int 30main(void) 31{ 32 printf("yyparse() = %d\n", yyparse()); 33 return 0; 34} 35 36int 37yylex(void) 38{ 39 return -1; 40} 41 42static void 43yyerror(const char* s) 44{ 45 printf("%s\n", s); 46} 47