1
#! /usr/local/bin/perl -sw
7
object: thing[article=>'a'](s)
8
| thing[article=>'the'](s)
10
thing: <matchrule:$arg{article}>
11
<matchrule:${\scalar reverse $::animal}>
16
cat: 'cat' { print "meow\n"; $::animal = 'god' }
17
dog: 'dog' { print "woof\n" }
20
unless( $parser = new Parse::RecDescent( $grammar ))
22
die "bad grammar; bailing\n";
26
while (defined ($input = <DATA>))
28
$::animal = reverse 'cat';
30
print STDERR "parsing...\n";
31
unless( defined $parser->object( $input ))
33
die "error in input; bailing\n";
35
print STDERR "...parsed\n";