I forked this and made a couple of changes
<https://gist.github.com/jeffreykegler/9575923/revisions> that should
get you going on the semantics. I could not figure out how to send a
pull request. Is that possible for gists?
By default rules, rules return 'undef', which explains what you were seeing.
To get started on a script, it is best to change that default, as I did
in the gist, adding this line:
:default ::= action => ::array
It should be the default, but is not for reasons of backward compatibility.
Hope this helps, jeffrey
On 03/15/2014 04:46 PM, John Alvord wrote:
I've been a lurker for a while and have recently been testing marpa on
a current project.
I am working with a mini-language which gets translated into SQL
finally. Here is a minimal sample
my $input="*IF *VALUE Log_Entries.Log_Name *EQ errlog ";
I created a gist here https://gist.github.com/jalvo2014/9575539 with a
test program. It includes a BNF file and [after debugging the BNF ] I
put an action on one of the rules and a routine to get control.
<basic_condition> ::= <basic_function> <attribute> <comparison>
<literal> action => do_basic
...
$recce = Marpa::R2::Scanless::R->new(
{ grammar => $grammar,
semantics_package => 'My_Actions',
trace_terminals => 1,
trace_values => 1,
});
...
sub My_Actions::do_basic {
my ( undef, $t1, $t2, $t3, $t4 ) = @_;
if (defined $t1) {
$DB::single=2;
print "My_Actions::do_basic: $t1 $t2 $t3 $t4\n";
return undef;
}
}
but when the do_basic gets control all the $t1/$t2/$t3/$t4 are undef.
After struggling for a week - likely on something simple - I could
really use some help.
Thanks.
John Alvord
--
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]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
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.