CSE 423 Lab #12: Return To Dot
Lab deliverable: work 2+ hours per student on building better dot output.
Turnin code plus an image showing one or more additions to the lab5 syntax
tree output.
How have you been debugging your compiler? Textually, I bet. They say that
pictures are worth a thousand words; let's find out.
What would it take to modify the output we wrote for dot, so that it shows
semantic and/or code generation information along with our syntax
trees?
Individuals: feel free to pick one or the other of these exercises, or
do both if you have time in two hours. Take a stab at both of these
exercises, possibly by dividing labor two or more ways.
Option A: add type info to syntax trees
Feel free to add other semantic info, but at least show me some type info.
- Step 0: print syntax trees like in lab#5, except in your current code
(possibly a no-op; check that it still works and fix if needed)
- Print the type's basetype in the node directly, e.g. "Int" or "String" etc.
- When the type is not an atomic type, add a node for the struct typeinfo
- modify print_leaf to print type information for leaves
- modify print_leaf to print type information for constants
- modify print_branch to print type information for internal nodes
Option B: add intermediate code info to DOT syntax trees
- modify your dot output to show addr/place information
(in expression nodes, starting from constants and variables)
- modify your dot output to print linked-lists of instructions
(distinguish from syntax tree nodes via a different color,
linestyle, and/or node shape)