[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom nodes.

Here's a suggestion.

There's always been some debate about whether SableCC classes should 
support attributes. Well a simple way to do it is to make your own AST 
classes by extending the SableCC generated ones. Then, you can set the 
attributes by writing a custom parser which builds an AST made entirely 
of your extended classes.

It works quite well - with two minor glitches. 1) You need to hack 
SableCC so that the generated classes are not declared 'final' (edit 
alternatives.txt and tokens.txt), and 2) You need to write new clone() 

Perhaps we could include support for this idea into SableCC 3.0...

Bye for now!