by golemotron · 12y ago · 0 comments
None of the work is motivated concretely by the work of the prior step.
Fine if you are designing the representations for them, but I'm wondering how they would design an AST for a language they haven't seen or haven't thought about how to parse.
It would be an interesting experiment. If you were going to have them design the internal representations, you could have then move backward in a why that allows them to compile a family of languages. They could create something as general as the LLVM suite. :)
A third alternative would be to start in the "middle" with the AST, and go both forwards and backwards from there. :)
So, start with the AST as a given, or even have them design it, and use it to drive the design of the concrete syntax, static analysis, code generation, etc. At each phase, cover relevant concerns (i.e. "here's how to avoid shift-reduce conflicts in the concrete syntax").
I know nothing about teaching, so probably this wouldn't work, just speculation.
As for AST design, it is easier to design the AST first than you might think. Just ask the designers of Lisp.