XIDEK
|
Baseline LanguagesIntroductionAs a baseline for development, two simple languages were developed. The first, CLL, is a C-like language, which implements the basic expression and statement syntax of C, although it does not implement declarations, subscripts or switch statements. Why C? Many computer languages in fact use an underlying statement syntax which is similar to that of C. Also, because C is so well-known, for most people there is less new material to be learned and less explanation required. The second language, PLL, is more like Pascal. It was created by stripping CLL of its more esoteric features and syntax and replacing them with simpler, Pascal-like constructs. PLL might well be preferred by a developer whose end users are not professional programmers. It is particularly important to note that interpreters for both languages use the same support code. Also, the changes required for the example extensions are very nearly identical. All the interpreters in the kit implement both integer and real arithmetic, as well as limited string capabilities. Apart from the syntactic rules for recognizing constants, these capabilities are implemented as member functions of the Value class. An extension to support complex arithmetic demonstrates the methods for extending these capabilities.
Overview of CLL - a C-Like LanguageThe CLL language is defined by the syntax specified in cll.syn. The syntax files which parse the CLL language, dxi.syn, dci.syn, and ast.syn, (ast.syn is used by both astxi and astci) are basically cll.syn with reduction procedures added to implement the particular functionality required by the different interpreters.Detailed reference documentation for the CLL language syntax is provided in the CLL reference. The CLL syntax supports the basic elements of a script language: recognition of variable names and constants, evaluation of expressions, and execution of conditional and loop statements, all based on the familiar C syntax. These may fairly be regarded as the portions of C that have become more or less standard and are not the subject of any significant controversy. Omitted are declarations, pointers, subscripts, and switch statements. The C features implemented consist of (links are to the CLL reference):
The CLL syntax also contains three additional elements. To illustrate changes in expression syntax, Fortran style exponentiation has been added. To aid in debugging scripts and to illustrate how to add new statements to the grammar, dump and print statements have been added. The following features of C have not been implemented:
Some of the missing functionality has been implemented in three extensions to the basic syntax: All of these extensions are combined in the combine extension.Since there are many ways to implement these features, all of which have their own benefits and shortcomings, these extensions are provided simply as examples and should be seen simply as suggestions as to how to proceed.
Overview of PLL - a Pascal-Like LanguageThe CLL language may well be viewed as too "complicated" for some applications. Indeed, many expert C programmers find it difficult to remember the details of the C expression syntax with its many levels of precedence. If the intended class of users of an interpreter is not familiar with C, the advantage of compatibility with C vanishes and it might be desirable to implement a more user-friendly syntax.To demonstrate how to modify the language to make it "simpler", XIDEK contains an example of an alternate language, PLL, many of whose features are drawn from Pascal. It will be noted that while there are substantial changes to the syntax file, interpreters for both languages can use the same support code. Here is a summary of the changes made to CLL to create PLL. The changes are described in detail in the PLL reference.
|
Table of Contents | | | Parsifal Software Home Page |
---|
Interpreter Development Kit
Copyright © 1997-2002, Parsifal Software.
All Rights Reserved.