[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Grammatica-users] Re: A doubt with the C# builder
From: |
Per Cederberg |
Subject: |
[Grammatica-users] Re: A doubt with the C# builder |
Date: |
04 Sep 2003 02:17:56 +0200 |
¡Hola Jorge!
I'm forwarding my answer to the grammatica-users list, so
that everyone can comment on this. (Maybe someone would
like to write a tutorial?)
On Wed, 2003-09-03 at 04:09, Jorge Pablo Cordero Hernandez wrote:
> Hi, I've just started using gramatica and I want to make a parser in
> C#, but i got a trouble, the example that is given in the site it's
> about a java application, so is there any webpage where I can find a
> tutorial or the steps for using and compiling linking in a project all
> the .cs files generated from gramatica
>
> can you help me please??
I'm not currently aware of any C# tutorial or similar.
There is no big difference in using Grammatica for C#
in comparison to Java, however. The following steps
are required:
1. Run Grammatica in the normal way (yes, Grammatica
is a Java application, but can output C# source
code). I guess the command-line interface is most
suitable for you (requires a modern java.exe, i.e.
not the Microsoft version):
http://www.nongnu.org/grammatica/doc/manual/commandline.html
2. Write your own analyzer, by subclassing the one
generated by Grammatica (WhateverAnalyzer.cs). Only
override the methods you are interested in. The Java
example in the reference manual actually works, if
you just "port" it to C# (change method names to
initial uppercase, remove "throws", add "override"):
http://www.nongnu.org/grammatica/doc/manual/example.html
3. Compile with the grammatica-1.4.dll assembly. For
Mono, I do like this:
mcs -lib:./lib -reference:grammatica-1.4.dll ...
I'm running on Linux, so I can't advise on how the
Microsoft C# compiler works. Maybe somebody else on
the list knows that?
If you want to see some example C# code, have a look in
the test/src/csharp/PerCederberg.Grammatica.Test
directory. In particular, I'd recommend the
ArithmeticCalculator.cs file (and the corresponding
arithmetic.grammar file in test/src/grammar).
Hope this helps!
Saludos,
/Pedro
--
Per Cederberg, Software Consultant
http://www.percederberg.net/software
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Grammatica-users] Re: A doubt with the C# builder,
Per Cederberg <=