/* match1.y MR 04/07/99 Input file to 'bison' (or 'yacc'). How to generate the parser program: 1) Run bison on this file: bison match1.y 2) Compile the bison output: gcc match1.tab.c -o match1 */ %token ID %token OTHER %start input %% input : /* empty */ | input token ; token : ID { printf( "ID\n" ); } | '(' { printf( "(\n" ); } | ')' { printf( ")\n" ); } | '{' { printf( "{\n" ); } | '}' { printf( "}\n" ); } | ';' { printf( ";\n" ); } | OTHER { printf( "OTHER\n" ); } ; %% #include main() { yyparse(); } yyerror( char * str ) { printf( "match1: %s\n", str ); } int isLetter( int c ) { if ( 'a'