SmaCC: Returning annotation from a production #4103
|
Is it possible to return That is, I would like to return |
Replies: 10 comments 7 replies
|
@j-brant Please correct my understanding... There's no returning just That is, each token in a production becomes a field. The only control I can exercise here is to annotated the tokens and name the AST node ( |
|
If |
|
Why return tokens like brackets, comma, etc. from a production? |
|
You can return anything from a production. For example, you can return |
|
If you don't name the token, then they are excluded by default from being AST node. The code blocks are explained somewhat here: https://books.pharo.org/booklet-Smacc/ |
|
Can you post your grammar? It works for me: This generates a |
|
By the way, I tried removing the repo cloning it after restarting GT. I still get the extra token instance variables. |
|
I started with a fresh copy of GT and cloned my repo. I still get the extra tokens as instance variables. |


Your grammar has
%annotate_tokens;