1984-10-08 15:19:18 +00:00
|
|
|
.\" $Header$
|
1987-02-05 13:17:00 +00:00
|
|
|
.TH LLGEN 1ACK
|
1987-03-11 13:56:17 +00:00
|
|
|
.ad
|
1984-10-08 15:19:18 +00:00
|
|
|
.SH NAME
|
|
|
|
LLgen, an extended LL(1) parser generator
|
|
|
|
.SH SYNOPSIS
|
|
|
|
\fBLLgen\fP
|
|
|
|
[
|
1989-07-17 16:40:18 +00:00
|
|
|
\fB\-vxw\fP
|
1988-06-22 17:04:52 +00:00
|
|
|
]
|
|
|
|
[
|
1989-07-17 16:40:18 +00:00
|
|
|
\fB\-j\fP[\fInum\fP]
|
1988-06-22 17:04:52 +00:00
|
|
|
]
|
|
|
|
[
|
|
|
|
\fB\-l\fP\fInum\fP
|
|
|
|
]
|
|
|
|
[
|
|
|
|
\fB\-h\fP\fInum\fP
|
1984-10-08 15:19:18 +00:00
|
|
|
]
|
|
|
|
file ...
|
|
|
|
.SH DESCRIPTION
|
|
|
|
\fILLgen\fP
|
|
|
|
converts a context-free grammar into a set of
|
|
|
|
functions which form a recursive descent parser with no backtrack.
|
|
|
|
The grammar may be ambiguous;
|
|
|
|
ambiguities can be broken by user specifications.
|
|
|
|
.PP
|
|
|
|
\fILLgen\fP
|
|
|
|
reads each
|
|
|
|
\fIfile\fP
|
|
|
|
in sequence.
|
|
|
|
Together, these files must constitute a context-free grammar.
|
|
|
|
For each file,
|
|
|
|
\fILLgen\fP
|
|
|
|
generates an output file, which must be compiled by the
|
|
|
|
C-compiler.
|
|
|
|
In addition, it generates the files
|
|
|
|
\fILpars.c\fP
|
|
|
|
and
|
|
|
|
\fILpars.h.\fP
|
|
|
|
\fILpars.h\fP
|
|
|
|
contains the
|
|
|
|
\fIdefine\fP
|
|
|
|
statements that associate the
|
|
|
|
\fILLgen\fP-assigned `token-codes' with user declared `token-names'.
|
|
|
|
This allows other source files, for instance the source file
|
|
|
|
containing the lexical analyzer,
|
|
|
|
to access the token-codes by
|
|
|
|
using the token-names.
|
|
|
|
\fILpars.c\fP
|
|
|
|
contains the error recovery routines and tables. It must also
|
|
|
|
be compiled by the C-compiler.
|
|
|
|
.PP
|
|
|
|
\fILLgen\fP
|
|
|
|
will only update those output files that differ from their previous
|
|
|
|
version.
|
|
|
|
This allows
|
|
|
|
\fILLgen\fP
|
|
|
|
to be used with
|
|
|
|
\fImake\fP
|
|
|
|
(I) convieniently.
|
|
|
|
.PP
|
|
|
|
To obtain a working program, the user must also supply a
|
|
|
|
lexical analyzer, as well as
|
|
|
|
\fImain\fP
|
|
|
|
and
|
|
|
|
\fILLmessage\fP,
|
|
|
|
an error reporting routine;
|
|
|
|
\fILex\fP
|
|
|
|
(I) is a useful program for creating lexical analysers usable
|
|
|
|
by
|
|
|
|
\fILLgen\fP.
|
|
|
|
.PP
|
1988-06-22 17:04:52 +00:00
|
|
|
\fILLgen\fP accepts the following flags:
|
|
|
|
.IP \fB\-v\fP
|
|
|
|
create a file called
|
|
|
|
\fILL.output\fP,
|
|
|
|
which contains a description of the conflicts that
|
1984-10-08 15:19:18 +00:00
|
|
|
were not resolved.
|
1988-06-22 17:04:52 +00:00
|
|
|
If the flag is given more than once,
|
1984-10-08 15:19:18 +00:00
|
|
|
\fILLgen\fP
|
|
|
|
will be more "verbose".
|
|
|
|
If it is given three times, a complete description of the
|
|
|
|
grammar will be supplied.
|
1988-06-22 17:04:52 +00:00
|
|
|
.IP \fB\-x\fP
|
1984-10-08 15:19:18 +00:00
|
|
|
the sets that are computed are extended with the nonterminal
|
|
|
|
symbols and these extended sets are also included in the
|
|
|
|
\fILL.output\fP
|
|
|
|
file.
|
1988-06-22 17:04:52 +00:00
|
|
|
.IP \fB\-w\fP
|
|
|
|
no warnings are given.
|
1989-07-17 16:40:18 +00:00
|
|
|
.IP \fB\-j\fP[\fInum\fP]
|
1988-06-22 17:04:52 +00:00
|
|
|
when this flag is given, \fILLgen\fP will generate dense switches,
|
|
|
|
so that the compiler can generate a jump table for it. This will only be
|
|
|
|
done for switches that have density between
|
|
|
|
\fIlow_percentage\fP and \fIhigh_percentage\fP, as explained below.
|
|
|
|
Usually, compilers generate a jumptable when the density of the switch
|
|
|
|
is above a certain threshold. If you want jump tables in more cases,
|
|
|
|
set \fIhigh_percentage\fP to this threshold, and \fIlow_percentage\fP to
|
|
|
|
a minimum threshold. There is a time-space trade-off here.
|
1989-07-17 16:40:18 +00:00
|
|
|
.I num
|
|
|
|
is the minimum number of cases in a switch for the \fB\-j\fP option to be
|
|
|
|
effective. The default value (if
|
|
|
|
.I num
|
|
|
|
is not given) is 8.
|
1988-06-22 17:04:52 +00:00
|
|
|
.IP \fB\-l\fP\fInum\fP
|
|
|
|
The \fIlow_percentage\fP, as described above. Default value is 10.
|
|
|
|
.IP \fB\-h\fP\fInum\fP
|
|
|
|
The \fIhigh_percentage\fP, as described above. Default value is 30.
|
1984-10-08 15:19:18 +00:00
|
|
|
.SH FILES
|
|
|
|
LL.output verbose output file
|
|
|
|
.br
|
|
|
|
Lpars.c the error recovery routines
|
|
|
|
.br
|
|
|
|
Lpars.h defines for token names
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
\fIlex\fP (I)
|
|
|
|
.br
|
|
|
|
\fImake\fP (I)
|
|
|
|
.br
|
|
|
|
\fILLgen, an Extended LL(1) Parser Generator\fP
|
|
|
|
by C.J.H. Jacobs.
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
Are intended to be self-explanatory. They are reported
|
|
|
|
on standard error. A more detailed report is found in the
|
|
|
|
\fILL.output\fP
|
|
|
|
file.
|
|
|
|
.SH BUGS
|
|
|
|
Because some file names are fixed, at most one
|
|
|
|
\fILLgen\fP
|
|
|
|
process can be active in a given directory at
|
|
|
|
a time.
|
|
|
|
.SH AUTHOR
|
|
|
|
Ceriel J. H. Jacobs
|