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

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

What sort of progress have you made so far?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.