[antlr-interest] how to deal with this function?

李志鹏 lizhipeng at gmail.com
Sun Oct 23 07:43:20 PDT 2011


hello all:

In my rule, I have a function named "Between".

It has more than one parameters, the first is compare value, the next two
define a range, and next two next range, and so on. if only one parameter
left, it means the range has no upper limit.

such as:

Between(a, 1, 20, 25, 30), it means   (a>1 and a<20) or (a >25 and a<30)
Between(a, 1, 20, 25)  it means  (a>1 and a<20) or (a >25)

I wonder how to describe it in rules, and how to describe it in Tree
grammar, and how to  build an AST tree, and how to deal it in tree walker.

thanks for your help.


More information about the antlr-interest mailing list