Thanks for the answers!
That was a good rough guess Jim... I finally came up with this:
group : (OPEN
children+=group children+=space* |
I wrote a post yesterday about the trouble I'm having getting started with
ANTLR. Overnight, I thought about it some more, and I'm becoming convinced that
the latest problems I'm having are either problems with the Csharp target or
backwards compatibility problems between ANTRL example
I am using ANTLR's C# target for a couple of weeks now to create a domain
specific language that is a subset of the C programming language.
My experience is similar to yours, but I can assure you that the C# target
works and that it is actively maintained. It differs from the Java
Hi Andy Maik,
I agree that the C# target documentation is lacking in many ways. I try to
keep enough documentation at the following page to get you started on the
I've been using the CSharp3 target in a commercial product
which version c# runtime do you use? 3.4 or 3.3? download from official
i am newbie, want to build simple project could run an example, but two
weeks passed, i failed…
在 2011-10-19 下午10:36，pragmaik cont...@maik-schmidt.de编写：
I am using ANTLR's C# target for a couple of weeks
I kind of got turned off when CSharp3 target was first introduced and the
code template had bugs in it. For example, at the end it would print out a
single line comment with the keyword namespace and the name of the namespace
(i.e. // namespace foo). The problem was somebody put a newline after
On 19/10/11 08:39, Norman Dunbar wrote:
Talking of which, is CSharp a good place to start as a beginner?
Sigh! Wish I could read.
When you wrote using the treeparser example code for target Csharp2 I
missed the word target and thought that you were playing with a
t1+='void' (t2+='*')* - ^(LIST TYPE[$t1]+ TYPE[$t2]+)
By interpolating from your question. At least, that should get you on the
From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
boun...@antlr.org] On Behalf Of Christian
I can confirm that the Csharp3 target is very viable and works perfectly
well. I think that your problems are more to do with being new to ANTLR
and then trying to use the CSharp target as your first try. If you used
the Java target purely inside ANTLRWorks just until you get going, then
I just started using antlr and was able to construct a nice grammar that
fulfills my application's needs. There is one thing which I haven't been
able to get to work though.
My grammar is parsing program arguments which the user supplied when
starting the program, and some of that input
I suggest that you want to use getargs, and not try to parse things like
this with ANTLR as the specification is too vague. The lexer is not
context driven, so placing a rule like that in lexer will match everything
that is whitespace to the detriment of any other rule at all.
Try using Console.WriteLine() instead of System.out.println(). What is
inside of the curly braces is directly injected into the C# code being
generated, and therefore needs to be C# syntax, not Java.
On 10/19/2011 2:25 PM, Voelkel, Andy wrote:
First, thanks for the
Is Java code, which is why I encourage you to just use ANTLRWorks with
Java to get your head around ANTLR, then you will be able to see the woods
from the trees switching to C#.
In addition to the other's suggestions, change HIDDEN to Hidden. The C# target
attempts to use standard C# conventions when possible. It can be frustrating
when working from the books and Java-focused documentation, but once you get
past the few differences and gain some momentum, you
That's the ticket (change HIDDEN to Hidden)! But doesn't that make the grammar
non-portable, and aren't portable grammars a goal of ANTLR?
Also, it verifies my suspicion that the example code I got (for Csharp) was
wrong. All the examples I downloaded are wrong, I just checked.
-- Forwarded message --
From: Eric researcher0...@gmail.com
Date: Wed, Oct 19, 2011 at 3:25 PM
Subject: Re: [antlr-interest] How viable is the Csharp3 target? (more
To: Voelkel, Andy andy.voel...@plantronics.com
On Wed, Oct 19, 2011 at 3:16 PM, Voelkel, Andy
No, your solution still generates invalid java code for me. Did you test
your solution? The TYPE token does not accept a list as parameter. It is
a simple token defined within the token block at the top of the grammar.
It seems that the construction of an implicit list is only possible for
Sorry, I did not see that list thing, but I was trying to get you on the
First, don't use literals
Put the tokens in subrules
Change the token type in subrule (I usually just set the type field in the
token, but that is a bit of a cheat)
I don't have time to test every code snippet
Mail list logo