[antlr-interest] Re: C# JML Parser

steinkobe88 steinkobe88 at yahoo.com
Sat Apr 17 15:21:10 PDT 2004


--- In antlr-interest at yahoogroups.com, "micheal_jor" <open.zone at v...> wrote:
> --- In antlr-interest at yahoogroups.com, "steinkobe88"
> <steinkobe88 at y...> wrote:
> > I am attempting to build a JML parser in C#.  JML is a java
> > specification language (http://
> > jmlspecs.org)
> > 
> > The tool I need to build will parse JML syntax only.  However, the
> > tool must be writted in 
> > C# and work under the .NET platform.  I want to use ANTLR is
> > conjunction with the 
> > following two grammar files:
> 
> Why must it be written in C#?. Not wishing to start a language war,
> just a dispassionate question about the rationale for your stated
> requirement.
> 
> > http://cvs.sourceforge.net/viewcvs.py/jmlspecs/JML
> > 2/org/jmlspecs/checker/Jml.g
> > http://cvs.sourceforge.net/viewcvs.py/multijava/MJ
> > /org/multijava/mjc/Mjc.g
> 
> > The problem I am having is getting these grammar files to work under
> > C#.  A lot of the 
> > code within these files depends on Java class libraries, which C#
> > does not have access to.  
> > Can ANTLR take these grammar files as inputs and create a C# syntax
> > checker as an 
> > output?
> 
> Yes and No. Yes ANTLR can take the files as input. No, it will not
> automagically create lexers/parsers/treeparsers for a *working* JML
> syntax checker (GJ compiler in the case of MJC) written in C# from
> these input files. It will create exactly what you ask it to -
> lexers/parsers/treeparsers for a syntax checker or compiler written in
> Java. If you change the language option to C# then you will get
> lexers/parsers/treeparsers for a syntax checker or compiler written in
> C# with action code in Java. Neither results in what you want.
> 
> You have three options AFAICT:
> 1. Convert all the action code in the grammars to C#. You will need to
> convert all the supporting code currently written in Java as well.
> Change the language option to C# and build.
> 2. Build the code as is in Java and use the MS J# product to get you a
> working .NET version. Not in C# but it is much less work than (1) and
> you have a better chance of getting it to work. Quickly.
> 3. Build the code as is in Java and use the IKVM.NET tools (see
> www.ikvm.net) to run your code on the .NET/Mono platforms. Not in C#
> but it is much less work than (1) and, it may support JDKv1.1.4+
> features that (2) doesn't support.
> 
> Cheers,
> 
> Micheal
> ANTLR/C#

Michael,

Thanks for your suggestions, I am going to try them out right now.  The parser doesn't 
need to be written in C#; it only needs to run on the .NET platform.

Brandon



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list