
Complete action language grammar
This section contains the grammar that is used by the action language parser. Grammatical elements in this list occasionally differ from their equivalents in the SWAL statement and functions section, because in that section a few changes were made for the sake of clarity:
- minor name changes added missing semantic information
- unimplemented parts of the grammar were omitted
- some elements were expanded or condensed according to the grammar
The elements defined in the grammar are listed in alphabetical order. A few elements-such as string-literal or identifier-are defined by the IDL grammar. See the IDLos grammar in Chapter 1 for a definition of these items.
action:
type scopedMethodName inputParameterList { const } statementBlock |
includeStatement | idStatement | package identifier ;addingExpression:
multiplyingExpression ( ( + | - ) multiplyingExpression )*arrayExpression:
{ :: } ( identifier :: )* identifier | integerLiteralassignEqualOp:
*= | /= | %= | += | -= | <<= | >>= | &= | ^= | |=assignmentExpression:
( = | assignEqualOp ) ( expression | empty ) | ( ++ | -- )booleanExpression:
( expression )cardinalityFunction:
cardinality ( ( scopedType | handleOrSelf -> chainSpec ) )catchExpression:
scopedType { identifier }catchStatement:
catch ( catchExpression ) statementBlockchainSpec:
scopedType [ relationshipSpec ]comparisonOperator:
< | > | <= | >= | == | !=createStatement:
create { singleton } handle { on locationSpec }
{ implementation implementationSpec }
{ values ( valueSpec ( , valueSpec )* ) }cType:
unsigned short | short | unsigned int | int | long |
long long | unsigned ( long | long long ) | float | double | unsigned char | char | voiddeclareSpecStatement:
type identifier { [ arrayExpression ] | assignmentExpression } ;declareStatement:
declare declareSpecStatement | declare { ( declareSpecStatement )+ }deleteStatement:
delete handle | delete [ ] handleelseIfStatement:
else if booleanExpression statementBlock { ( elseStatement | elseIfStatement ) }elseStatement:
else statementBlockexpression:
relationalExpression ( booleanOperator relationalExpression )*extendedChain:
( ( -> ) chainSpec )+floatLiteral:
floating-point-literalforStatement:
for handle in setSpec { where whereSpec } { order by attributeName } statementBlock | for ( lval { assignmentExpression } ; expression ; expression ) statementBlockfunction:
cardinalityFunction | inFunctiongenAssignDeclareStatement:
{ const } ( cType | scopedType | self ) ( paramList | userDereference identifier { ( [ arrayExpression ] | assignmentExpression | paramList ) } | . identifier arrayList ( paramList | = ( expression | empty ) | assignEqualOp expression ) )idStatement:
identifier ( expression ) ;ifStatement:
if booleanExpression statementBlock { ( elseStatement | elseIfStatement ) }implementationSpec:
identifier | integerLiteralincludeStatement:
# include < identifier ( ( . | / ) identifier )* >inFunction:
handle in handleOrSelf -> chainSpecinputParameter:
type & identifierinputParameterList:
( ( inputParameter ( , inputParameter )* | void | ) )integerLiteral:
decimal-integer-literal | hexadecimal-integer-literal | octal-integer-literal |
decimal-integer-literal_LL | hexadecimal-integer-literal_LL | octal-integer-literal_LLliteral:
stringLiteral | charLiteral | integerLiteral | floatLiteral | booleanLiterallocationSpec:
identifier | stringLiteralloopControlStatement:
break | continuelval:
{ ( ++ | -- ) } identifier arrayListlvalStatement:
lval { assignmentExpression }multiplyingExpression:
signExpression ( ( * | / | % ) signExpression )*nativeType:
unsigned short | short | unsigned ( long | long long ) | long | long long | float | double | boolean | char | wchar | octet | Object | any | string | wstring | voidparamList:
( { paramSpec ( , paramSpec )* } )paramSpec:
parameterName : expression | expressionprimitiveExpression:
{ ( & | * ) } identifier arrayList { ( ++ | -- ) } | literal | function |
handleOrSelf . attributeName ( . attributeName )* ( paramList | arrayList ) | userMethodOrVar | staticMethodOrEnum | ( expression ) |
sizeof ( ( identifier | cType ) ) | empty handleOrSelf |
new ( { :: } ( identifier :: )* identifier | cType ) { [ arrayExpression ] } | selfrelateStatement:
relate handleOrSelf relationshipSpec handleOrSelf { using handleOrSelf }relationalExpression:
addingExpression ( comparisonOperator addingExpression )*relationshipSpec:
relationshipNamereturnStatement:
return { expression }scopedMethodName:
( identifier :: )+ identifierscopedType:
{ :: } ( identifier :: )* identifierselectStatement:
select { distinct } handle from ( handleOrSelf extendedChain { where whereSpec } | singleton className | className where whereSpec )setSpec:
className | handleOrSelf extendedChainsignExpression:
{ + - } unaryExpressionspawnStatement:
spawn scopedType ( { paramSpec ( , paramSpec )* } )statement:
declareStatement | createStatement ; | deleteStatement ; | relateStatement ; | unrelateStatement ; | selectStatement ; | forStatement | ifStatement |
whileStatement | tryStatement | throwStatement ; | loopControlStatement ; |
transactionStatement ; | spawnStatement ; | genAssignDeclareStatement ; |
userMethodStatement ; | lvalStatement ; | returnStatement ; | statementBlockstatementBlock:
{ ( statement )* }staticMethodOrEnum:
{ :: } ( identifier :: )+ operationName { paramList }stringLiteral:
( string-literal )+transactionStatement:
( begin | commit | abort ) transactiontryStatement:
try statementBlock ( catchStatement )+type:
constDeclare ( nativeType | userDefinedType )unaryExpression:
{ unaryOperator } primitiveExpressionunrelateStatement:
unrelate handleOrSelf relationshipSpec handleOrSelf { using handleOrSelf }userMethodOrVar:
handle -> methodName { paramList } | operationName paramListuserMethodStatement:
handle ( -> methodName )+ { paramList } { assignmentExpression }valueSpec:
attributeName : expression | chainSpec : expression