From: Robert Schaaf Date: 2009-06-10T11:24:59+09:00 Subject: treetop grammar problem I have devised this grammar for roman numerals for treetop. grammar RomanNumeral rule roman_numeral ('MMM' / 'MM' / 'M')? (('C' [DM]) / ('D'? ('CCC' / 'CC' / 'C')?))? (('X' [LC]) / ('L'? ('XXX' / 'XX' / 'X')?))? (('I' [VX]) / ('V'? ('III' / 'II' / 'I')?))? end end It recognizes numbers in the range 1-3999, and rejects all bad input as far as I can tell. T But the empty string passes! The problem is that any part is optional, but not ALL parts. At a minimum, there must be one digit. Duh. Treetop is ingenious, and easy to use, except when it's hard. Does anyone have a suggestion? I'm new at this, so I beg your patience. Also, is there a better way of translating "M{0,3}" than "('MMM' / 'MM' / 'M')?" ? Bob Schaaf