[antlr-interest] Repeating output constructs with string templates

Hardy, Stephen Stephen.Hardy at digi.com
Wed Aug 29 17:27:22 PDT 2007


In C one can create declarations like

  int a, b, c;

which, in a C parser, may result in an AST something like

  ^(DECL type declarator+)

It is easy to get string templates to output the original code, but I
would like to transform the original code to something like

  int a;
  int b;
  int c;

that is, repeating the type for each declarator.

Is this possible using ST, or do I need to manipulate the AST first?

Regards,
SJH


More information about the antlr-interest mailing list