[antlr-interest] Structuring a grammar file

Steve Bennett stevagewp at gmail.com
Sat Nov 24 18:23:09 PST 2007


Hi all,
  Wondering if there are any suggestions on how best to structure a
grammar file? There doesn't seem to be a way to split out parts of the
code into other files like modules, so I'm not sure how best to go
about keeping things manageable.

In particular:
- Is a separate lexer grammar always the best solution? What are the
downsides of a combined lexer/parser grammar?
- Should all lexer rules be grouped together, or should they be
grouped with the parser rules they're most associated with?
- How should rules be ordered: smallest (lowest?) to biggest
(highest?), or vice versa?

Any other suggestions?

Thanks,
Steve


More information about the antlr-interest mailing list