[antlr-interest] Don't Shoot! (Getting started w/ANTLR3 and C#)

Johannes Luber JALuber at gmx.de
Thu May 15 14:42:29 PDT 2008


Hi!

Sorry for the lateness, I've got some computer troubles since today...

> Thanks for asking, Hrn. Luber.  I appreciate your invitation.
> 
> I should clearly state that my observations are by no means unique to the
> wiki pages describing the C# target.  Similar comments could be made about
> many of the wiki pages.The difficulties I have with the wiki pages seem to
> fall into a few general classes:
> 
> 1. Instructions which do not clearly specify the applicable version(s) of
> ANTLR.

Before ANTLR 3.1 there was usually no need. The worst case would have been the use of a daily build because of a bug. In general, if no version number is mentioned then all versions should work with it. It'S possible that a later version of ANTLR invalidates the example, but that can be rectified only if noticed.
> 
> 2. Unspecified or ambiguous paths within archives.  (This challenge is
> compounded when the version of ANTLR is ambiguous.)

The directory structure remains largely unchanged irregardly of the current version. Admittedly, that fact is unknown for new users. Still, without having been giving concrete webpages, the occurrences can't be fixed.
 
> 3. This point concerns specifically the The C# Target wiki
> http://www.antlr.org/wiki/display/ANTLR3/Antlr+3+CSharp+Target.  This is a
> very helpful page, except that the "Status" section leaves me very wanting
> to use the CSharp2 target and very wondering what  requirements I must
> meet
> in my environment.  H. Link has commented extensively on this within the
> last day.

I have to disagree regarding the Status section. It clearly specifies the only 3.1 includes CSharp2. The only problem could be the information where to get 3.1. I actually expected a beta release to be out by the time I have edited the wiki page so I didn't include a statement where to get this prelease. Especially, because I expect to have it prominently featured on the mainpage. Is it unreasonable that I expect from people building compilers to know the basics of release numbers?

(BTW, it seems that my predecessor has cleaned up the page a bit, so I refer to my version of the Status section.)
> 
> I also wish to emphasize that I have had almost no problem with the
> example
> grammars, which are highly informative.
> 
> Also -- and this is again a more general comment, not specific to C# --
> the
> ANTLR documentation is naturally very focused on Java.  I would expect the
> other targets to lag the "reference" Java target.  Rapid evolution and an
> active developer community make ANTLR very appealing, but may also create
> some confusion for people who are new to parsing and are trying to soak up
> a
> lot of information at once.  I'm not so easily scared, being a bit of an
> OSS
> veteran.  But I do think there is plenty of opportunity to give newcomers
> more chances to get a toe-hold, for example, by presenting a
> start-to-finish
> example for *each* of the targets (not just C#), starting with a
> rudimentary
> grammar and ending with the necessary dependencies for the build
> environment, e.g. Visual Studio.  This would include, again, clear
> definition of which version of ANTLR must be used in each case.

Once again, I don't know which wiki pages you refer to. Next to be more generous with links you could also get an account for the wiki and fix the missing information once you discover it. I don't mean to sound snarky but I won't look at every page on the wiki and guess if fixing is required there.
> 
> I will add all of the assembly references and see if that helps.  But I
> think I'm still having a version-skew problem, as H. Link suggests, and
> you
> seem to confirm.
> 
> Incidentally, if you are the author of the file describing the "what I
> have
> to do to cut a release" of the C# target using NAnt, then I say  *Thank
> You*
> for a document which I will definitely need.

That was done by the previous maintainers. Everything with Kunle Odutola was at least initially theirs. Although as it has been pointed out already, the assemblies are already included in the archive and uptodate.
> 
> Finally, thank you for pointing out in the wiki that ANTLRWorks can
> remotely
> debug non-Java parsers.  I look forward to making use of this, as soon as
> I
> have a C# parser running.

I'm quite sure that Kunle added that text, probably after I asked around about the very topic myself. :)
> 
> I sincerely appreciate your taking the time to help me get started with
> ANTLR.
> 
> Best Regards,
> C. Mundi

No problem. :)

Johannes
> 
> On Wed, May 14, 2008 at 3:43 AM, Johannes Luber <jaluber at gmx.de> wrote:
> 
> > C. Mundi schrieb:
> >
> >>
> >> Ok.  I have been reading the wiki and experimenting with ANTLRWorks
> while
> >> waiting for the book to arrive in my mailbox.
> >> I'm not sure the book will (or should) answer this.  I am looking for a
> >> start-to-finish example targeting C#.  The finish line for me is _not_
> the
> >> output of ANTLR.  My finish line is a Windows dll or exe that actually
> >> parses user input.
> >>
> >
> > There are example grammars for C# on the download page.
> >
> >>
> >> I am already able to generate lexing and parsing code for various
> targets,
> >> either with ANTLRWorks or with ANTLR from the Linux command line.
> >>  Ultimately I need to build Windows apps, so I need to get the ANTLR
> >> environment set up for Dev Studio.  So, newly emboldened by my success
> on
> >> Linux, I tried to port my new skills to Windows by gamely adding an
> option{
> >> language=CSharp; } phrase.  Oh, if only it were so easy!  I got C#
> code, but
> >> I couldn't build it.
> >>
> >> So I read a number of semi-mutually-contradictory-and-or-incomplete
> >> helpful hints on the wiki and by Googling.
> >>
> >
> > Can you describe where you found not-as-helpful-information on the wiki,
> so
> > I can fix it?
> >
> >>
> >> That got me as far as adding a Reference to the Antlr3.Runtime -- huge
> >> step forward.
> >>
> >
> > I'm not sure when which assemblies are required, but I always add
> > Antlr.Runtime, Antlr.Utilities, antlr.runtime and Antlr.StringTemplate.
> With
> > these you cover all bases.
> >
> >>
> >> Then I ran into this mysterious RecognizerSharedState object in the C#
> >> target.  Uh oh.  I guess I'm still missing a Reference to a .NET
> Assembly,
> >> which probably means I skipped an important step, like building it.  I
> get a
> >> vague sense of this from some of the postings, but I guess I'm just
> dense.
> >> Any clues will be greatly appreciated.  I'll be happy to wait for the
> book
> >> to arrive, if it has the answer.  Please be blunt.  Insults can only
> make me
> >> smarter.  :)
> >>
> >
> > My guess is that you are mixing code generation from ANTLR 3.1b1 with a
> > library from 3.0.1. They aren't even source compatible. Please use the
> > library and generation from the latest build - otherwise they may not
> work
> > together.
> >
> > Johannes
> >

-- 
249 Spiele für nur 1 Preis. Die GMX Spieleflatrate schon ab 9,90 Euro.
Neu: Asterix bei den Olympischen Spielen: http://flat.games.gmx.de


More information about the antlr-interest mailing list