[antlr-interest] Partitioning Antlr grammar into a couple files
Johannes Luber
jaluber at gmx.de
Wed Feb 20 06:04:09 PST 2008
Vitaliy schrieb:
> Hello,
>
> I found no reference about this in the documentation -
>
> I wonder if it's possible to divide the grammar definition between
> multiple number of files -
>
> I've defined a pretty large grammar - around 150 rules, spanning over
> 1500 lines.
>
> When I first tried to generate the code using AntlrWorks, it just got
> stuck, and after adding more memory to the process, it managed to
> generate almost 200,000 lines of C# code.
>
> Anyway, It's really hard to test \ manage such a big grammar. Is there a
> way to split it between a number of files?
ANTLR 3.1 will include grammar inheritance, which is the option you want
to use. Normally I'd recommend to use an intermediary build, but the
latest builds are broken and I haven't come around to fix that yet. Look
at early January builds, which did work. Documentation is in an
example grammar which should be included in the build (at least the
latest builds include that example).
Johannes
More information about the antlr-interest
mailing list