Consider the following extended BNF grammar for a subset of the Python programming language,
called MicroPython.

program ::= import list f funcdef g
funcdef ::= def func-identier ( [ identier f , identier g ] ) :
suite return add-expr
suite ::= statement f statement g
statement ::= variable-identier = expr
j if or-test : suite [else : suite ]
j while or-test : suite
j print expr
or-test ::= and-test f or and-test g
and-test ::= not-test f and not-test g
not-test ::= comparison j not not-test
comparison ::= add-expr comp-operator add-expr
comp-operator ::= < j > j == j >= j <= j <>
add-expr ::= mult-expr f add-operator mult-expr g
add-operator ::= + j

11 Years
Discussion Span
Last Post by jrcagle

I take it this is an assignment for an undergrad Compilers class?

What sort of progress have you made so far?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.