You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/WORKLOG.md

1.6 KiB

Compiler Construction PA2 Worklog

Team:

Apoorva Ranade(ar6496)   Sanjar Ahmadov(sa5640)   Yinqi Sun(ys3540)

Passes:

  • First Pass: Creates the symbol tables and adds all the elements of the program to the symbol table. The first step is creating the basic table symbol, which is the parent(root) of the symbol table structure(which forms a tree-like structure). Classes for Object, int, bool and str are added to this symbol table. This table contains the global declarations. At each level of scope, we create a symbol table which points to the parent symbol table. Variables, functions and classes are added to the appropriate symbol table according to the scope.
  • Second Pass: At each node of the abstract syntax tree, the types are identified and populated.

Recovery:

Challenges:

  • Nested structures were a challenge. A function inside a function needs to handle variable references as well as ensure function calls have appropriate scope.
  • Testing various scenarious with similarly defined variables were time consuming. Instead, we defined certain set of variables in the begging of the student contributed test programs, and then used the same variables troughout the programs to cover various bad and good scenarious.
  • Another challenge was to come up with good test cases to have a broader cover. Our approach to this issue was investigating Type Checking rules and writing adverse code to those rules to see if our analyzer can make correct inferences.

Improvements:

  • Added more tests to rigorously check program flow and indentation.