CECS 524 Lab 6
Adding LET and Comments and BEGIN ... END
In Lab 5 we added expression evaluation but didn't do any
variables. Today we are adding the "LET" statement rule to our
grammar. LET is essentially an assignment statement similar to that of BASIC.
Sample LET statements:
Use the same project from Lab 5 and just add to the ANTLR
grammar the rules or edit the rules as needed. Your SIL interpreter should be
able to run this program after the changes:
LET A = 4
LET B = 5
LET C = A * B + 7
PRINT A
PRINT " * "
PRINT B
PRINT " + 7 = "
PRINTLN C
which makes this output : 4 * 5 + 7 = 27
Submit the grammar to BB Dropbox Lab 6.
Get Free Quote!
302 Experts Online