NAME

Math::Symbolic::Parser - Parse strings into Math::Symbolic trees

SYNOPSIS

use Math::Symbolic::Parser;
my $parser = Math::Symbolic::Parser->new();
$string =~ s/\s+//g;
my $tree   = $parser->parse($string);

# or better:
use Math::Symbolic;
my $tree = Math::Symbolic->parse_from_string($string);

DESCRIPTION

This module contains the parsing routines used by Math::Symbolic to parse strings into Math::Symbolic trees. Usually, you will want to simply use the Math::Symbolic->parse_from_string() class method instead of this module directly. If you do, however, make sure to remove any whitespace from your input string.

The strings may contain any operators/functions that are listed in the Math::Symbolic::Operator documentation (in the docs for the new() constructor). Furthermore, they may contain numeric constants and variables. variable names must match [a-zA-Z][a-zA-Z0-9_]* (letter followed by any number of letters, digits, and underscores). Variables will be constructed as new Math::Symbolic::Variable objects with default value.

EXPORT

None by default.

CLASS DATA

While working with this module, you might get into the not-so-convient position of having to debug the parser and/or its grammar. In order to make this possible, there's the $DEBUG package variable which, when set to 1, makes the parser warn which grammar elements are being processed. Note, however, that their order is bottom-up, not top-down.

Constructor new

This constructor does not expect any arguments and returns a Parse::RecDescent parser to parse algebraic expressions from a string into Math::Symbolic trees.

AUTHOR

Steffen Mueller, <symbolic-module at steffen-mueller dot net>

New versions of this module can be found on http://steffen-mueller.net or CPAN.

SEE ALSO

Math::Symbolic