FAQ
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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-compiler @
categoriesperl
postedJun 2, '10 at 1:31a
activeJun 2, '10 at 1:31a
posts1
users1
websiteperl6.org

1 user in discussion

Stéphane Payrard: 1 post

People

Translate

site design / logo © 2021 Grokbase