I'm building a parser in antlr which compiles to a working java target. When I retarget for c#2 it produces a parser in which all of the parse methods are private but marked with a [GrammarRule("rulename")] attribute.
What is the approved means to actually invoke the parser?
I am using ANTLR 3.3 Nov 30, 2010 12:45:30
Thanks, Andy
runtime dll, or antlr3. runtime dll if you're using ANTLR version 3. Your C# program can now parse text files using the grammar that you compiled in step 1.
ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages.
Make at least one parser rule "public" like this:
grammar T;
options {
language=CSharp2;
}
public parse
: privateRule+ EOF
;
privateRule
: Token+
;
// ...
You can then call parse()
on the generated parser.
protected
and private
(the default if nothing is specified) are also supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With