Hacker News new | ask | show | jobs
by vorg 2756 days ago
Unlike Python's `"I have {} apples".format(n)` and various shells' `"I have $n apples"`, Javascript's and Apache Groovy's `"This is chapter ${i+1}"` mean the lexer must make a call to the parser when lexing the string contents -- this allows `"This is ${"chapter"} ${i+1}"` to parse. Don't know about Javascript, but this makes Groovy's parser unreadable, and stuck on a very old version of Antlr, i.e. 2 instead of 4 (the latest).
2 comments

In P6:

grammar one-grammar { rule { <some-pattern> <another-grammar> .... } }

Can't get simpler. Can't be more readable.

AFAIK, Groovy 3 is targeting Antlr 4.