.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "EYAPP 1" .TH EYAPP 1 "2017-06-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" eyapp \- A Perl front\-end to the Parse::Eyapp module .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& eyapp [options] grammar[.eyp] \& eyapp \-V \& eyapp \-h \& \& grammar The grammar file. If no suffix is given, and the file \& does not exists, .eyp is added .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The eyapp compiler is a front-end to the Parse::Eyapp module, which lets you compile Parse::Eyapp grammar input files into Perl \s-1\fBLALR\s0\fR\|(1) Object Oriented parser modules. .SH "OPTIONS IN DETAIL" .IX Header "OPTIONS IN DETAIL" .IP "\fI\-v\fR" 4 .IX Item "-v" Creates a file \fIgrammar\fR.output describing your parser. It will show you a summary of conflicts, rules, the \s-1DFA\s0 (Deterministic Finite Automaton) states and overall usage of the parser. .Sp Implies option \f(CW\*(C`\-N\*(C'\fR. To produce a more detailed description of the states, the \s-1LALR\s0 tables aren't compacted. Use the combination \f(CW\*(C`\-vN\*(C'\fR to produce an \f(CW\*(C`.output\*(C'\fR file corresponding to the compacted tables. .IP "\fI\-s\fR" 4 .IX Item "-s" Create a standalone module in which the parsing driver is included. The modules including the \s-1LALR\s0 driver (Parse::Eyapp::Driver), those for \s-1AST\s0 manipulations (Parse::Eyapp::Node and Parse::Eyapp::YATW)) and Parse::Eyapp::Base are included \- almost verbatim \- inside the generated module. .Sp 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; .IP "\fI\-n\fR" 4 .IX Item "-n" Disable source file line numbering embedded in your parser module. I don't know why one should need it, but it's there. .IP "\fI\-m module\fR" 4 .IX Item "-m module" Gives your parser module the package name (or name space or module name or class name or whatever-you-call-it) of \fImodule\fR. It defaults to \fIgrammar\fR .IP "\fI\-o outfile\fR" 4 .IX Item "-o outfile" The compiled output file will be named \fIoutfile\fR for your parser module. It defaults to \fIgrammar\fR.pm or, if you specified the option \&\fI\-m A::Module::Name\fR (see below), to \fIName.pm\fR. .IP "\fI\-c grammar\fR[.eyp]" 4 .IX Item "-c grammar[.eyp]" Produces as output (\s-1STDOUT\s0) the grammar without the actions. Only the syntactic parts are displayed. Comments will be also stripped if the \f(CW\*(C`\-v\*(C'\fR option is added. .IP "\fI\-t filename\fR" 4 .IX Item "-t filename" The \fI\-t filename\fR 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 \fIParse::Eyapp::Output.pm\fR. For how to write your own template and which substitutions are available, have a look to the module \fIParse::Eyapp::Output.pm\fR : it should be obvious. .IP "\fI\-b shebang\fR" 4 .IX Item "-b shebang" If you work on systems that understand so called \fIshebangs\fR, and your generated parser is directly an executable script, you can specify one with the \fI\-b\fR option, ie: .Sp .Vb 1 \& eyapp \-b \*(Aq/usr/local/bin/perl \-w\*(Aq \-o myscript.pl myscript.yp .Ve .Sp This will output a file called \fImyscript.pl\fR whose very first line is: .Sp .Vb 1 \& #!/usr/local/bin/perl \-w .Ve .Sp The argument is mandatory, but if you specify an empty string, the value of \fI\f(CI$Config\fI{perlpath}\fR will be used instead. .IP "\fI\-B prompt\fR" 4 .IX Item "-B prompt" Adds a modulino call '_\|_PACKAGE\->main() unless \fBcaller()\fR;' as the very last line of the output file. The argument is mandatory. .IP "\fI\-C grammar.eyp\fR" 4 .IX Item "-C grammar.eyp" An abbreviation for the combined use of \fI\-b ''\fR and \fI\-B ''\fR .IP "\fI\-T grammar.eyp\fR" 4 .IX Item "-T grammar.eyp" Equivalent to \f(CW%tree\fR. .IP "\fI\-N grammar.eyp\fR" 4 .IX Item "-N grammar.eyp" Equivalent to the directive \f(CW%nocompact\fR. Do not compact \s-1LALR\s0 action tables. .IP "\fI\-l\fR" 4 .IX Item "-l" Do not provide a default lexical analyzer. By default \f(CW\*(C`eyapp\*(C'\fR builds a lexical analyzer from your \f(CW\*(C`%token = /regexp/\*(C'\fR definitions .IP "\fIgrammar\fR" 4 .IX Item "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 \fI.eyp\fR is tried before exiting. .IP "\fI\-V\fR" 4 .IX Item "-V" Display current version of Parse::Eyapp and gracefully exits. .IP "\fI\-h\fR" 4 .IX Item "-h" Display the usage screen. .SH "EXAMPLE" .IX Header "EXAMPLE" The following \f(CW\*(C`eyapp\*(C'\fR program translates an infix expression like \f(CW\*(C`2+3*4\*(C'\fR to postfix: \f(CW\*(C`2 3 4 * +\*(C'\fR .PP .Vb 2 \& %token NUM = /([0\-9]+(?:\e.[0\-9]+)?)/ \& %token VAR = /([A\-Za\-z][A\-Za\-z0\-9_]*)/ \& \& %right \*(Aq=\*(Aq \& %left \*(Aq\-\*(Aq \*(Aq+\*(Aq \& %left \*(Aq*\*(Aq \*(Aq/\*(Aq \& %left NEG \& \& %defaultaction { "$left $right $op"; } \& \& %% \& line: $exp { print "$exp\en" } \& ; \& \& exp: $NUM { $NUM } \& | $VAR { $VAR } \& | VAR.left \*(Aq=\*(Aq.op exp.right \& | exp.left \*(Aq+\*(Aq.op exp.right \& | exp.left \*(Aq\-\*(Aq.op exp.right \& | exp.left \*(Aq*\*(Aq.op exp.right \& | exp.left \*(Aq/\*(Aq.op exp.right \& | \*(Aq\-\*(Aq $exp %prec NEG { "$exp NEG" } \& | \*(Aq(\*(Aq $exp \*(Aq)\*(Aq { $exp } \& ; \& \& %% .Ve .PP Notice that there is no need to write lexer and error report subroutines. First, we compile the grammar: .PP .Vb 1 \& pl@nereida:~/LEyapp/examples/eyappintro$ eyapp \-o postfix.pl \-C Postfix.eyp .Ve .PP If we use the \f(CW\*(C`\-C\*(C'\fR option and no \f(CW\*(C`main()\*(C'\fR was written one default \f(CW\*(C`main\*(C'\fR sub is provided. We can now execute the resulting program: .PP .Vb 2 \& pl@nereida:~/LEyapp/examples/eyappintro$ ./postfix.pl \-c \*(Aqa = 2*3 +b\*(Aq \& a 2 3 * b + = .Ve .PP When a non conformant input is given, it produces an accurate error message: .PP .Vb 1 \& pl@nereida:~/LEyapp/examples/eyappintro$ ./postfix.pl \-c \*(Aqa = 2**3 +b\*(Aq \& \& Syntax error near \*(Aq*\*(Aq. \& Expected one of these terminals: \*(Aq\-\*(Aq \*(AqNUM\*(Aq \*(AqVAR\*(Aq \*(Aq(\*(Aq \& There were 1 errors during parsing .Ve .SH "AUTHOR" .IX Header "AUTHOR" Casiano Rodriguez-Leon .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012 Casiano Rodriguez-Leon. Copyright © 2017 William N. Braswell, Jr. All Rights Reserved. .PP Parse::Yapp is Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien. Parse::Yapp is Copyright © 2017 William N. Braswell, Jr. All Rights Reserved. .PP 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. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Parse::Eyapp, .IP "\(bu" 4 perldoc vgg, .IP "\(bu" 4 The tutorial \fIParsing Strings and Trees with\fR \f(CW\*(C`Parse::Eyapp\*(C'\fR (An Introduction to Compiler Construction in seven pages)> in .IP "\(bu" 4 The pdf file in .IP "\(bu" 4 (Spanish), .IP "\(bu" 4 eyapp, .IP "\(bu" 4 treereg, .IP "\(bu" 4 Parse::yapp, .IP "\(bu" 4 \&\fByacc\fR\|(1), .IP "\(bu" 4 \&\fBbison\fR\|(1), .IP "\(bu" 4 the classic book \*(L"Compilers: Principles, Techniques, and Tools\*(R" by Alfred V. Aho, Ravi Sethi and .IP "\(bu" 4 Jeffrey D. Ullman (Addison-Wesley 1986) .IP "\(bu" 4 Parse::RecDescent. .SH "POD ERRORS" .IX Header "POD ERRORS" Hey! \fBThe above document had some coding errors, which are explained below:\fR .IP "Around line 199:" 4 .IX Item "Around line 199:" Non-ASCII character seen before =encoding in '©'. Assuming \s-1UTF\-8\s0