The grammar for conditions is very trivial. It's simply: "expr op expr". The Flex lexical description looks as follows: [ \t\n] { /* skip spaces */ } \%([a-zA-Z_][a-zA-Z0-9_]*)\% { yylval.string = yytext; return IDENTIFIER; } [0-9]* { yylval.string = yytext; return INTEGER_LITERAL; } \<= { return LT; } \<= { return LTE; } == { return EQ; } \>= { return GT; } \>= { return GTE; } . { yyerror("Unknown token: %s", yytext); yyterminate(); }
A Bison grammar looks as follows:
binary_expr : /* empty */ | value LT value | value LTE value | value EQ value | value GT value | value GTE value ; value : IDENTIFIER | INTEGER_LITERAL ; |