Grammar that is easier to extend
Junctions in Perl 6
Grammar subclassexamples/regex2/Add4.pm use Add3;
grammar Add4 is Add3 {
token operator:sym<\-> { '-' };
}
examples/regex2/Add4.pm.out
2 + 3 OK 2 + 4 OK 2 + 3 x exception received: Invalid value after the second operand 2 + exception received: Missing second operand 2 3 exception received: missing operator 2 - 3 OK Copyright 2006, 2007, 2008, 2009, 2010 Gabor Szabo http://szabgab.com/ Index | TOC |
Follow me: