Converter from Coco/R to ANTLR4 grammar
Convert your Coco/R attributed grammar
to an ANTLR4 one.
This tool automates most of the conversion (depending on the complexity of your
embedded instrumentation code):
PRAGMAS
and COMMENT
definitions to ANTLR lexer rules on -> channel(HIDDEN)
fragment
lexer rulesSee also the various TODO/FIXME comments in the source code, this list is only an excerpt from these
ANY
in Coco production rules has no equivalent in ANTLRIF(...)
conflict resolvers work differently in ANTLR and have to be manually checked (are preserved as comments)git rebase
is your friend).char
or instrumentation code using a reference to a rule text
which collides with $text
, see https://github.com/antlr/antlr4/issues/2266).NESTED
comment definitions are not translated (though they should be possible with recursive lexer rules)Tokens with CONTEXT
specification are not supported
Test with instrumentation language other than C++ (see e.g. https://github.com/antlr/antlr4/issues/2265)
('TOKEN')?
)$
in instrumentation code fails ANTLR