[antlr-interest] Reccomended method: actions or TreeAdaptor?

Jim Idle jimi at temporal-wave.com
Thu Apr 26 12:05:55 PDT 2007


Marc,

The easiest thing to do would be to download the samples here:
http://www.antlr.org/download/examples-v3.tar.gz

and look at the example in there called simplecTreeParser. All you need do is expand on that example I think.

Jim

-----Original Message-----
From: Marc-André Laverdière [mailto:ma_laver at ciise.concordia.ca] 
Sent: Thursday, April 26, 2007 11:22 AM
To: Jim Idle
Cc: ANTLR Interest
Subject: Re: [antlr-interest] Reccomended method: actions or TreeAdaptor?

Hello,

I tried putting in some classes in a {} pair at the beginning, to no 
avail. AntlrWorks doesn't like the grammar.

I was thinking of having something like
a: b[$$]
b[classA a]: ... {a.addB(new B ($$));}

Would that work in V3? I'm getting a bit frustrated by the small 
documentation online, and I don't have the budget to buy the book. I 
really want to spare myself the pain of using Bison (and its annoying 
generated C/C++ code).

Just negotiating a deal here: if I can make this work (and I'll need 
help for that), I'll write an article on the Wiki titled "My grammar 
works, what do I do now?".

MA

Jim Idle wrote:
> Your colleague is correct. Unless you need some weird and wonderful elements to form the tree, you don't need your won tree adaptor or anything. You can specify the type of object that is passed around in the tree, so long as it inherits from BaseTree, but I doubt you need that either.
> 
> What you should do is download the ANTLR examples. In there you will find a small tree example.
> 
> Bon Chance,

Bonne chance :P

> <snip>
-- 
Marc-André LAVERDIÈRE, B. Eng., M. A. Sc. (in progress)
Computer Security Laboratory - Laboratoire de sécurité informatique
CIISE, Université Concordia University, Montréal, Québec, Canada
www.ciise.concordia.ca

/"\
\ /    ASCII Ribbon Campaign
  X      against HTML e-mail
/ \

"Perseverance must finish its work so that you may be mature and 
complete, not lacking anything." -James 1:4


More information about the antlr-interest mailing list