LLGEN(1)

NAME
LLgen, an extended LL(1) parser generator

SYNOPSIS
LLgen [ -vxwans ] [ -j[num] ] [ -lnum ] [ -hnum ] file ...

DESCRIPTION
LLgen 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.

LLgen reads each file in sequence. Together, these files must constitute a context-free grammar. For each file, LLgen generates an output file, which must be compiled by the C-compiler. In addition, it generates the files Lpars.c and Lpars.h. Lpars.h contains the define statements that associate the LLgen-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. Lpars.c contains the error recovery routines and tables. It must also be compiled by the C-compiler. When the generated parser uses non-correcting error recovery ( -n option) LLgen also generates a file Lncor.c that contains the non-correcting recovery mechanism.

LLgen will only update those output files that differ from their previous version. This allows LLgen to be used with make (1) convieniently.

To obtain a working program, the user must also supply a lexical analyzer, as well as main and LLmessage, an error reporting routine; Lex (1) is a useful program for creating lexical analysers usable by LLgen.

LLgen accepts the following flags:

-v  create a file called LL.output, which contains a description of the conflicts that were not resolved. If the flag is given more than once, LLgen will be more "verbose". If it is given three times, a complete description of the grammar will be supplied.

-x  the sets that are computed are extended with the nonterminal symbols and these extended sets are also included in the LL.output file.

-w  no warnings are given.

-a  Produce ANSI C function headers and prototypes.

-n  Produce a parser with non-correcting error recovery.

-s  Simulate the calling of all defined subparsers in all semantic actions. When using non-correcting error recovery, subparsers that are called in semantic actions may cause problems; this flag provides a `brute-force' solution.

-j[num]
    when this flag is given, LLgen 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 low_percentage and high_percentage, as explained below. Usually, compilers generate a jumptable when the density of the switch is above a certain threshold. When jump tables are to be used more often, high_percentage must be set to this threshold, and low_percentage must be set to a minimum threshold. There is a time-space trade-off here. num is the minimum number of cases in a switch for the -j option to be effective. The default value (if num is not given) is 8.

-lnum
    The low_percentage, as described above. Default value is 10.

-hnum
    The high_percentage, as described above. Default value is 30.

FILES
LL.output verbose output file
Lpars.c the error recovery routines
Lncor.c non-correcting error recovery mechanism
Lpars.h defines for token names

SEE ALSO
lex(1)
make(1)
LLgen, an Extended LL(1) Parser Generator by C.J.H. Jacobs.
Top-down Non-Correcting Error Recovery in LLgen by A.W van Deudekom and P.J. Kooiman

DIAGNOSTICS
Are intended to be self-explanatory. They are reported on standard error. A more detailed report is found in the LL.output file.

AUTHOR
Ceriel J. H. Jacobs
The non-correcting error recovery mechanism is written by A.W van Deudekom and P.J. Kooiman.