[antlr-interest] Strategy for generating text pattern for a decrementing value
John Ridgway
john at jacelridge.com
Tue Apr 22 10:08:32 PDT 2008
I think you'll find that StringTemplate has everything you need to do
this. Check the documentation pages at stringtemplate.org.
Peace
- John
On Apr 22, 2008, at 9:56 AM, Simon Woods wrote:
> Hi
>
> 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.
>
> Many thanks
>
> Simon
>
More information about the antlr-interest
mailing list