As far as I understand, using return values and element labels in ANTLR are sufficient to build an AST. e.g.
r returns [int c, String d] :
a='class' b=ID ... {$c=$b; $d=$a;}
Is this kind of extension to eBNF called a S-attributed grammar?
Is it common to build ASTs that way?
I'm especially interested in unparsing an AST (not a parse tree) build from this attributed grammar. Are there any benefits from restricting the attributes to pure assignments? (no function calls e.g. $c= fun($a)
) I've explained my unparsing problem here on SO.