next up previous contents
Next: Source Files Up: Fundamental PSI3 Functions Previous: The Structure of a   Contents


The Input Parser

The input parsing library is built for the purpose of reading in the contents of an input file with the syntax of input.dat and storing the contents specific to certain keywords supplied. To perform such a task libipv1.a has three parts: (1) the parser; (2) the lexical scanner; (3) keyword storage and retrieval.

The format of input.dat follows certain rules which should probably referred to as the PSI input grammar. There is a description of most of those rules in PSI3 User's Manual. A complete definition of the PSI input grammar is encoded in parse.y (see below). To read a grammar we need a parser - the first component of libipv1.a. Then the identified lexical elements of input.dat (keywords and keyword values) need to be scanned for presence of ``forbidden'' characters (e.g. a space may not be a part of a string unless the string is placed between parentheses). This task is performed by the lexical scanner -- the second component of libipv1.a. Finally, scanned-in pairs of keyword-value(s) are stored in a hierarchical data structure (a tree). When a particular option is needed, the set of stored keywords and values is searched for the one queried and the value returned. In this way, options of varying type can be assigned, i.e. rather than having a line of integers, each corresponding to a program variable, mnemonic character string variables can be parsed and interpreted into program variables. It's also easier to implement default options, allowing a more spartan input deck. The set of input-parsing routines in libipv1.a is really not complicated to use, but the manner in which data is stored is somewhat painful to grasp at first.

The following is a list of the names of the individual source files in libipv1 and a summary of their contents. After that is a list of the syntax of specific functions and their use. Last is a simple illustration of the use of this library, taken mostly from cscf.



Subsections
next up previous contents
Next: Source Files Up: Fundamental PSI3 Functions Previous: The Structure of a   Contents
psi 2003-01-07