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;

TODO: Conditional grammar.

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.

Questions

  • Does Name or Mem go into destination argument for Move?

MIRVisitor methods

  • Jona - Array stuff (3), AssignmentStmt
  • Jeff - VarInit, VarDecl, TupleInit
  • Hum - Functions (3/4), ReturnStmt
  • Juh - BinaryExpr, UnaryExpr
Clone this wiki locally