I've searched for documentation on SableCC 3 ASTs, but haven't found a good description of the AST section.
I've pieced together a bunch of things, but I am now stuck.
I have a grammar that contains the following production(s):
var_type = {event} event_token
| {integer} integer_token
| {parameter} parameter_token
| {real} real_token
| {reg} reg_token
| {supply0} supply0_token
| {supply1} supply1_token
| {time} time_token
| {tri} tri_token
| {triand} triand_token
| {trior} trior_token
| {trireg} trireg_token
| {tri0} tri0_token
| {tri1} tri1_token
| {wand} wand_token
| {wire} wire_token
| {wor} wor_token;
Each of the alternatives is a token formed from the (obvious) characters (e.g., a "time_token" is the token for when the word "time" has been found by the lexer.)
I want the var_type to be represented by a Java Enumeration with a value for each of the possible tokens.
- What goes in the AST section?
var_def = ?;
- What goes in the code section for each alternative. I would think it would be something like:
| {tri1} tri1_token { -> New var_type(TRI1) }
Thanks for your help.
Steve