[antlr-interest] Re: Is C# supported for parser generation yet pls?

Terence Parr parrt at jguru.com
Sat Jan 19 10:20:47 PST 2002


On Saturday, January 19, 2002, at 10:13  AM, micheal_jor wrote:

> --- In antlr-interest at y..., Terence Parr <parrt at j...> wrote:
>
> Thank you for the helpful reply Terrence,
>
>>> Does ANTLR support the creation of parsers in C#?
>>
>> Nope.  (not yet?)  I talked with a friend at M$ who said he had
> one .5
>> finished, but he's probably too busy to finish.  Code is pretty
> dark and
>> icky in there ;)
>
> OK, that's could be good news really. If he hasn't got he time right
> now and, he's happy to toss what he has into my cubicle with some
> notes that explains how thing fit, I'll finish it.
>
>>> If not, can someone pls outline the steps I need to take in order
> to
>>> add C# output to ANTLR?
>>> - I am familiar with C# and Java but not with ANTLR. So as long
> as I
>>> am pointed in the right direction (and all the right directions
> pls),
>>> I'll be OK.
>>> - If I get helpful pointers in time, I'll get cranking with the
> hope
>>> that C# support will be added before 2.7.2 reaches final status.
>>> - On that note, is there a grammar for ANTLR that has extensive
>>> compliance tests that I can use to test the generated grammar-
> parser?
>>
>> The example grammars are a good step, but (mea culpa mea culpa)
> there is
>> no good regression test.  Nothing automated anyway.
>>
>> As for a code generator, the diff between CPP and Java should be a
> good
>> clue.  You need a code generator object called CSharpCodeGenerator
>> (subclass of CodeGenerator) plus an action.g file to parse C#
> actions
>> within a grammar and lots of support code in C# that would mimick
> the
>> C++ and Java stuff.
>>
>> Probably not something that can be done that quickly, although C#
> is
>> remarkably close to Java ;)
>
> OK, if I do the following:
> 1) Create the file antlr/CSharpCodeGenerator.java using
> antlr/JavaCodeGenerator.java as a template
> 2) create a new directory antlr/actions/csharp and port all the stuff
> from antlr/actions/java into it
> 3) do the same for antlr/examples/csharp from antlr/examples.java
>
> Will this result in C# as a new target?. If not, what else do I need
> to do please?
>
> LIB:
> I noticed that there isn't an antlr/lib/java directory. Something
> tells me it exists somewhere nonetheless - perhaps subsumed into
> ANTLR itself - and that it needs porting too. Is this correct? Can
> you identify the files that comprise this "lib/java" pls?

lib/cpp/antlr is what you'd have to mirror.

>
> TESTING:
> I'm thinking that perhaps I can use the Jacks suite to test the
> parsing with the Java grammar?

If you change the syntax ;)  How good are you with emacs? ;)  Or build 
an ANTLR grammar to pull in JavaCC stuff :)

>
> I *am* happy to aim for inclusion in 2.7.2 but as you can see, I need
> help getting around the ANTLR source tree at this stage.

Hopefully that will get you started...I'm running out at the 
moment...private email with m$ email coming to you now.

Ter
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list