:- assert( lgi_test_file_prefix('/tmp/mytests/test') ).
This will cause the LexGram parser to write the parse results on files
whose names are concatenations of TestFilePrefix,
TestId,
_, and ReadingNumber, e.g.
/tmp/mytests/test1_1 TestId is
the first argument of a
psent/2 definition, see
section 3.1. The default value of
ReadingNumber is 1. Make sure that the directory path indicated by the
TestFilePrefix really exists. The LexGram system will
not create these directories.
The reason why lgi_test_file_prefix/1 should be a dynamic predicate is that other users besides yourself should be able to change the prefix when running your grammar, since they may not be allowed to overwrite your old test files.
For various pretty printing purposes (e.g. the chart browser, section 4.3.2), it will be convenient if there are abbreviations for the names of nonterminals. You can define abbreviated names for the subtypes of the nonterminal type by defining a Prolog predicate
abbreviated_name(Nonterminal, Abbreviation) .For example:
abbreviated_name(nonterminal,nt).
Since CUF currently does not support modular loading of CUF description files (i.e. the CUF description files of the LexGram vs. the grammar specific ones), there is a special load mimic for LexGram grammars, which requires the following statements.
This declares the list of files [mygrammar.cuf] as the CUF description files of your grammar.
e.g. lg_control_files([mygrammar]).
This declares the list of files [mygrammar.ctrl] as the CUF control files of your grammar.
The location of the grammar must be declared explicitly since the CUF configuration file will be created automatically and will be loaded from /tmp. If you use the lg_module/4 predicate (see section 7.2) and load a module from your (top level) grammar directory, you may omit the add_dir/1 command.
The search space of the parser (or generator) can be constrained (for the price of incompleteness) by restricting the number of traces per phrase. The default is 4, which can be set to some other value, say 5, by the lgflag/1 -command:
:- lgflag(trace_bound,5).