Question: The code below is the lexical analizer Given the lexical analyzer implemented in assignment *1, add the parsing code using PLY to recognize the following

The code below is the lexical analizer

Given the lexical analyzer implemented in assignment *1, add the parsing code using PLY to recognize the following grammar rules: block BLOCK ID ASSIGN LPARENTH attributes RPARENTH I ADD ID ASSIGN LPARENTH new_atts RPARENTH I PRINT ID I RCN ID I MINE ID I EXPORT ID I VIEW ID type STR 1 INT I LONG 1 FLOAF 1 LIST 1 TUPLE 1 DICT attribute ID TYPBASSIGN type attributes attribute lattributes SEPARATOR attribute new_att ID TYPEASSIGN STRING I ID FYPEASSIGN NUMBER. new_atts new_att I new_atts SEPRRATOR new_att expr term expr expr PLUS term expr expr MINUS teim term factor term term STAR factor term term SLAsH factor term term PCT factor factor > ID factor NCM factor LPAREN expr RPAREN factor factor LPAREN arg3opt RPAREN test expr NE expr test expr IT expr test expr LE expr test expr GE expr test expr GT expr argsopt args argsopt args expr SEPRRAFOR args args expr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
