Skip to content
filthydoughboy edited this page Mar 11, 2016 · 64 revisions

PA4

TODO

TODO : 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.

  • Lexical error handling from parsing

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

TODO: Everyone makes 5 test cases.

TODO: 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

Possibly unhandled cases

  • Array literals such as {1,2,} are valid. They basically can be assigned to any variable that is an array with length two or more.

  • There may be a reduce-reduce issue since primitive_type:pt brackets:b is a production of mixed_array_type and empty_array_type.

Clone this wiki locally