[antlr-interest] C# TARGET ANNOUNCEMENTS

Johannes Luber jaluber at gmx.de
Thu Apr 10 15:44:30 PDT 2008


Micheal J schrieb:
> Johannes, 
> 
>> Hi!
>>
>> It's time to give you all an update how the C# target will evolve to.
>>
>> The general direction is that I will phase out support for C# 
>> 1.0 for ANTLR 3.3, if nothing major comes up (meaning that a 
>> user can't update to .NET 2). I want to split the runtime 
>> library into two, so I can use generics and other stuff.
>>
>> Because of these major changes, I want to have at least one 
>> minor ANTLR version as a testbed. As I didn't find the time 
>> to do those changes for 3.1, the testbed will be 3.2. The 
>> reason for this early announcement is that a bugfix requires 
>> the use of a C# 2.0 feature.
> 
> Is this fix and the C# 2.0 dependency indicated in the depot logs?
> 
> [UPDATE: can't see any notes to that effect in the logs. What change no.
> should I look at?]

Well, the latest changeset is 4759, but looking over the logs in 
perforce I see that I didn't mention it there. I assumed that once the 
wiki page is updated, people will know it in general. Otherwise I don't 
see any file in the source distribution, which mentions changes.

>> If you want to use a non-intrinsic value type then you have 
>> to use the new target CSharp2 or to change the template 
>> yourself (for all installations). While the runtime library 
>> will work for both targets, if you want to (and can) 
>> futureproof your application then change the target as soon 
>> as possible.
> 
> One can use any value type with the 'CSharp' target already AFAICT. Does the
> new 'CSharp2' target remove the need to update the 'csharpTypeInitMap'
> default value map in the templates for unspecified value types?

Actually, I meant this, even if it didn't came correctly over.

>> I'm also happy to release the beta 1 for the 3.1 C# target: 
>> It is synced with the latest Java changes and compiles all 
>> example grammars successfully. While the changes have been 
>> checked in, there may no intermediate build available yet 
>> which includes the changes. This depends on Ter.
>>
>> Changes include:
>>
>> - Following Java target evolution.
>>
>> - Changed lowercase signatures into uppercase so the runtime 
>> conforms more to C# conventions. For example, $a.tree in 
>> grammar, but a.Tree in code. $-syntax is not affected 
>> although the exceptions compared to Java target will be 
>> probably removed (if I find the source that is).
> 
> I don't understand what you mean here. What exceptions are these?. Exception
> types?. Could you supply example(s) to illustrate perhaps?

<http://www.antlr.org/wiki/display/ANTLR3/Antlr+3+CSharp+Target> Scroll 
down to "Syntactic differences from the Java target". I aim to remove 
them, but I have to look further into this issue.

>> - Broke the IToken dependency for Token, as this didn't make 
>> any sense compared to the Java target. If you derive your 
>> class from Token or use Token as Type, please change that into IToken.
> 
> Interesting. What problem/issue was solved by removing Token as the abstract
> base class for all the token types included with ANTLR? Had quick look at
> the diffs and nothing jumped out.

The simple reason is that Token as base class didn't add anything beyond 
an extra step in the hierarchy. Nearly all IToken properties were 
abstract and the one that wasn't was overridden anyway. Also the Java 
target operates on the interface itself, as does the rest of C#. Nothing 
but extra complexity for no benefits.

>> - Bug fixes.
>>
>> - No binaries for .Net 1.1 created yet. It is on my todo list.
> 
> If you have .NET v1.1 and .NET v2 installed on your box (or in a VM), the
> Nant script takes care of building both:
>    nant release -t:net-1.1 
>    nant release -t:net-2.0 

Well, it could be that I'm using Linux and Nant 0.86 Beta, but I get:

"...ANTLR/code/antlr/main/runtime/CSharp> nant release -t:mono-2.0
NAnt 0.86 (Build 0.86.2898.0; beta1; 08.12.2007)
Copyright (C) 2001-2007 Gerry Shaw
http://nant.sourceforge.net

Buildfile: 
file:///home/verequus/Arbeit/ANTLR/code/antlr/main/runtime/CSharp/all.antlr3.runtime.net.build
Target framework: Mono 2.0 Profile
Target(s) specified: release


BUILD FAILED

/home/verequus/Arbeit/ANTLR/code/antlr/main/runtime/CSharp/all.antlr3.runtime.net.build(11,3):
Could not include build file 
'/home/verequus/Arbeit/ANTLR/code/antlr/main/runtime/CSharp/antlr3.runtime.net.common.inc'.
     a name did not start with a legal character 34 (") 
file:///home/verequus/Arbeit/ANTLR/code/antlr/main/runtime/CSharp/antlr3.runtime.net.common.inc 
Line 28, position 114.

Total time: 0.1 seconds."

I suppose it doesn't matter because I will switch to Prebuild due to 
later reorgs in the code base. Then I can get easily uptodate project files.

> Nice to see C# up and running again. Good job.

Thanks!


More information about the antlr-interest mailing list