grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Grammatica-users] using grammatica in C#


From: Per Cederberg
Subject: Re: [Grammatica-users] using grammatica in C#
Date: Sat, 31 Jul 2004 19:13:12 +0200

Hi Stuart,

On Sat, 2004-07-31 at 18:46, Stuart Benjamin Heinrich wrote:
> I have not used Grammatica before but I'm trying to write my own simple parser
> right now in C#.  I have written my grammar file, but the documentation seems
> to be quite sparse-- how do I create a C# parser from this?  The manual only
> says how to do it for Java.

It is essentially the same as for Java. Note that Grammatica
1.4 is written in Java so it requires Suns JRE to run, 
although the parsers you generate are pure C#.

So, once you have Java on your machine just use the command-
line interface:

C:\Grammatica> java -jar lib\grammatica-1.4.jar ...grammar.. --csoutput
...

Check the C# output options at:
http://www.nongnu.org/grammatica/doc/manual/commandline.html

NOTE THOUGH, that before generating the source code for
your parser, why not try it out first? Run with --tokenize
and --parse to check that your grammar works as expected on
some example input files.

If you need a complete source code example for how to use
the generated source code, there are a few included with
the distribution (see the /test/src/csharp directory) and
the instructions in:
http://www.nongnu.org/grammatica/doc/manual/example.html
(The C# version is *very* similar to the Java one, mostly
it is only the InitialUpperCasing that differs).

Hope this helps (a bit)!

Cheers,

/Per
-- 
Per Cederberg, Software Consulting
http://www.percederberg.net/software/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]