Introduction to gmPL

The Great Migrations Programming Language -- gmPL -- is a simple command language used to issue instructions to gmBasic and to enter declarations and language descriptions into a symbol table. It is not a procedural programming language, it is an xml-style scripting language.

A gmPL source file is referred to as a script. Scripts are not only read and processed by gmBasic, they are also authored by gmBasic to describe what it has learned about a given migration to date. The incremental quality improvement through an iterative process -- i.e., translation tuning -- depends heavily upon the ability of gmBasic to author not only .NET code but also gmPL code. There are three types of scripts:

Script Description
Command Each invocation of the gmBasic tool is controlled by a command script entered on its command line. The primary purpose of the command script is to instruct gmBasic to do something; however, command scripts can also introduce declarations and language descriptions.
Reference All external components and environments that either control or are referenced by the translation process are described via reference files. These scripts primarily contain declarations but can also contain some instructions to manipulate the environment or other loaded descriptions. Most reference files are initially authored by gmBasic.
Imports External imports are tabulated during individual project translations and combined into an imports file so that they can later be authored. The imports scripts are cumulatively authored by gmBasic through a series of independent translations and are then finally used to author a .NET declaration framework.

The gmPL syntax uses an XML-style notation. gmPL files are valid XML files but the conventions they use are a subset of what can be done with XML. They are designed to be simple to read and simple to write. No individual statement syntax descriptions are needed or supplied.

Every statement begins with <statement where "statement" is a specified statement keyword. The statement keyword is optionally followed by a series of attribute="value" pairs where each "attribute" is one the specified attribute keywords defined for the statement.

Statement instances that do not introduce any substatements end in />. Statement instances that do introduce substatements end in > and are then followed by those substatements, and are finally ended by a statement of the form </statement>.

The "<statement" specification must occur on a new physical record in the file though it may be preceded by white space -- blanks and/or tabs. There can be no white space between the opening "<" and the "statement". White space and new lines may occur between the attribute-value pairs. Note that the Xml standard specifies that there be no white space before or after the equals sign in the attribute-value notation; however, this requirement is often ignored for readability, so blanks are allowed.

The gmPL statements are classified by type, and role.

The type of a statement specifies whether it can have other statements in its scope:

Type Description
Terminal Terminal statements can not have other statements within their scope. They must always be written using single statement syntax -- ending in />
Nonterminal Nonterminal statements can have substatements within their scope. They can be written using either single statement syntax or block syntax. It is valid to use block syntax with no intervening substatements.

The role of a statement specifies its primary purpose within the process:

Role Description
Command Command statements are the primary instructions issued to the tool and are used in practically all gmBasic command line scripts, though they are not limited to those scripts.
Utility Utility statements are like the command statements in that are specified within a command line script. Their role, however, is not to guide a translation but rather to perform a special operation that will eventually aid a translation.
Declaration Declaration statements describe the external components in the environment of a given translation. They are the primary commands in reference scripts, but are also used extensively in language descriptions.
Refactoring Refactoring statements make changes and/or add annotations to declared and source code defined symbols in order to change them to be compatible with the target language environment or to improve the quality of the translation.
Metalanguage Metalanguage statements define the intermediate language gmIL used to mediate between the source and target languages.

Table of Contents