AGFL(1)

NAME
agfl - generates a parser for an AGFL-grammar

SYNOPSIS
agfl [-a] [-c] [-f] [-G] [-h] [-m] [-v] [-w] <grammar>

DESCRIPTION

agfl is a wrapper which generates a top-down recursive backup parser for the input grammar, which must be expressed in AGFL. The parser will be an executable with the same name as the grammar, without the extension .gra. Properties of the grammar are written to the file grammar.log.

agfl calls agfl-coder to compile all grammar modules to an object file and if needed the integrated lexicon system agfl-lexer , to create a compressed lexicon which can be used in combination with the parser generated by agfl.

Finally, the resulting parser is built by linking the object file to the AGFL runtime system.

OPTIONS

Options are:

-a  analyze additional properties

-c  show counters after parsing

-f  force new generation even if files are not modified

-G  generate generative grammar (not supported in this release)

-h  show help and exit

-m  generate module names in identifiers

-p  enable profiling. Default is off. With this option, agfl grammar will generate a grammar.pri file with location information. Running the generated parser grammar will generate a grammard.prd file with profiling information. The Perl script genprofiles uses these two files to generate a grammar.grp copy of every original grammar module, extended with profiling information per alternative. [3] means that this specific alternative has been executed 3 times. This information can be used to improve both the grammar and the parser generator.

-V  show version

-v  verbose

-w  suppress compiler warnings

Undocumented options in the maintainer's version: Note that the default flags in the maintainer's version differ from those in the regular user's version. The the -v option to check if the options are what you expect.

-e  link the runtime system to Electric Fence, to check memory handling bugs

-g  extra debugging information

-l  write log

-s  strip executable

-S  keep the intermediate code file (as grammar.S).

-t  show compile time

-A  suppress well-formedness analysis

-D  use director set lookahead

-F  left-factorize grammar

-P  use positive memoizing

-N  use negative memoizing

-T  trace

-_  toggle underscore flag

RESTRICTIONS

The maximum number of affixes that can be used in an affix domain in the grammar is 32. Using more than 32 affixes in one domain will currently cause non-trivial assembler errors.

ENVIRONMENT
The environment variables GENBASE, GENCC and GENAS may be set to override the default location of the programs and libraries used by agfl.

GENBASE
    This variable determines the directory in which the AGFL-system is installed.

GENCC
    This variable determines the C compiler, which is invoked for linking. By default, gcc is assumed. Using cc instead of gcc may cause linkage problems.

GENAS
    This variable determines the assembler which is invoked for code generation. The assembler should invoke the C preprocessor first. By default, gcc -c -x assembler-with-cpp is assumed.

SEE ALSO
agflintro(1), agfl-coder(1), agfl-lexer(1)