eyapp(1) - Linux man page

Name

eyapp - A Perl front-end to the Parse::Eyapp module

Synopsys

eyapp [options] grammar[.eyp]

eyapp [options] grammar[.yp]

eyapp -V                      # Produce .output file

eyapp -h                      # help

eyapp -c grammar.eyp          # Strip semantic actions

eyapp -vc grammar.eyp         # Strip comments also

eyapp  -b shebang grammar.eyp #  Adds '#!<shebang>' as the very first line of the output file

eyapp  -B prompt grammar.eyp  #  Adds a modulino call at the end

eyapp  -C grammar.eyp         # An abbreviation for the combined use of -b ''  -B ''

eyapp  -T grammar.eyp         #  Equivalent to %tree

eyapp  -l                     # Do not generate default lexical analyzer. Be sure you
                                provide one

eyapp  -N grammar.eyp         # Equivalent to %nocompact. Do not compact action tables.
                                Use to have more accurate information when there are conflicts

Description

The eyapp compiler is a front-end to the Parse::Eyapp module, which lets you compile Parse::Eyapp grammar input files into Perl LALR (1) Object Oriented parser modules.

Options

-v

Creates a file grammar.output describing your parser. It will show you a summary of conflicts, rules, the DFA (Deterministic Finite Automaton) states and overall usage of the parser.

This file grammar.output will be also automatically generated if warnings are issued.
-s

Create a standalone module in which the parsing driver is included. The modules including the LALR driver (Parse::Eyapp::Driver), those for AST manipulations (Parse::Eyapp::Node and Parse::Eyapp::YATW)) and Parse::Eyapp::Base are included - almost verbatim - inside the generated module.

Note that if you have more than one parser module called from a program, to have it standalone, you need this option only for one of your grammars;
-n

Disable source file line numbering embedded in your parser module. I don't know why one should need it, but it's there.

-m module
Gives your parser module the package name (or name space or module name or class name or whatever-you-call-it) of module. It defaults to grammar
-o outfile
The compiled output file will be named outfile for your parser module. It defaults to grammar.pm or, if you specified the option -m A::Module::Name (see below), to Name.pm.
-c grammar[.eyp]
Produces as output ( STDOUT ) the grammar without the actions. Only the syntactic parts are displayed. Comments will be also stripped if the "-v" option is added.
-t filename
The -t filename option allows you to specify a file which should be used as template for generating the parser output. The default is to use the internal template defined in Parse::Eyapp::Output.pm. For how to write your own template and which substitutions are available, have a look to the module Parse::Eyapp::Output.pm : it should be obvious.
-b shebang
If you work on systems that understand so called shebangs, and your generated parser is directly an executable script, you can specify one with the -b option, ie:
eyapp -b '/usr/local/bin/perl -w' -o myscript.pl myscript.yp
This will output a file called myscript.pl whose very first line is:
#!/usr/local/bin/perl -w
The argument is mandatory, but if you specify an empty string, the value of $Config{perlpath} will be used instead.
-B prompt
Adds a modulino call '__PACKAGE->main(<prompt>) unless caller();' as the very last line of the output file. The argument is mandatory.
-C grammar.eyp
An abbreviation for the combined use of -b '' and -B ''
-T grammar.eyp
Equivalent to %tree.
-N grammar.eyp
Equivalent to %nocompact. Do not compact action tables. Use to have more accurate information when there are conflicts
-l

Do not provide a default lexical analyzer. By default "eyapp" builds a lexical analyzer from your "%token = /regexp/" definitions

grammar
The input grammar file. If no suffix is given, and the file does not exists, an attempt to open the file with a suffix of .eyp is tried before exiting.
-V

Display current version of Parse::Eyapp and gracefully exits.

-h

Display the usage screen.

Author

Casiano Rodriguez-Leon

Copyright

(c) Copyright 2006 Casiano Rodriguez-Leon

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

See Also

• Parse::Eyapp,

• perldoc vgg,

• The tutorial Parsing Strings and Trees with "Parse::Eyapp" (An Introduction to Compiler Construction in seven pages)> in

• The pdf file in <http://nereida.deioc.ull.es/~pl/perlexamples/Eyapp.pdf>

• <http://nereida.deioc.ull.es/~pl/perlexamples/section_eyappts.html> (Spanish),

• eyapp,

• treereg,

• Parse::yapp,

yacc(1),

bison(1),

• the classic book "Compilers: Principles, Techniques, and Tools" by Alfred V. Aho, Ravi Sethi and

• Jeffrey D. Ullman (Addison-Wesley 1986)

• Parse::RecDescent.