Syntax CHAIMS 2.0 – specified in EBNF  
     proposed by db, 7/13/98
::= 	is defined as
{ }	repetition (zero, one or more times)
[ ]	optional
|	or
( )	brackets for grouping choices
`  `	literals, keywords, symbols

string ::= letter{letter}
string_literal ::= `"` {letter} `"`
integer_literal ::= digit{digit}
real_literal ::= digit{digit}`.` digit{digit}
boolean_literal ::= `TRUE` | `FALSE` 
date_literal ::= digit digit digit digit`:`digit [digit]`:` digit [digit]`::` digit [digit]`:` digit [digit]`:` digit [digit]
invocation_status_literal ::= `DONE` | `NOT_DONE`
programname, megamodulename, methodname, paramatername, invocation_handle, megamodule_handle, dataname, invocation_status ::= string
in_name_value_list ::= in_name_value_pair { `,` in_name_value_pair}
in_name_value_pair ::= parametername `=` invalue
invalue ::= simple_literal | dataname
simple_literal ::= string_literal | integer_literal | boolean_literal | date_literal | real_literal
out_name_value_list ::= out_name_value_pair { `,` out_name_value_pair}
out_name_value_pair ::= dataname `=` parametername

megaprogram ::= programname `BEGINCHAIMS` {statement}`ENDCHAIMS`
statement ::= simple_statement | complex_statement | shortcut_statement
complex_statement ::= while_loop | conditional_statement
while_loop ::= `WHILE (`boolean_expression`) {`statement {statement}`}`  
conditional_statement ::= `IF (`boolean_expression`) THEN {`statement {statement}`}`[`ELSE {`statement {statement}`}`
boolean_expression ::= boolean_expression (`&`|`|`) boolean_expression ???? if we have local modules, the notion of simple CHAIMS types and the shortcut INVOKEEXTRACT, do we really want to allow that?
boolean_expression ::= boolean_literal | dataname | invocation_status_comparison | general_comparison
invocation_status_comparison ::= invocation_status (`=`|`!=`) invocation_status_literal
general_comparison ::= dataname (`=`|`!=`|`>`|`>=`|`<`|`<=`) dataname ???? if we have local modules and the shortcut INVOKEEXTRACT, do we really want to allow that?

simple_statement ::= setup_statement | terminate_statement | estimate_statement | invoke_statement | extract_statement | examine_statement | setparam_statement | getparam_statement | assignment_statement 
setup_statement ::= megamodule_handle `= SETUP("` megamodulename `")`
terminate_statement ::= (megamodule_handle`.TERMINATE()`) | (invocation_handle`.TERMINATE()`)
estimate_statement ::=  `(`out_name_value_list`) =` megamodule_handle`.ESTIMATE("`methodname`")`
invoke_statement ::= invocation_handle `=` megamodule_handle`.INVOKE("` methodname [`,` in_name_value_list] `)`
extract_statement ::= `(`out_name_value_list`) =` invocation_handle`.EXTRACT()`
examine_statement ::= invocation_status `=` invocation_handle`.EXAMINE()`
setparam_statement ::= megamodule_handle`.SETPARAM(`in_name_value_list`)`
getparam_statement ::= `(`out_name_value_list`) =` megamodule_handle`.GETPARAM()`
assignment_statement ::= dataname `=` simple_literal

shortcut_statement ::= extractwhendone_statement | invokeextract_statement
invokeextract_statement ::= `(`out_name_value_list`) =` invocation_handle`.INVOKEEXTRACT("` methodname [`,` in_name_value_list] `)`
extractwhendone_statement ::= `(`out_name_value_list`) =` invocation_handle`.EXTRACTWHENDONE()`

Semantic CHAIMS 2.0
The following is only a partial description.
Basic elements
Parametername
The parameternames that appear in the INVOKE, EXTRACT, GETPARAM, SETPARAM primitives are the parameternames listed in the repository. Valid parameternames in GETPARAM and SETPARAM are all parameternames listed for the specific megamodule. Valid parameternames in INVOKE and EXTRACT are all parameternames listed for the specific method.
The parameternames in ESTIMATE are predefined, and are:
-	time of type INTEGER (or of type data?)
-	fee of type INTEGER   -  expresses the fee in US$
Dataname
Datanames refer to data obtained from a megamodule, and can be of  any of the basic CHAIMS data types. These are:
-	boolean
-	string
-	date
-	integer
-	real
-	opaque
The first five ones are simple CHAIMS types, the last one (opaque)  is a complex type. Literals can only be assigned for the simple types. Comparison operators also only work for simple types, if we allow comparison  operators at all. A dataname that stands for a boolean expression of course must be of type boolean, otherwise a semantical error occurs.
The CHAIMS-language is not explicitly typed, i.e. there is no type-declaration for datanames in the megaprogram. Yet we specify the type of the parameters in the repository, so the user (and the compiler if it does semantic checks) can make sure that they do not use the wrong types for general helper modules. 
Literals
The digits in the date literal stand for:    year written in four digits : month : day :: hours : minutes : seconds
Examples for date literal:   	1998:7:30::13:3:15 	July 30, 1998, 1:3pm and 15 seconds 	
0000:0:0::1:59:30		1 hour, 59 minutes, 30 seconds
Example for integer literal:	294329
Examples for string literal:		“mystring” 	“234234”	“lk234l”
Examples for real literal:		0.5	234.0	0.3453
Examples for boolean literal:	TRUE	FALSE
Handles
See description on current API-webpage.
Invoke status
See description on current API-webpage.
Date literal
The digits stand for: 	year written in four digits : month : day :: hours : minutes : seconds
The primitives
……description for each primitive similar to  1.1-description on web…
Hierarchical setting of parameters in a megamodule
… insert here text of minutes from workshop…
Invocation-specific primitives  –  client-specific primitivies  - client and method-specific primitives  
The primitives INVOKE and EXTRACT are invocation specific. The parameters they set or the results they return are for/from one specific invocation, specified by the invocation handle. Also TERMINATE  for invocation handles is invocation specific; it just kills the specified invocation.

The primitives SETPARAM and GETPARAM are client specific (we could also call it megaprogram specific). The parameters they set or return are those set for this specific client/megaprogram (remember: one megamodule may have several clients using it at the same time). These parameters will be used for all subsequent method invocations for which no invocation specific values are given with the INVOKE primitive. The parameters may be used by just one method, or by several different methods with different methodnames. If GETPARAM is called for a parameter that has not yet been set specificely for this client, then the default value is returned.
Also TERMINATE for megamodule handles is client specific; it kills all invocations of this client.

The primitive ESTIMATE is client and method specific, but not invocation specific. The estimates it returns are for the specified methodname, and  for the parameter settings for the client asking for the estimates.

Data types in the repository for 2.0
The following are examples of defining parameters in the 6 CHAIMS types in the repository. This information is put there by the megamodule provider who has to use the appropriate ASN.1-blobs for these types. The information is used by the megaprogrammer and  by the compiler to make sure the megamodules get parameters of the right type.
For all opaque types, also the megamodule-specific type name must be specified (e.g. Transportation_route). This type name does not appear in the megaprogram, but it is needed to verify that megamodules get opaque blobs with the correct content. If the megamodule-specific type is not specified, as e.g. for the general IO-megamodule, then any opaque blob can be handled by the megamodule.
Whenever a parameter can be of more than one simple CHAIMS types, all possible types are listed in a comma-separated list.
PARAM mm.starttime DATE /*starting time for calculation*/
PARAM mm.city_list OPAQUE Transportation_city_list /* comment…*/
PARAM best.input OPAQUE Transportation_city_list
PARAM best.best_route OPAQUE Transportation_route
PARAM display.route OPAQUE Transportation_route
PARAM mm.amount INTEGER /* comment…*/
PARAM mm.grade REAL /* comment…*/
PARAM mm.title STRING /* comment…*/
PARAM mm.switch BOOLEAN /*…*/
PARAM math.arithm_operand1 INTEGER, REAL /*first operand for arithmetic operations */
PARAM math.arithm_operand2 INTEGER, REAL /*second operand for arithmetic operations */
PARAM math.rel_operand1 BOOLEAN, REAL, STRING, INTEGER, DATE /*first operand for comparison */
PARAM math.rel_operand2 BOOLEAN, REAL, STRING, INTEGER, DATE /*second operand for comparison; in an invocation the first and second operand must be of the same type! */
PARAM IO.value_in OPAQUE
PARAM IO.value_out OPAQUE /* value_out contains the same type-structure as value_in, yet the element values may have been changed by the user */

CORBA-IDL 2.0:
The changes to version 1.1 would be:
-	clientid  in SETUP, SETPARAM, TERMINATE for megamodules, INVOKE, GETPARAM
-	ESTIMATE returns not more an integer but an attrvalseq with the predefined parameters fee (of type integer) and time (of type integer or date)
-	EXTRACT and GETPARAM return both an attrvalseq
void EXTRACT (in CHAIMSCALLID callid, in CHAIMSATTRSEQ attrseq, out CHAIMSATTRVALSEQ attrvalseq);
void ESTIMATE (in CHAIMSCLIENTID clientid, in CHAIMSMETHODNAME methodname, in CHAIMSATTRSEQ attrseq, out CHAIMSATTRVALSEQ attrvalseq);
void GETPARAM (in CHAIMSCLIENTID clientid, in CHAIMSATTRSEG attrseq, out CHAIMSATTRVALSEQ attrvalseq);
void INVOKE (in CHAIMSCLIENTID clientid, in CHAIMSMETHODNAME methodname, in CHAIMSATTRVALSEQ attrvalseq, out CHAIMSCALLID callid);
/* Clientid is also a parameter in SETUP, SETPARAM, TERMINATE for megamodule handles */