|
|
Config file format
The config file contains lines of the form:
keyword = value
The value may be blank. If a value is given, then it must not contain
embedded spaces. The pound sign (#) begins a comment; all characters
remaining on the line are ignored. An example entry is:
# name of the log file, default is log.txt
log-file = parser_log.txt
If a keyword is not present, then its default value is used. The
supported keywords are listed below.
- log-file
-
The name of the output log file. The default is log.txt.
- nonterm-namespace
-
The name of the namespace enclosing the nonterminal class definitions.
This name can be qualified, for example:
bdev
::bdev
::a::nested::namespace
The default is no value.
- nonterm-lzz-file
-
The name of the output lzz file containing the nonterminal class
definitions. The default is Nonterm.lzz.
- base-visitor-type
-
The name (including namespace) of the base visitor class. The default is
NodeVisitor.
- visit-function
-
The name of the overloaded (for each nonterminal) visit function in
the base visitor class. The default is visit.
- base-visitor-lzz-file
-
The name of the output lzz file containing the base visitor class
definition. The default is NodeVisitor.lzz.
- token-number-namespace
-
The name of the namespace enclosing the token number constants. The
default is no value.
- token-number-lzz-file
-
The name of the output lzz file containing the token number constants.
The default is TokenNumber.lzz.
- get-data-function
-
The name (including namespace) of the function that returns a
reference to the top-level data object. The default is
getParserData.
- parser-data-lzz-file
-
The name of the lzz file containing the generated parser data and the
get-data function. The default is ParserData.lzz.
- hdr-ext
-
The header file extension configured in lzz. The default is
h.
- bypass
-
A boolean value (true or false) indicating if single
rules should be bypassed. The default is false.
Here is a config file that
contains the default values for the keywords listed so far. This file
can be used as an initial config file.
The values of the remaining keywords refer to names in the basil
parser source code. Assign new values to these keywords only if you
edit the code.
- basil-node-type
-
The name of the node class. This class encapsulates
basl::Nonterm and basl::Token, and has a link to the
previous node. Nodes are reference counted; nodes no longer
referenced are cached in a static list for efficiency. The default is
basl::Node.
- basil-node-hdr
-
The name of the header file containing the node class definition. The
default is basl_Node.h.
- basil-nonterm-type
-
The name of nonterminal class in basl::Node. The default is
basl::Nonterm.
- basil-token-type
-
The name of the token class. This class contains a file location,
token number, and lexeme. The default value is basl::Token.
- basil-nonterm-proxy-type
-
The name of the proxy nonterminal class, and base class of the
generated nonterminal classes. This class forwards calls to a
contained (by reference) basl::Nonterm. The derived
nonterminal classes are created on the stack and exist only for the
duration of the visit call. The default is
basl::NontermProxy.
- basil-visit-children-function
-
The name of the function in the proxy nonterminal class that sends a
visitor down to the children of a nonterminal. The default is
visitChildren.
- basil-nonterm-proxy-hdr
-
The name of the header file containing the nonterminal proxy class
definition. The default is basl_NontermProxy.h.
- basil-visitor-type
-
The name of the base visitor class. This class consists of only a
default constructor and a virtual destructor. The basil parser code
is independent of all user generated nonterminals. This class is used
by the parser code to refer to any visitor in any parser. The default
is basl::Visitor.
- basil-visitor-hdr
-
The name of the header file containing the base visitor class
definition. The default is basl_Visitor.h.
- basil-nonterm-info-type
-
The name of the nonterminal info class. This class contains a pointer
to a nonterminal name and a pointer to an accept function. The
default is basl::NontermInfo.
- basil-nonterm-info-hdr
-
The name of the header file containing the nonterminal info class
definition. The default is basl_NontermInfo.h.
- basil-rule-type
-
The name of the rule struct. This struct contains a pointer to a rule
string (for output only), a rule size and a pointer to
const nonterminal info struct. The pointer to the nonterminal info
struct can be null if the rule is not represented by a nonterminal.
The default is basl::LRRule.
- basil-action-type
-
The name of the action type. At present, this is a typedef to a
pointer to a const int. An action is variable in size: one to three
integers. There are four actions: shift, reduce, accept and done.
The default value is basl::LRAction.
- basil-shift-code
-
The name of the shift action constant. The default is basl::LR_SHIFT.
- basil-reduce-code
-
The name of the reduce action constant. The default is basl::LR_REDUCE.
- basil-accept-code
-
The name of the accept action constant. The default is basl::LR_ACCEPT.
- basil-done-code
-
The name of the done action constant. The default is basl::LR_DONE.
- basil-move-type
-
The name of the move struct. This struct contains a token number and an
action sequence. The default is basl::LRMove.
- basil-state-type
-
The name of the state struct. This struct contains a move selection, a
lexical state, and a goto index. The default is basl::LRState.
- basil-goto-type
-
The name of the goto struct. This struct contains a goto index
and a state number. The default is basl::LRGoto.
- basil-symbol-type
-
The name of the symbol struct. This struct contains a symbol name
(for output only) and a goto selection. The default is
basl::LRSymbol.
- basil-data-type
-
The name of the data struct. This struct contains a pointer to a rule
set, a pointer to a state set, and a pointer to a symbol set. The
default is basl::LRData. A reference to this struct is
returned by the get data function.
- basil-data-hdr
-
The name of the header file containing the data structures and action
codes described above. The default is basl_LRData.h.
|
|