News

Two bugs in Compiler testing exercise

Written on 01.06.2023 15:10 by Andreas Zeller

Hi everyone,

We found and fixed two bugs in the current compiler testing assignment. Thanks to Stanimir and Faiq for bringing this up!

1. In the AST_ASSIGNMENTS grammar, the definitions of <Assign> and <AugAssign> are wrong. They should read

'<Assign>': [
    'Assign(targets=<nonempty_lhs_expr_list>, value=<expr><type_comment>?)'
]  # was value=<Name>

and

'<AugAssign>': [
    'AugAssign(target=<lhs_expr>, op=<operator>, value=<expr>)'
]
 # was value=<Name>

respectively.

2. Also in AST_ASSIGNMENTS, the definition of <lhs_expr> is wrong. It should read

'<lhs_expr>': [ '<lhs_Name>', ... ]  # was <Name>

with <lhs_Name> being defined as

'<lhs_Name>': [ 'Name(id=<identifier>, ctx=Store())', ],

These two definitions will enable proper parsing of assignments such as x = 42, and subsequently also with clauses.

We apologize for the confusion. The above changes will make it far easier for you to produce a solution.

Privacy Policy | Legal Notice
If you encounter technical problems, please contact the administrators.