Parrot/PGE, parsers Parsers, Perl 6 Rules, and the Parrot Grammar Engine #31

Calling the operator precedence parser as a subrule

In order to call the operator precedence parser as a subrule, we have to write a Parrot sub that re-dispatches the subrule call to the operator precedence parser. For example:

.namespace [ 'Simple::Grammar' ]
.sub "expression"
    .param pmc mob
    .param pmc adverbs     :named :slurpy

    .local pmc optable
    optable = find_global "Simple::Grammar", "$optable"
    .return optable.'parse'(mob)
.end
Copyright © 2006 Patrick Michaud