%{ // parser for Boolean equations // void yyerror( const char *msg); /* called for parser syntax error */ int yylex( void); /* declare to avoid gcc warnings */ %} %token AND OR ID %% list: /* nothing, matches before start of input */ | list eqn ';' | list error ';' { yyerrok; } ; primary: ID | '(' or ')' ; and: primary | and AND primary ; or: and | or OR and ; eqn: ID '=' or ; %% int main( void) { return yyparse(); }