PBYACC(1) | General Commands Manual | PBYACC(1) |
pbyacc - an LALR(1) parser generator
pbyacc [ -CPcdlrtv ] [ -b file_prefix ] [ -p symbol_prefix ] filename
pbyacc reads the grammar specification in the file filename and generates an LR(1) parser for it. The parsers consist of a set of LALR(1) parsing tables and a driver routine written in the C or Perl programming languages. pbyacc normally writes the parse tables and the driver routine to the file y.tab.c, using the C programming language.
The following options are available:
old symbol | new symbol |
YYABORT | FTP_ABORT |
YYACCEPT | FTP_ACCEPT |
YYBYACC | FTP_BYACC |
YYDEBUG | FTP_DEBUG |
YYSTYPE | FTP_STYPE |
yyabort | ftp_abort |
yyerrok | ftp_errok |
yylex | ftp_lex |
yylval | ftp_lval |
yyparse | ftp_parse |
If the environment variable TMPDIR is set, the string denoted by TMPDIR will be used as the name of the directory where the temporary files are created.
In C mode, the user's code at the end of the PBYACC file is inserted before the yyparse subroutine, but in Perl mode, it is appended to yyparse so it can contain the main program. In Perl mode, there is no library, so the user must supply the yyerror and yylex subroutines and a main program that calls yyparse. For example:
%% ...grammar... %% sub yyerror { print STDERR "$.: $@\n"; } sub yylex { ... } exit &yyparse;
flex(1), lex(1)
Yacc: Yet Another Compiler-Compiler
Stephen C. Johnson
Originally (?) published as Comp. Sci. Tech. Rep. No. 32. Bell Laboratories,
July 1975. Reprinted in many different places.
Introduction to Compiler Construction with UNIX
Axel T. Schreiner and H. George Friedman, Jr.
Prentice Hall, 1985.
lex & yacc, Second Edition
John R. Levine, Tony Mason, and Doug Brown
O'Reilly & Associates, Inc., 1992.
Possibly the best book yet on lex and yacc. (My opinion only. Others may
disagree. - Rick Ohnemus)
comp.compilers monthly message and Frequently Asked
Questions
Posted monthly in comp.compilers and news.answers USENET newsgroups.
If there are rules that are never reduced, the number of such rules is reported on standard error.
If there are any LALR(1) conflicts, the number of conflicts is reported on standard error.
A symbol prefix specified using the -p switch must contain at least one lower case character. This is to allow a distinction between variables, defined values, and typedefs.
January 18, 1993 | 4.3 Berkeley Distribution |