1264790Sbapt%{ 2264790Sbaptint yylex(void); 3264790Sbaptstatic void yyerror(const char *); 4264790Sbapt%} 5264790Sbapt 6264790Sbapt%union { 7264790Sbapt int ival; 8264790Sbapt double dval; 9264790Sbapt} 10264790Sbapt 11264790Sbapt%type <tag2> recur 12264790Sbapt 13264790Sbapt%token NUMBER 14264790Sbapt 15264790Sbapt%% 16264790Sbapt 17264790Sbaptexpr : '(' recur ')' 18264790Sbapt { $$ = $2; } 19264790Sbapt ; 20264790Sbapt 21264790Sbaptrecur : NUMBER 22264790Sbapt { $$ = 1; } 23264790Sbapt ; 24264790Sbapt 25264790Sbapt%% 26264790Sbapt 27264790Sbapt#include <stdio.h> 28264790Sbapt 29264790Sbaptint 30264790Sbaptmain(void) 31264790Sbapt{ 32264790Sbapt printf("yyparse() = %d\n", yyparse()); 33264790Sbapt return 0; 34264790Sbapt} 35264790Sbapt 36264790Sbaptint 37264790Sbaptyylex(void) 38264790Sbapt{ 39264790Sbapt return -1; 40264790Sbapt} 41264790Sbapt 42264790Sbaptstatic void 43264790Sbaptyyerror(const char* s) 44264790Sbapt{ 45264790Sbapt printf("%s\n", s); 46264790Sbapt} 47