This project has moved and is read-only. For the latest updates, please go here.


Mar 21, 2008 at 4:24 PM
First of all I'd like to thank the developers for making this great software, i've always been confused by this stuff but now I can manage it easily.

I've been developing a grammer for parsing advanced expessions, based on the template provided. I found it easy to add features but now I've run into a problem and I think filters would solve this problem, but I don't know how to proceed.

I have a MultipliedVar NonTerminal for handling productions such as: 3X, 3sin(x) and 13(4x + 7)

Using the 3X example, I need a filter to reduce each MultipliedVar terminal like this,

3, number
X, variable

into this:

3, number
X, variable

Any suggestions?
Mar 21, 2008 at 5:43 PM
I think the best way to do this is to create a filter that expands your MultipliedVar token into 3 tokens. The constituent tokens may be prepared by MultipliedVar.TryMatch method, and saved into token.Attributes dictionary. Yea, I know, it looks ugly, but that's the only way I see it for now.
The better way would be to return 3 tokens from TryMatch method directly, while current structure allows only a single one. I was thinking about scenario like this before, and I think the best way to accomodate this is to introduce a MultiToken - a special Token that is a container for several tokens. TryMatch can return this token and Scanner would recognize it and "expand" automatically, without any extra filters. This thing is on my to-do list, I'll move it up, so expect it soon. For now - writing a special filter is the only way.
Mar 21, 2008 at 10:54 PM
Thanks for the reply, I guess I will wait for the next version of Irony then.