Hi, the attached patch modifying HLLCompiler.pir supports parsing from an arbitrary rule in a grammar, using the $:rule parameter
Example : grammar A { token a { a } }; say A.parse('a', :rule<a>).perl This is nice for testing part of a grammar. This patch is the result of the following conversation with TimToady : http://irclog.perlgeek.de/perl6/2010-06-01#i_2391972 23:34 cognominal rakudo: 'grammar A { token a { a } }; say 'a' ~~ /<A::a>/ # what is the proper way to directly use a rule from a grammar 23:34 p6eval rakudo 18d996: OUTPUT«===SORRY!===Confused at line 11, near "'grammar A"» 23:37 Schwern joined #perl6 23:43 TimToady rakudo: grammar A { token a { a } }; say A.parse('a', :rule<a>).perl 23:43 p6eval rakudo 18d996: OUTPUT«Match.new( # WARNING: this is not working perl code # and for debugging purposes only ast => Any, Str => "a", from => 0, orig => "a", to => 1,)» 23:43 TimToady something like that -- cognominal stef
parrot-parse_with_rule.2010-06-02.patch
Description: Binary data