Yes, nice alternative. I am using this in a framework on any BNF to automatically fill structures on-demand -;
https://github.com/jddurand/MarpaX-Role-Parameterized-ResourceIdentifier/blob/master/lib/MarpaX/Role/Parameterized/ResourceIdentifier/BNF.pm#L699 Le vendredi 27 novembre 2015 09:41:52 UTC+1, Cev Ing a écrit : > > > Am Donnerstag, 26. November 2015 23:53:26 UTC+1 schrieb Jeffrey Kegler: >> >> The LHS is available to an action via context variables >> <http://search.cpan.org/~jkegl/Marpa-R2-3.000000/pod/Semantics.pod#Action_context>. >> >> So you could write your own dispatcher and either make it the default >> action or apply it selectively. >> > > Thanks. This action helps me getting warm with Marpa actions: > > sub lhs { > my ($lhs) = map { > $Marpa::R2::Context::slg->symbol_display_form($_) > } $Marpa::R2::Context::slg->rule_expand($Marpa::R2::Context::rule); > return $lhs; > } > > sub dump_and_exit > { > my ($self, @args) = @_; > print lhs, "\n", Dumper (@args); > exit; > } > > I use it gradually from the top to the bottom of the grammar. After > reaching the bottom I can go back to the top by replacing each > dump_and_exit by some useful code. Together with the default action > [name,values] I think I can finish my task pretty fast. > -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
