XIDEK
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ImplementationIntroductionAll of the interpreters in the kit are implemented as reentrant functions, suitable for use where thread safety is an issue. All interpreters use a common interface to their host program, which permits the host program to set the values of variables before starting the interpreter and to query the values of variables after execution of a script.Since all of the interpreters are functionally interchangeable, a single main program, contained in driver\demo.cpp, suffices to demonstrate the host program interface for any of the interpreters. The common symbol table mechanism used by the interpreters allows the values of variables to be both set and queried by the host program. Thus values can be initialized before a script is interpreted and results can be queried after execution. Since the symbol table is completely separate from the script interpreters, a given symbol table can be used with any number of scripts. The symbol table actually consists of two separate objects, an AgDictionary<AgString> object which identifies variable names, and a Dataset object which contains a reference to the dictionary and a value for each variable in the dictionary. Any number of Dataset objects can share the same dictionary.
Organization of the CodeTo minimize the difficulties in understanding how a particular interpreter works, the code for the interpreters has been organized into a number of modules which are shared among the various interpreters, so that the interpreters have a substantial amount of commonality in their underpinnings. Each module is accompanied by detailed documentation.The modules fall into three basic classes: the language independent modules, which are found in the support directory, the CLL language dependent modules, which are found in the cll, and the PLL language dependent modules which are found in the pll directory. Each of these directories contains subdirectories as follows:
Compiling and LinkingMake files have been provided for users of six different compilers:
Each of these directories contains subdirectories to segregate CLL and PLL interpreters. Each of these subdirectories in turn contains subdirectories for the baseline interpreters and for each of the extension examples. Make files have been provided at each level of the directory structure. Thus, the nmake command when executed from the msvc directory uses Microsoft Visual C++ to make all 48 different interpreters. From the msvc\cll directory, the nmake command will make only the 24 CLL interpreters. From the msvc\cll\base directory, nmake will make only the four baseline CLL interpreters. In this latter directory, nmake can take an optional argument to make just one of the four baseline interpreters. The same structure is used for all six compilers supported. The make files also run simple tests. The tests are found in the test\cll and test\pll directories. The test files are described here. Note that if any changes are made to the AGCLIB1 class library, it should be rebuilt using the corresponding makefile. See here.
|
Table of Contents | | | Parsifal Software Home Page |
---|
XIDEK
Extensible Interpreter Development Kit
Copyright © 1997-2002, Parsifal Software.
All Rights Reserved.