[antlr-interest] Compile errors with CSharp2 Target

Sam Harwell sharwell at pixelminegames.com
Wed Feb 16 07:21:58 PST 2011


Hi Simon,

Using the 3.3.1 build I posted last night, the only issue with the C# target
is the use of {$channel=HIDDEN;}. To match .NET naming conventions, the
hidden channel constant is Hidden, so they need to be changed to
{$channel=Hidden;}.

I updated the grammar you sent by:

1. Fixing the CSharp3 build issue (requires the 3.3.1 build I posted last
night).
2. Left factoring to remove the backtrack, memoize, and k=2 options.
3. Using the extended AST operators of the CSharp3 target to remove
unnecessary rewrite rules.

I haven't tested the result aside from making sure it compiles properly with
the CSharp3 target.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Simon
Sent: Wednesday, February 16, 2011 1:42 AM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Compile errors with CSharp2 Target

On Wed, Feb 16, 2011 at 10:47 AM, Johannes Luber <JALuber at gmx.de> wrote:
> Did you read the other emails stating you may have a grammar which is
meant to work with Java? If possible pls attach the grammar to the email, so
we can check this and any other errors. I forgot which ANTLR versions
require what runtimes exactly, but you need 3.1 or 3.2 for CSharp2. CSharp3
requires ANTLR 3.3 and other assemblies than I've provided, as the targets
aren't compatible with each other yet. Not sure if those assemblies are
provided in distro or where else you can find them. Sam should know more.

Ah, thanks to everyone for pointing out the obvious - I looked more
thoroughly in the grammar and in the end did find some stray bits of Java
code which, once eliminated let it compile just fine using
CSharp2.   I still have the same errors with CSharp3 (incorrect escape
sequences when generated with antlr 3.1.3, different errors with antlr
3.3).   I've attached the "purified" Php.g grammar that succeeds in
CSharp2 but fails in CSharp3 in case it is useful - however I think I will
proceed with CSharp2 at this point.

Thanks again for the help!

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Php.g
Type: application/octet-stream
Size: 9823 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20110216/eef26c94/attachment.obj 


More information about the antlr-interest mailing list