[antlr-interest] Re: C# JML Parser
micheal_jor
open.zone at virgin.net
Fri Apr 16 23:57:56 PDT 2004
--- 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#
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