To maximize reuse of our grammars we generally create separate lexer and parser
grammars which are target agnostic (i.e. contain no target specific code). We
then combine them into a composite grammar in which the target language and
other implementation specific details are specified
(header,members,namespace,etc.). This way, grammars can be used for multiple
targets and we have maximum freedom to combine multiple lexers/parsers into
larger ones.
If a composite grammar C imports a parser grammar P and a lexer grammar L, the
tool generates CParser, CLexer, C_P and C_L.
Adding @namespace { <X> } to the composite grammar should IMHO put all four
recognizers in namespace <X>. Currently, at least with the CSharp3 target, only
CParser is put into the specified namespace.
Specifying @lexer::namespace { <X> } to the composite grammar causes only the
outermost lexer CLexer to be added to the specified namespace, not the imported
lexer C_L. The same holds for @parser::namespace.
Btw, if I'm not mistaken, there's no way to put recognizers in packages with
the Java target. Is that correct?
Best regards,
Ranco Marcus
Epirion Knowledge Solutions B.V.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.