Next: TC-2 FAQ, Previous: TC-2 Given Code, Up: TC-2 [Contents][Index]
What is to be done:
Complete actions to instantiate AST nodes.
Supporting object constructs, an improvement suggested for TC-0 (see PTHL Improvements), is highly recommended.
Augment your scanner and your parser to support the (reserved) keywords
‘_decs’, ‘_exp’, ‘_lvalue’ and ‘_namety’ and
implement the corresponding grammar rules (see Language Extensions in Tiger Compiler Reference Manual). The semantic
actions of these productions shall use the ‘metavar’ function
template to fetch the right AST subtree from the
parse::Tweast object attached to the parsing context
(parse::TigerParser instance).
There should be at least three uses of the token error. Read the
Bison documentation about it.
%printerExtend the use of %printer to display non-terminals.
%destructorUse %destructor to reclaim the memory bound to semantic values
thrown away during error recovery.
Change your skeleton to glr.cc, use the %glr-parser
directive. Thanks to GLR, conflicts (S/R and/or R/R) can be accepted.
Use %expect and %expect-rr to specify their number. For
information, we have no R/R conflicts, and two S/R: one related to the
“big lvalue” issue, and the other to the implementation of the two
_cast operators (see Additional Syntactic Specifications in Tiger Compiler Reference Manual).
In order to implement easily the type checking of declarations and to
simplify following modules, adjust your grammar to parse
declarations by chunks. The implementations of these chunks are in
ast::FunctionDecs, ast::MethodDecs, ast::VarDecs,
and ast::TypeDecs; they are implemented thanks to
ast::AnyDecs). Note that an ast::VarDecs node appearing
in a declaration list shall contain exactly one ast::VarDec
object (see TC-2 Chunks); however, an ast::VarDecs used to
implement a function’s formal arguments may of course contain several
ast::VarDec (one per formal).
Complete the abstract syntax tree module: no ‘FIXME:’ should be left. Several files are missing in full. See src/ast/README for additional information on the missing classes.
Complete the GenDefaultVisitor class template. It is the basis
for following visitors in the Tiger compiler.
Likewise, complete GenObjectVisitor. This class template is used
to instantiate visitors factoring common code (default traversals of
object-related nodes) and serves as a base class of
ast::PrettyPrinter (and later bind::Binder).
The PrettyPrinter class must be written entirely. It must use the
misc::xalloc features to support indentation.
Next: TC-2 FAQ, Previous: TC-2 Given Code, Up: TC-2 [Contents][Index]