[antlr-interest] Strategy for generating text pattern for a decrementing value
simon.woods at virgin.net
Tue Apr 22 06:56:26 PDT 2008
I am translating a language into a new form, so I have a grammar, tree
walker and several templates.
In the original language, there may be an occurance of a particular
expression which contains a number, N. If this expression occurs, based
on the value this number, I want to generate a text pattern something like
"mytextpattern-(N) OR mytextpattern-(N-1) OR mytextpattern-(N-2) OR
mytextpattern-(N-3) ..." until N = 0
I am unsure of the way to approach this and am wondering if someone
could give me some pointers. e.g. Should I be passing that number into a
rule and then decrementing the value by passing it somehow into a method
in the native language (C#) and then using that returned value.
More information about the antlr-interest