main(argc, argv)

- main routine for generation parser int argc; char *argv[];

The actions depend on whether DEBUG was defined when compiling the program. See introduction to the technical manual. If DEBUG is defined, the flags are read, otherwise, no flags are allowed. Because all the flags are optional, the argument that contains the flags must start with '-'. All flags must be grouped together. For example, if the flags 'a' and 'b' are specified, the program is invoked as:

    generator -ab ...
and not as:
    generator -a -b ...
The only use of flags is to turn on debugging for various modules. The permissible flags are:
a	debug ambigu.c, empty.c and omitstrt.c
d	put debug information on stderr, instead of on file ``debug_info1''
e	debug entity.c, doc.g and extern.g
g	debug dtd.g
i	debug in.c
k	debug marked.g
l	debug lexical.c
p	print all the elements on a file
s	debug shortref.c and shortnot.g
t	debug att_chk.c
After reading the flags, the other arguments are read and checked, There must be exactly two other argument. The first argument is the name of the input-file, the second argument is the name of the file onto which the LLgen-code must be written (see ``gen_code.c''). If the arguments are not correct, an error is reported. Next all modules are initialized, for those that are required. If the arguments are correct, then the input-file is parsed. After parsing, the grammar is counted for the capacity points (see ``capacity.c'') and the grammar is checked for ambiguities (see ``ambigu.c''). The shortreference maps and the notations are also checked. When a fatal error has occurred the program is stopped and no files are generated. Otherwise the include files and the file with LLgen-code is generated (see generation.desc).

void print_grammar(file_name)

- print the read grammar String file_name;

void write_grammar(file_name)

- print the grammar String file_name;

The procedure print_grammar() prints the elements of the DTD on file_name. All the associated attributes such as omit endtag, omit starttag, inclusions, exclusions and maps are also printed. The procedure write_grammar() print only the elements with their content on the file with the name file_name.

generate.c