Treetop expects the first rule to be the "basic rule." He does not try to apply all the rules that you have defined until they match - he applies only the basic rule, and if this does not match, it fails.
To do what you want, you need to add a basic rule, which can be a number or an identifier, for example:
grammar RCFAE rule expression num / identifier end rule num [0-9]+ <Num> end rule identifier [a-zA-Z] [a-zA-Z]* <ID> end end
source share