2 ms·
I created a language without lots of trouble. The trick was low expectations. I named it “lila” (limited language), so they were right there in the name. It did
by otikik 5y ago
I created a language without lots of trouble. The trick was low expectations. I named it “lila” (limited language), so they were right there in the name. It did very little, it had no compilation phase, but served its didactic purpose. It showed how to build a language using ANTLR.
- specialist 5y agoStarted noodling with ANTLR 2.x. Still consider myself a noob. FWIW, IMHO, two aspects of ANTLR 4.0 dramatically lowered the implementation barriers. Practical stuff that doesn't get much attention. With L(*) grammars (inspired by packrat, IIRC), parse trees and ASTs can be merged into one. Makes post-processing so much easier. API now supports interpreting, vs iterating, over the parse tree. Think XML-SAX vs a Visitor. Then you craft your Interpreter to drive a Builder. This simple conceptual change greatly simplifies everything.