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.

Reply via email to