Tutorial Lex/Yacc - capsl
Tutorial Lex/Yacc - capsl
Tutorial Lex/Yacc - capsl
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Bison: rules Section Example<br />
/*** Rules section ***/<br />
statement_list: statement '\n'<br />
| statement_list statement '\n'<br />
statement: NAME '=' expression { $1->value = $3; }<br />
| expression { printf("= %g\n", $1); }<br />
expression: NUMBER<br />
| NAME { $$ = $1->value; }<br />
This is an executable statement. These are<br />
found to the right of a production.<br />
When the rule is matched, it is run. In this<br />
particular case, it just says to return the<br />
value.<br />
2/17/2012<br />
CAPSL<br />
52