Skip to content
Thomas Lee edited this page Mar 9, 2016 · 64 revisions

PA4

TODO

TODO (Hummus): Add Type fields into each AST node for decorating type checking.

TODO: Refactor main to handle (lexical, syntax, semantic) error correctly. Possibly a new exception class or an error object class or both.

TODO: (Everyone) Add JavaDoc's whenever you touch a file.

TODO (Everyone): Everyone makes 5 test cases.

TODO: (Hummus) Make PrettyPrinter into a Visitor.

TODO: Check if functionCall = expr is legal for AssignmentStmt. Such as f(3) = 2;

If function body has no return statement when it's expected, identifier of function is said to be wrong.

Design Decisions

Error handling errors

  • (Lexical,Syntax,SemanticError) are caught inside lex(), parse(), typecheck() methods.
  • main is responsible upto opening the input file. The rest is taken care of by lex,parse,typecheck.
  • custom UncaughtExceptionHandler is used to catch Lexical/Syntax/SemanticError (they are subclasses of RunTimeException)
  • ^ ACTUALLY, ^ is not needed if uncaught exceptions propagate up to find the exception handling
Clone this wiki locally