MC logo

Problem 4.4: BNF for ALGOL for


CS 404: Solutions and Examples

The ALGOL for loop.
<for loop>::=for <variable> := <for item list> do <statement>
<for item list>::=<for item> | <for item list>, <for item>
<for item>::=<arithmetic expression> | <forstep> | <forwhile>
<forstep>::=<arithmetic expression> step <arithmetic expression> until <arithmetic expression>
<forwhile>::=<arithmetic expression> while <Boolean expression>

<<