Conversation

Replying to
Reminds me of twitter.com/glaebhoerl/sta - I'm thinking of making a core language like this.
Quote Tweet
If you have an LL(k) grammar, require all names to be declared prior to their use, and have a sensible type system that can be typechecked in one pass, I think you could get through the whole front end of the compiler without ever materializing an AST in memory?
Show this thread
Replying to and
I think this is essentially "finally tagless": instead of defining your structures (AST or IR) as data, define them as classes; in the parser resp. elaborator, "construct" the AST resp. IR by calling methods; make instances do elaboration, resp. perhaps code generation, directly.
1
1
You can also define instances to construct an actual AST/IR as data, if you need that, for example to do analysis/optimization. (I'm not sure if you couldn't also do those as a directly fused chain, but I'm pretty sure you couldn't if you need to compute fixed points.)
2
1
Show replies