TOC PREV NEXT INDEX

Kabira Technologies, Inc.


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:

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 ;

actionFile:
( action )+

addingExpression:
multiplyingExpression
( ( + | - ) multiplyingExpression )*

arrayExpression:
{ :: } ( identifier :: )* identifier | integerLiteral

arrayList:
( [ expression ] )*

assignEqualOp:
*= | /= | %= | += | -= | <<= | >>= | &= | ^= | |=

assignmentExpression:
( = | assignEqualOp ) ( expression | empty ) | ( ++ | -- )

attributeName:
identifier

binaryOperator:
+ | - | * | /

booleanExpression:
( expression )

booleanLiteral:
true | false

booleanOperator:
&& | ||

cardinalityFunction:
cardinality ( ( scopedType | handleOrSelf -> chainSpec ) )

catchExpression:
scopedType
{ identifier }

catchStatement:
catch ( catchExpression ) statementBlock

chainSpec:
scopedType
[ relationshipSpec ]

charLiteral:
character-literal

className:
scopedType

comparisonOperator:
< | > | <= | >= | == | !=

constDeclare:
{ const }

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 | void

declareSpecStatement:
type identifier
{ [ arrayExpression ] | assignmentExpression } ;

declareStatement:
declare declareSpecStatement | declare { ( declareSpecStatement )+ }

deleteStatement:
delete handle | delete [ ] handle

elseIfStatement:
else if booleanExpression statementBlock { ( elseStatement | elseIfStatement ) }

elseStatement:
else statementBlock

expression:
relationalExpression
( booleanOperator relationalExpression )*

extendedChain:
( ( -> ) chainSpec )+

floatLiteral:
floating-point-literal

forStatement:
for handle in setSpec { where whereSpec } { order by attributeName } statementBlock | for ( lval { assignmentExpression } ; expression ; expression ) statementBlock

function:
cardinalityFunction
| inFunction

genAssignDeclareStatement:
{ const } ( cType | scopedType | self ) ( paramList | userDereference identifier { ( [ arrayExpression ] | assignmentExpression | paramList ) } | . identifier arrayList ( paramList | = ( expression | empty ) | assignEqualOp expression ) )

handle:
identifier

handleOrSelf:
handle
| self

idStatement:
identifier
( expression ) ;

ifStatement:
if booleanExpression statementBlock { ( elseStatement | elseIfStatement ) }

implementationSpec:
identifier
| integerLiteral

includeStatement:
# include < identifier ( ( . | / ) identifier )* >

inFunction:
handle
in handleOrSelf -> chainSpec

inputParameter:
type
& identifier

inputParameterList:
( ( inputParameter ( , inputParameter )* | void | ) )

integerLiteral:
decimal-integer-literal
| hexadecimal-integer-literal | octal-integer-literal |
decimal-integer-literal_LL | hexadecimal-integer-literal_LL | octal-integer-literal_LL

literal:
stringLiteral
| charLiteral | integerLiteral | floatLiteral | booleanLiteral

locationSpec:
identifier
| stringLiteral

loopControlStatement:
break | continue

lval:
{ ( ++ | -- ) } identifier arrayList

lvalStatement:
lval
{ assignmentExpression }

methodName:
identifier

multiplyingExpression:
signExpression
( ( * | / | % ) signExpression )*

nativeType:
unsigned short | short | unsigned ( long | long long ) | long | long long | float | double | boolean | char | wchar | octet | Object | any | string | wstring | void

operationName:
identifier

parameterName:
identifier

paramList:
( { paramSpec ( , paramSpec )* } )

paramSpec:
parameterName
: expression | expression

primitiveExpression:
{ ( & | * ) } identifier arrayList { ( ++ | -- ) } | literal | function |
handleOrSelf . attributeName ( . attributeName )* ( paramList | arrayList ) | userMethodOrVar | staticMethodOrEnum | ( expression ) |
sizeof ( ( identifier | cType ) ) | empty handleOrSelf |
new ( { :: } ( identifier :: )* identifier | cType ) { [ arrayExpression ] } | self

relateStatement:
relate handleOrSelf relationshipSpec handleOrSelf { using handleOrSelf }

relationalExpression:
addingExpression
( comparisonOperator addingExpression )*

relationshipName:
identifier

relationshipSpec:
relationshipName

returnStatement:
return { expression }

scopedMethodName:
( identifier :: )+ identifier

scopedType:
{ :: } ( identifier :: )* identifier

selectStatement:
select { distinct } handle from ( handleOrSelf extendedChain { where whereSpec } | singleton className | className where whereSpec )

setSpec:
className
| handleOrSelf extendedChain

signExpression:
{ + - } unaryExpression

spawnStatement:
spawn scopedType ( { paramSpec ( , paramSpec )* } )

statement:
declareStatement
| createStatement ; | deleteStatement ; | relateStatement ; | unrelateStatement ; | selectStatement ; | forStatement | ifStatement |
whileStatement | tryStatement | throwStatement ; | loopControlStatement ; |
transactionStatement ; | spawnStatement ; | genAssignDeclareStatement ; |
userMethodStatement ; | lvalStatement ; | returnStatement ; | statementBlock

statementBlock:
{ ( statement )* }

staticMethodOrEnum:
{ :: } ( identifier :: )+ operationName { paramList }

stringLiteral:
( string-literal )+

throwStatement:
throw handle

transactionStatement:
( begin | commit | abort ) transaction

tryStatement:
try statementBlock ( catchStatement )+

type:
constDeclare
( nativeType | userDefinedType )

unaryExpression:
{ unaryOperator } primitiveExpression

unaryOperator:
! | -

unrelateStatement:
unrelate handleOrSelf relationshipSpec handleOrSelf { using handleOrSelf }

userDefinedType:
scopedType

userDereference:
{ ( * | & ) }

userMethodOrVar:
handle
-> methodName { paramList } | operationName paramList

userMethodStatement:
handle
( -> methodName )+ { paramList } { assignmentExpression }

valueSpec:
attributeName
: expression | chainSpec : expression

whereExpression:
( whereSpec | wherePrimitive )

wherePrimitive:
( handleOrSelf