4 ms·
> I'm wondering how they would design an AST for a language they haven't seen or haven't thought about how to parse. A third alternative would be to start in t
by mattfenwick 12y ago
> I'm wondering how they would design an AST for a language they haven't seen or haven't thought about how to parse.
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.