Parse::RecDescent 1.94 review

Download
by rbytes.net on

License: Perl Artistic License
File size: 123K
Developer: Damian Conway
0 stars award from rbytes.net

Parse::RecDescent is a Perl module to generate Recursive-Descent Parsers.

SYNOPSIS

use Parse::RecDescent;

# Generate a parser from the specification in $grammar:

$parser = new Parse::RecDescent ($grammar);

# Generate a parser from the specification in $othergrammar

$anotherparser = new Parse::RecDescent ($othergrammar);


# Parse $text using rule 'startrule' (which must be
# defined in $grammar):

$parser->startrule($text);


# Parse $text using rule 'otherrule' (which must also
# be defined in $grammar):

$parser->otherrule($text);


# Change the universal token prefix pattern
# (the default is: 's*'):

$Parse::RecDescent::skip = '[ t]+';


# Replace productions of existing rules (or create new ones)
# with the productions defined in $newgrammar:

$parser->Replace($newgrammar);


# Extend existing rules (or create new ones)
# by adding extra productions defined in $moregrammar:

$parser->Extend($moregrammar);


# Global flags (useful as command line arguments under -s):

$::RD_ERRORS # unless undefined, report fatal errors
$::RD_WARN # unless undefined, also report non-fatal problems
$::RD_HINT # if defined, also suggestion remedies
$::RD_TRACE # if defined, also trace parsers' behaviour
$::RD_AUTOSTUB # if defined, generates "stubs" for undefined rules
$::RD_AUTOACTION # if defined, appends specified action to productions

Parse::RecDescent incrementally generates top-down recursive-descent text parsers from simple yacc-like grammar specifications.

Here are some key features of "Parse RecDescent":
Regular expressions or literal strings as terminals (tokens),
Multiple (non-contiguous) productions for any rule,
Repeated and optional subrules within productions,
Full access to Perl within actions specified as part of the grammar,
Simple automated error reporting during parser generation and parsing,
The ability to commit to, uncommit to, or reject particular productions during a parse,
The ability to pass data up and down the parse tree ("down" via subrule argument lists, "up" via subrule return values)
Incremental extension of the parsing grammar (even during a parse),
Precompilation of parser objects,
User-definable reduce-reduce conflict resolution via "scoring" of matching productions.

Requirements:
Perl

Parse::RecDescent 1.94 search tags