3 ms·
It did not exactly went away. It is still possible to embed semantics inside an Antlr4 grammar. For example see the Antlr4 EcmaScript grammar sample: https://
by bd82 9y ago
It did not exactly went away.
It is still possible to embed semantics inside an Antlr4 grammar.
For example see the Antlr4 EcmaScript grammar sample: https://github.com/antlr/grammars-v4/tree/master/ecmascript https://github.com/antlr/grammars-v4/tree/master/ecmascript which uses embedded code to solve the RegExp vs division operator ambiguity.
Another scenario when embedding code could be preferred is optimizing for maximum performance as abstractions normally come at a performance overhead.
I do agree that the default approach should be to separate the semantics unless there is a very good reason
why not to...
- CalChris 9y agoI stand corrected. I rewrote my grammar with ANTLR4 and gutted all the embedded semantics. That was a good day. I'm going to hit reply now and then I'm going to take out my personal neuralyzer and forget that I ever found out that you can still embed.