libparse-recdescent-perl/demo/demo_autostub.pl

23 lines
278 B
Perl
Raw Permalink Normal View History

2022-09-23 10:00:36 +08:00
#! /usr/local/bin/perl -ws
# use strict;
use Parse::RecDescent;
print 1 if Parse::RecDescent->new(<<'EOGRAMMAR')->file(join "", <DATA>);
<autostub>
file: defn(s)
defn: 'def' ident ':' block
block: '{' item(s) '}'
EOGRAMMAR
__DATA__
def ident : { item item item }