views:

111

answers:

1

With Ruby's regular expressions I could write /[0-9]{3,}/ I can't figure out how to write this in treetop other than:

rule at_least_three_digit_number
  [0-9] [0-9] [0-9]+
end

Is there a 'match [at least|most] n' rule for treetop?

+2  A: 

It looks like PEGs don't have some of the RE convenience operators, but in return you do get a much more powerful expression matcher.

DigitalRoss
I belive this is a implementation issue, one could definitely write `a{2,3}` instead of `aa / aaa` if the implementations allows it (treetop does not afaik).
clyfe