Yacc - allow users to input grammars using a Yacc-like syntax
This is an example of a syntax-directed translator. It is intended to be used as follows: write a yacc-style grammar in a separate file, with a line at the bottom that will call this module. Output the result to a file, and require the resultant perl data structure into your code. The name of the variable is "grammar" by default. Example:
use Parser::Input::Yacc; use Scanner::Stream::String; $grammar = new Scanner::Stream::String(<<'EOG'); start: $SAMPLE { print "sample\n"; } | $EXAMPLE { print "example\n"; } ; EOG Parser::Input::Yacc::Convert($grammar, "grammar");
To install Parser::Table, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parser::Table
CPAN shell
perl -MCPAN -e shell install Parser::Table
For more information on module installation, please visit the detailed CPAN module installation guide.