[antlr-interest] This learning curve is getting me down (error messages using examples) NEWBIE NEEDS HELP

Voelkel, Andy andy.voelkel at plantronics.com
Tue Oct 18 17:10:28 PDT 2011


Hi,
After getting quite excited reading through the first few chapters of Language Implementation Patterns", I decided it was worth an investment of time on my part.
So I've been fighting my way through getting the latest version of Antlr working with Visual Studio 2010. I'm having all sorts of problems, such as configuration and tutorial documentation being spread all over the place and with various vintages. Nonetheless, I've finally managed to get a simple grammar working using the instructions here:
www.antlr.org/depot/antlrcs/.../ANTLRCSharpDocumentation.docx<http://www.antlr.org/depot/antlrcs/.../ANTLRCSharpDocumentation.docx>
However, when I tried something a little more involved (still very simple), using the treeparser example code for target Csharp2 (god only knows where I found that, I can't seem to retrace my steps).
First I got an error that was eliminated when I commented out the use of HIDDEN:
WS : (' '|'\n') /*{$channel=HIDDEN;}*/ ;
Now I'm getting an error caused by Console.Out.WriteLine, presumably because the generated code does not contain a "using" reference to System, and I don't know how to put that in a grammar file.
decl : ^(DECL type declarator)
       // label.start, label.start, label.text
       {Console.Out.WriteLine("int "+$declarator.text);}
     ;
How normal are these sorts of startup problems? Are the examples generally not working in this way? And how much will it help to get the Definitive Guide To ANTLR? Will ANTLRworks flag problems like this, which are presumably specific to the C#/.NET platform?
And while I'm at it, once I'm done with this, will I easily be able to get ANTLR to put line and column numbers from my source files into the nodes in ASTs that I build? That's important to me.
THANKS FOR ANY HELP!

-          Andy


________________________________

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy at plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.

For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.


More information about the antlr-interest mailing list