Professional Documents
Culture Documents
Programming Assignment For Compiler Construction
Programming Assignment For Compiler Construction
Programming Assignment For Compiler Construction
a. Write a grammar rule for defining the context-free syntax for a new do-until
statement. (The grammar rule should be written in “grammar” text file with
comments at the start and at the end of rule.
/* rule start */
RULE
/* rule end */
b. Modify the Scanner to deal with any necessary new tokens. (The code
should be written in “Scanner.java” file with comments at the start and at the
end of code).
/* start of inserted code */
CODE
/* end of inserted code */
c. Modify the Parser to parse and return nodes for the do-until statement. (The
code should be written in “Parser.java” file with comments at the start and at
the end of code).
/* start of inserted code */
CODE
/* end of inserted code */
Note: All the required files and complete source code of j—compiler
(“jminusminus”) is available in files with the assignment. You can consult
any file to understand the compiler.