Stage 3 of the
Klein compiler project
OUT: Friday, September 29
DUE: Friday, October 13
STATUS CHECK DUE: Friday, October 6
This stage consists of the second part of the second component of your Klein compiler, and three auxiliary programs.
Modify your table-driven parser to produce abstract syntax trees.This parser is a function or object that examines a sequence of Klein tokens and produces as output either an abstract syntax tree corresponding to the program (if the program is valid) or a suitable "nothing" value (if the program is not valid).
Write a program that uses your parser to produce a formatted listing of the input program's AST.In order to show the structure of the abstract syntax tree, the entry for each construct should be indented under its parent element. The display of identifiers and numbers must include the semantic content of the node.
function name main args type integer body fxn_call print with integer_literal 1 integer_literal 1
Create an executable or a Unix command-line script named kleinp that takes the name of a Klein source file as an argument and runs your AST-printing program on it.This is the third in a series of tools that makes up the command-line suite of your Klein compiler.
Write at least one meaningful legal program in Klein.Your test program should be at least at the level of a late CS1 program. Feel free to to to write something a more advanced program; you certainly will understand Klein well by the time you have a working parser. If you are stumped for what to do, try one of these ideas.
As before, submit only one copy of each assignment per team, both electronically and on paper. The team captain or a designated team member can be responsible for the submission.