This is one of the STIPPLE Documentation pages.
For the rest of this manual, only the English keywords are used.
version
declaration is:
The version declaration specifies which version of the STIPPLE language the rest of module is written in. The first version of STIPPLE is "1.0". Upward compatible versions of the language will increment the number to the right of the decimal point (e.g. "1.1" and "1.2".) Non-upward compatible versions of the language will increment the number to the left of the decimal point (e.g. "2.0" and "3.0".) Version strings must always be enclosed in double quotes.
The identify declaration permits the user to supply an identification string to be stored with the object file. In Unix, an SCCS identification string is frequently stored in the identify declaration. The identify string must always be enclosed in double quotes. Depending upon the compilation system, the resulting object file may or may not contain the identify string.
{The syntax and grammar in this section is pretty messed up and confused. It needs to worked on to integrate into overall grammar.}
Each configuration variable declaration defines one or more configuration variables. A configuration variable may be declared exactly once. The scope of each configuration variable is from immediately after the declaration through to the source file end. The initial value of each new configuration variable is false unless it is explicitly assigned a value using a configuration expression. A configuration expression is a boolean expression consisting entirely of previously declared configuration variables, the logical constants true and false and the logical operators. Via compiler options, the default settings of any and all configuration variables may be set.
The configuration_if statement evaluates its configuration expressions in order until one of them evaluates to true. The statements and/or declarations under the first true clause are compiled as if they occurred at the same nesting level as the configuration_if. All other statements and/or declarations in the other clauses are neither parsed nor compiled; however they must be lexically correct. If all configuration expressions evaluate to false and there is a configuration_else clause, the statements and/or declarations under the configuration_else clause are compiled as if they occurred at the same nesting level as the configuration_if.
English version "1.0" configuration_variables red_ok, green_ok := true, blue_ok configuration_variables purple_ok := red_ok && blue_ok configuration_variables a_ok, b_ok := a_ok # Illegal - a_ok is not in scope module example type color enumeration configuration_if red_ok red configuration_if green_ok green configuration_else configuration_error `green_ok must always be configured' configuration_if blue_ok blue configuration_if purple_ok purpleFor the above example, if no configuration variable settings are specified to the compiler, the following configuration is seen by the compiler:
English version "1.0" module example type color enumeration greenFor the above example, if the red_ok and green_ok variable settings are set to true via compiler options, the following configuration is seen by the compiler:
English version "1.0" module example type color enumeration red green blue purpleFinally, for the above example, if the green_ok variable is set to false via a compiler option, a fatal error message containing `green_ok must always be configured' is generated.
Any extensions added to the STIPPLE compiler are assigned an identifier. The extensions are enabled by specifying the identifier in an extension declaration. When an extension gets promoted to the language specification proper, the STIPPLE version number is incremented and the extension identifier becomes illegal in code compiled at the new level. (This forces programmers to remove stale extension declarations when they are upgrading their code.) All extensions are implemented by modifying the compiler.
The interface to a module can be provided in multiple native languages (e.g. English, French, Spanish, etc.) For each native language, the type, object, and procedure names will be different. By default, when a module is imported, the source file native language is selected as the desired interface. However, sometimes there is no source file native language interface available. In this situation, the programmer going to have no choice but to use a non-native interface to the module. This is accomplished by specifying the desired interface native language using the using clause to the import declaration. For example, in an English source file,
import peso using Spanishspecifies that the module interface named peso is to be accessed using the Spanish native language. Note that the language identifier is Spanish, not Español. The language identifier for the using clause is always the native language spelling of the foreign language. If there is no native language interface for the language specified by a using clause, an error is generated.
When a particular source file is first written, it may not have access to native language interfaces for all of its import declarations. However, as time goes on, native language interfaces may be produced. The preferring and preferring_native clauses of the import declaration are used to specify the desire to use a different native language interface. If the preferring_native clause is specified, the first time the compiler discovers that a source file native language interface to the module exists, it will generate a warning message. The preferring clause specifies one or more languages that are preferred over the language specified by the using clause. Whenever the compiler detects that an interface in one of the languages specified by the preferring clause is available, it will generate a warning message. For an English source file,
import peso using Spanish preferring Englishand
import peso using Spanish preferring_nativeare essentially equivalent; to encourage uniformity, the compiler disallows a preferring clause that is only followed by the native language. Thus, the preferring clause must have at least one language that is different from the native language.
The export declaration provides the ability to control which objects and routines are accessible by other procedures. Each export declaration has a from clause and a to clause separated by the to keyword. The from clause specifies a set of one or more objects and/or routines. The to clause specifies another set of routines. Each object or routine specified by the from clause can be directly reference by all of the routines specified by the to clause.
For the from clause, the objects and routines are either directly or indirectly specified. One or more objects can be directly specified using the object clause and one or more routines can be directly specified using the routine clause. The all, type, and routine_suffix clauses are used to indirectly specify sets of objects and routines. The all clause specifies all of the objects and routines in the entire module. (Note: the module may be contained in multiple source files.) The type clause specifies all objects and procedures that are members of a named type that are defined in the current module. The procedure_suffix clause specifies all routines that end in a specified suffix (e.g. "get" or "set") that are defined in the current module.
For the to clause, the routines are specified either directly or indirectly. Routines from any other module can be directly specified using the routine clause. All routines in all modules through-out the entire application are specified using the all clause. All routines in a named module are specified using the module clause. All routines that are a member of a named type are specified using the type clause.
By default, all objects and procedures in a given module are accessible by all of the other procedures in the module. For example, for a module named M, this is equivalent to:
export all to module MSome examples of export declarations are shown below:
export procedure_suffix get to all # All of the modules procedures ending in #, "_get" are accessible by all modules #, through-out the entire application. procedure new@new to procedure special_invert # The procedure new@matrix is accessible #, by the procedure special_invert. object error@node to type parse #, The object error@node is accessible to #, procedures associated with type parse #, defined in any other module. type node to module parse, print, check # All of the procedures and objects #, associated with type node in the current #, module are accessible to the procedures #, defined in the parse, print, and check #, modules. all to all # All procedures and objects in the current #, module are accessible from any procedure #, defined in any other module.
English # This module is written in English #, using the STIPPLE 1.0 version of the language version "1.0" identify "parser.sts 1.16 91/01/29 Copyright© Mumbletron Corp." extension chemistry # Use some language extensions for #, chemistry applications configuration_variables debug, demo # Define two conditional compilation variables #, - one for debugging and another for a #, demonstration version module distill # This module implements a library of #, distillation routines import beer using German preferring_native # It uses the procedures/objects from the beer #, module which is available only in German. configuration_if debug # The debugging version uses the #, {process_monitor} module process_monitor export all to all # All of this modules procedures/objects #, are exported