jcwren has asked for the wisdom of the Perl Monks concerning the following question:
--Chris#!/usr/local/bin/perl -ws use strict; use Parse::RecDescent; { $| = 1; my $grammar; { local $/; $grammar = <DATA>; } my $parser = Parse::RecDescent->new ($grammar); print ">"; while (<>) { print $parser->main ($_), ">" || die "Bad Code"; } } __DATA__ main: /^\s*\Z/ | input_line EOL | <error> EOL: /\s*\Z/ input_line: opcode_8031 # # The opcode code list. Reverse these two to fix, or RET/RETI orderi +ng to break. # opcode_8031: opcode_ret | opcode_reti opcode_ret: OP_RET opcode_reti: OP_RETI # # 8031 opcodes # OP_RET: 'ret' OP_RETI: 'reti'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parse::RecDescent and grammar specification
by chromatic (Archbishop) on Nov 05, 2000 at 08:43 UTC | |
|
Re: Parse::RecDescent and grammar specification
by metaperl (Curate) on Nov 05, 2000 at 17:36 UTC | |
|
RE: Parse::RecDescent and grammar specification
by Anonymous Monk on Nov 06, 2000 at 14:51 UTC |