How to get an AST from the Smacc Java parser

Alexandre Bergel bergel at iam.unibe.ch
Thu Dec 23 22:27:09 UTC 2004


Hi!

It is different for some Smalltalk code because there are proper rules that build this tree up. However, with the java parser there is none. I heard (Marcus?) that the last SmaCC generate this tree...

Cheers,
Alexandre


On Thu, Dec 23, 2004 at 04:32:09PM -0500, Anthony Hannan wrote:
> 
> Alexandre Bergel <bergel at iam.unibe.ch> wrote:
> > The expression: 
> > JavaParser parse: 'Some Java code'
> > produces a collection of SmaCCToken. This is not an ast!
> > Is there a way to get a tree from this collection?
> 
> I believe the collection is a tree. Is it a flat list or are there
> nested collections? You have to add your own code next to the grammar
> expressions if you want to create custom nodes. Check out the closure
> compiler's SqueakParser for an example.
> 
> Cheers,
> Anthony

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



More information about the Squeak-dev mailing list