All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ool.core.ast.2.4.4.source-code.overtureII.astv2 Maven / Gradle / Ivy

Packages
base org.overture.ast.node;
analysis org.overture.ast.analysis;
  
Tokens
/* This section declared tokens as internal types or external classes
 * internal definitions:
 *  plus='+';
 *  
 * external
 *  location = 'java:org.overture.ast.lex.LexLocation';
 */
  LexToken = 'java:node:org.overture.ast.intf.lex.ILexToken';
  LexNameToken = 'java:node:org.overture.ast.intf.lex.ILexNameToken';
  LexIdentifierToken = 'java:node:org.overture.ast.intf.lex.ILexIdentifierToken';
  LexBooleanToken = 'java:node:org.overture.ast.intf.lex.ILexBooleanToken';
  LexCharacterToken = 'java:node:org.overture.ast.intf.lex.ILexCharacterToken';
  LexIntegerToken = 'java:node:org.overture.ast.intf.lex.ILexIntegerToken';
  LexQuoteToken = 'java:node:org.overture.ast.intf.lex.ILexQuoteToken';
  LexRealToken = 'java:node:org.overture.ast.intf.lex.ILexRealToken';
  LexStringToken = 'java:node:org.overture.ast.intf.lex.ILexStringToken';
  location = 'java:org.overture.ast.intf.lex.ILexLocation';
  
  clonableFile ='java:org.overture.ast.util.ClonableFile';
  clonableString ='java:org.overture.ast.util.ClonableString';
  
  ClassDefinitionSettings = 'java:enum:org.overture.ast.typechecker.ClassDefinitionSettings';
  nameScope = 'java:enum:org.overture.ast.typechecker.NameScope';
  Pass = 'java:enum:org.overture.ast.typechecker.Pass'; 
  
  //Java
  java_Boolean = 'java:java.lang.Boolean';
  java_Integer = 'java:java.lang.Integer';
  java_String = 'java:java.lang.String';
  java_Long = 'java:java.lang.Long';
     
  static = 'static';
  async = 'async';
  
Abstract Syntax Tree
/* This section declares the AST by giving root nodes and their possible sub classes
 *
 * exp {-> package='org.overture.ast.expressions'}
 *      = {subclass1} [field_name]:field_type_must_either_be_root_or_token ...
 *      ;
 *
 */

/*
    Expressions
*/    
exp {-> package='org.overture.ast.expressions'
	| (type):type 
	| [location]:location}
    =   {apply} [root]:exp [args]:exp* (argtypes):type* (recursive):definition
    |	{narrow} [test]:exp [typeName]:LexNameToken (basicType):type (typedef):definition
    |   #Unary
    |   #Binary
    |   {booleanConst} [value]:LexBooleanToken
    |   {cases} [expression]:exp [cases]:alternative.case* [others]:exp
    |   {charLiteral} [value]:LexCharacterToken
    |   {elseIf} [elseIf]:exp [then]:exp  
    |   {exists1}  [bind]:bind [predicate]:exp [def]:definition
    |   {exists} [bindList]:multipleBind* [predicate]:exp
    |   {field} [object]:exp [memberName]:LexNameToken [field]:LexIdentifierToken
    |   {fieldNumber} [tuple]:exp [field]:LexIntegerToken
    |   {forAll} [bindList]:multipleBind* [predicate]:exp
    |   {funcInstatiation} [function]:exp (actualTypes):type* (expdef):definition.#Function.explicit (impdef):definition.#Function.implicit
    |   {history} [hop]:LexToken [opnames]:LexNameToken*
    |   {if} [test]:exp [then]:exp [elseList]:elseIf* [else]:exp
    |   {intLiteral} [value]:LexIntegerToken
    |   {iota} [bind]:bind [predicate]:exp
    |   {is} [typeName]:LexNameToken (basicType):type [test]:exp [typedef]:definition
    |   {isOfBaseClass} [baseClass]:LexNameToken [exp]:exp
    |   {isOfClass} [className]:LexNameToken (classType):type.class [exp]:exp
    |   {lambda} [bindList]:bind.type* [expression]:exp [paramPatterns]:pattern* [paramDefinitions]:definition* (functionType):type     
    |   {letBeSt} [bind]:multipleBind [suchThat]:exp [value]:exp [def]:definition.multiBindList
    |   {letDef} [localDefs]:definition* [expression]:exp
    |   {def} [localDefs]:definition* [expression]:exp
    |   #Map
    |   {maplet}  [left]:exp [right]:exp
    |   {mkBasic} [arg]:exp
    |   {mkType} [typeName]:LexNameToken [args]:exp* (recordType):type.#invariant.record (argTypes):type*
    |   {mu} [record]:exp (recordType):type.#invariant.record [modifiers]:modifier.record* (modTypes):type*
    |   {new} [className]:LexIdentifierToken [args]:exp* (classdef):definition.#class (ctorDefinition):definition
    |   {nil} 
    |   {notYetSpecified} 
    |   {postOp} [opname]:LexNameToken (preexpression):exp (postexpression):exp (errors):case.error* (state):definition.state [errorLocation]:location
    |   {pre} [function]:exp [args]:exp*
    |   {preOp} [opname]:LexNameToken (expression):exp  (errors):case.error* (state):definition.state
    |   {quoteLiteral} [value]:LexQuoteToken
    |   {realLiteral} [value]:LexRealToken
    |   {sameBaseClass} [left]:exp [right]:exp
    |   {sameClass} [left]:exp [right]:exp
    |   {self} [name]:LexNameToken
    |   #Seq
    |   #Set
    |   {stateInit} (state):definition.state 
    |   {stringLiteral} [value]:LexStringToken
    |   {subclassResponsibility} 
    |   {subseq} [seq]:exp [from]:exp [to]:exp (ftype):type (ttype):type
    |   {threadId} 
    |   {time} 
    |   {tuple} [args]:exp* (types):type*
    |   {undefined}
    |   {variable} [name]:LexNameToken [original]:java_String (vardef):definition        
    ;
    
#Unary {-> package='org.overture.ast.expressions'
	|	[exp]:exp}
    =   {absolute} 
    |   {cardinality}  
    |   {distConcat} 
    |   {distIntersect}  
    |   {distMerge} 
    |   {distUnion} 
    |   {elements}
    |   {floor}  
    |   {head} 
    |   {indices}  
    |   {len} 
    |   {mapDomain} 
    |   {mapInverse} (mapType):type.#Map
    |   {mapRange} 
    |   {not}  
    |   {powerSet} 
    |   {reverse}  
    |   {tail} 
    |   {unaryMinus}
    |   {unaryPlus}       
    ;


#Binary {-> package='org.overture.ast.expressions'
	|	[left]:exp 
	|	[op]:LexToken 
	|	[right]:exp}
    =   #Boolean
    |   {comp} 
    |   {domainResBy}
    |   {domainResTo}
    |   {equals}
    |   {inSet}
    |   {mapUnion}
    |   {notEqual}
    |   {notInSet}
    |   #Numeric
    |   {plusPlus}
    |   {properSubset}
    |   {rangeResBy}
    |   {rangeResTo}
    |   {seqConcat}
    |   {setDifference}
    |   {setIntersect}
    |   {setUnion}
    |   {starStar}
    |   {subset}
    ;
    

    
#Boolean {-> package='org.overture.ast.expressions'}
    =   {and}
    |   {equivalent}
    |   {implies}
    |   {or}
    ;
    
#Numeric {-> package='org.overture.ast.expressions'}
    =   {div}
    |   {divide}
    |   {greaterEqual}
    |   {greater}
    |   {lessEqual}
    |   {less}
    |   {mod}
    |   {plus}
    |   {rem}
    |   {subtract}
    |   {times}
    ;
    
#Map {-> package='org.overture.ast.expressions'}
    =   {mapComp} [first]:exp.maplet [bindings]:multipleBind* [predicate]:exp
    |   {mapEnum} [members]:exp.maplet* (domTypes):type* (rngTypes):type*
    ;
    
#Seq {-> package='org.overture.ast.expressions'}
    =   {seqComp} [first]:exp [setBind]:bind.set [seqBind]:bind.seq [predicate]:exp
    |   {seqEnum} [members]:exp* (types):type*
    ;
    
#Set {-> package='org.overture.ast.expressions'
	|	(setType):type.#set}
    =   {setComp} [first]:exp [bindings]:multipleBind* [predicate]:exp
    |   {setEnum} [members]:exp* (types):type*
    |   {setRange} [first]:exp [last]:exp (ftype):type (ltype):type
    ;
    
modifier {-> package='org.overture.ast.expressions'}
    = {record} [tag]:LexIdentifierToken [value]:exp
    ;
    
alternative {-> package='org.overture.ast.expressions'}
    = {case} [location]:location [cexp]:exp [pattern]:pattern 
             [result]:exp [defs]:definition*  (type):type (expType):type
    ;
    
type {-> package='org.overture.ast.types'
	|	[location]:location 
	|	[resolved]:java_Boolean 
	|	(definitions):definition*}
    =   #basic
    |   {bracket} (type):type
    |   {class} [name]:LexNameToken (classdef):definition.#class //change classdef to graf - is this correct dont see how it could have worked before
    |   {function} [partial]:java_Boolean (parameters):type* (result):type [instantiated]:java_Boolean
    |   #invariant
    |   #Map 
    |   {operation} (parameters):type* (result):type (pure):java_Boolean
    |   {optional} (type):type
    |   {parameter} [name]:LexNameToken
    |   {product} (types):type*
    |   {quote} [value]:LexQuoteToken 
    |   #seq 
    |   #set
    |   {undefined}
    |   {union} (types):type* [infinite]:java_Boolean [expanded]:java_Boolean 
        (seqDone):java_Boolean (seqType):type.#seq 
        (setDone):java_Boolean (setType):type.#set 
        (mapDone):java_Boolean (mapType):type.#Map
        (prodCard):java_Integer (prodType):type.product
        (funcDone):java_Boolean (funcType):type
        (opDone):java_Boolean (opType):type
        (numDone):java_Boolean (numType):type.#basic.#numeric
        (recDone):java_Boolean (recType):type.#invariant.record
        (classDone):java_Boolean (classType):type.class
    |   {unknown}
    |   {unresolved} (name):LexNameToken 
    |   {voidReturn}
    |   {void} 
    ; 


#seq {-> package='org.overture.ast.types'
	|	(seqof):type 
	|	[empty]:java_Boolean}
    =   {seq} 
    |   {seq1} 
    ;

#set {-> package='org.overture.ast.types'
	|	(setof):type 
	|	[empty]:java_Boolean
	|	[infinite]:java_Boolean}
    =   {set} 
    |   {set1} 
    ;

#Map  {-> package='org.overture.ast.types'
	|	(from):type 
	|	(to):type 
	|	[empty]:java_Boolean}
    =   {inMap} 
    |   {map}
    ;
#invariant {-> package='org.overture.ast.types'
    |	[inNarrower]:java_Boolean
	|	(opaque):java_Boolean
    |   (invDef):definition.#Function.explicit}
    =   {named} (name):LexNameToken (type):type //[invdef]:#Function.explicit //super = invariant type
    |   {record} [name]:LexNameToken (fields):field.field* (infinite):java_Boolean (composed):java_Boolean //[invdef]:#Function.explicit //super = invariant type
    ;

#basic {-> package='org.overture.ast.types'}
    =   {boolean}
    |   {char}
    |   #numeric     
    |   {token}
    ;

#numeric {-> package='org.overture.ast.types'}
    =   {int} 
    |   {natOne} 
    |   {nat} 
    |   {rational} 
    |   {real} 
    ;

field {-> package='org.overture.ast.types'}
    =   {field} [access]:accessSpecifier.accessSpecifier [tagname]:LexNameToken 
                [tag]:java_String (type):type [equalityAbstraction]:java_Boolean
    ;
accessSpecifier  {-> package='org.overture.ast.types'}
  = {accessSpecifier} [access]:access [static]:static [async]:async [pure]:java_Boolean
  ;
access  {-> package='org.overture.ast.definitions'}
    =   {public}
    |   {protected}
    |   {private}
    ;


pattern {-> package='org.overture.ast.patterns'
	|	[location]:location 
	|	[definitions]:definition* 
	|	[resolved]:java_Boolean}
    =   {boolean} [value]:LexBooleanToken
    |   {character} [value]:LexCharacterToken
    |   {concatenation} [left]:pattern [right]:pattern
    |   {expression} [exp]:exp
    |   {identifier} [name]:LexNameToken [constrained]:java_Boolean
    |   {ignore} [anyName]:LexNameToken
    |   {integer} [value]:LexIntegerToken
    |   {nil}
    |   {quote} [value]:LexQuoteToken
    |   {real} [value]:LexRealToken
    |   {record} [typename]:LexNameToken [plist]:pattern* (type):type
    |   {seq} [plist]:pattern*
    |   {set} [plist]:pattern*
    |   {string} [value]:LexStringToken
    |   {tuple} [plist]:pattern*
    |   {union} [left]:pattern [right]:pattern   
    |   {map} [maplets]:maplet.mapletPattern*
    |   {mapUnion} [left]:pattern [right]:pattern
    |	{object} [classname]:LexNameToken [fields]:pair.namePattern* (type):type
    ;
    
maplet {-> package='org.overture.ast.patterns'}
    =   {mapletPattern} [from]:pattern [to]:pattern [resolved]:java_Boolean
    ;
    
pair {-> package='org.overture.ast.patterns'
	| [resolved]:java_Boolean}
    = {patternType} [pattern]:pattern (type):type
    | {patternListType} [patterns]:pattern* (type):type
    | {namePattern} [name]:LexNameToken [pattern]:pattern
    ; 
    
bind {-> package='org.overture.ast.patterns'
	|	[location]:location 
	|	(pattern):pattern}
    =   {set} (set):exp
    |   {type} (type):type
    |   {seq} (seq):exp
    ;

//This is used in PExp and PDefinition
multipleBind {-> package='org.overture.ast.patterns'
	|	[location]:location 
	|	[plist]:pattern*}
    =   {set}  [set]:exp
    |   {type} (type):type
    |   {seq} [seq]:exp
    ;

patternBind {-> package='org.overture.ast.patterns'}
    = {def} [location]:location [pattern]:pattern [bind]:bind (defs):definition* (type):type
    ;
    
definition {-> package='org.overture.ast.definitions'
	|	 [location]:location 
	|	 (name):LexNameToken // try out () 
	|	 [nameScope]:nameScope 
	|	 [used]:java_Boolean 
	|	 (classDefinition):definition.#class 
	|	 [access]:accessSpecifier.accessSpecifier
	|	 (type):type 
	|	 [pass]:Pass}
    =   {assignment} [expression]:exp (expType):type
    |   {instanceVariable} [expression]:exp (expType):type [initialized]:java_Boolean [oldname]:LexNameToken //this actually inherits assignment in Nicks tree
    |   #class 
    |   {classInvariant}  [expression]:exp
    |   {equals} [pattern]:pattern [typebind]:bind.type [setbind]:bind.set [seqbind]:bind.seq [test]:exp 
                 (expType):type (defType):type [defs]:definition*
  	|	#Function
  	|   {external} (state):definition [readOnly]:java_Boolean (oldname):LexNameToken
    |	#Operation
                                                        
    |   {imported} (def):definition (name):LexNameToken
    |   {inherited} (superdef):definition [oldname]:LexNameToken //is access missing here
    |   {local} [valueDefinition]:java_Boolean (name):LexNameToken
    |   {multiBindList} (bindings):multipleBind* (defs):definition*
    |   {mutexSync} [operations]:LexNameToken*
    |   {namedTrace} [pathname]:clonableString* [terms]:term.traceDefinition*//Why is this not a definition
    |   {perSync} [opname]:LexNameToken [guard]:exp
    |   {renamed}  (def):definition 
    |   {state} [fields]:field.field* 
                [invPattern]:pattern [invExpression]:exp (invdef):definition.#Function.explicit
                [initPattern]:pattern [initExpression]:exp (initdef):definition.#Function.explicit
                (stateDefs):definition* [recordDefinition]:definition.local (recordType):type
                (canBeExecuted):java_Boolean //This should properly not be here, this is interpreter stuff else it should be added for all other nodes as well
                 
    |   {thread} [statement]:stm [operationName]:LexNameToken [operationDef]:definition.#Operation.explicit
    |   {type} (invType):type.#invariant [invPattern]:pattern [invExpression]:exp 
               [invdef]:definition.#Function.explicit [infinite]:java_Boolean (name):LexNameToken//is access missing here
               (composeDefinitions):definition*
    |   {untyped}
    |   {value} [pattern]:pattern [expression]:exp [defs]:definition* (expType):type //is access missing here
    ;
    
#Function {-> package='org.overture.ast.definitions'
	|	[typeParams]:LexNameToken* 
	|  	(body):exp
    |   [precondition]:exp 
    |   [postcondition]:exp 
    |   [measure]:LexNameToken
    |	(predef):definition.#Function.explicit 
    |   (postdef):definition.#Function.explicit
    |   (measureDef):definition
    |	(recursive):java_Boolean
	|	(isUndefined):java_Boolean
	|	(measureLexical):java_Integer
	|	(expectedResult):type
	|	(actualResult):type
	//|	 (type):type.function ASTCreater todo
	}
	=	{explicit}
            [paramPatternList]:pattern**
            (type):type.function // should be at parent level
            (paramDefinitionList):definition*
            (isTypeInvariant):java_Boolean
            (isCurried):java_Boolean 
            (typeInvariant):java_Boolean
            //[poluFuncs]:???Map
                            
    
    |   {implicit}
            [paramPatterns]:pair.patternListType*
            [result]:pair.patternType
            (type):type.function // should be at parent level
            //[poluFuncs]:???Map
	;
    
#Operation  {-> package='org.overture.ast.definitions'
	|	[body]:stm	
	|	[precondition]:exp 
	|	[postcondition]:exp
	//|	(type):type -- ASTCreator-1.4.4 cannot handle this. Also fix the case
	|	(predef):definition.#Function.explicit
    |   (postdef):definition.#Function.explicit
    |	(state):definition.state
    |	(actualResult):type
    |	[isConstructor]:java_Boolean
    }
	=	{explicit}
			[parameterPatterns]:pattern* 
            (paramDefinitions):definition*
                            
    |	{implicit}
    		[parameterPatterns]:pair.patternListType*
            [result]:pair.patternType
            [externals]:clause.external*
            [errors]:case.error*
            (stateDefinition):definition
     ;
 
/*
 * Trace defintions which is not definitions...
 */  
 
term {-> package='org.overture.ast.definitions.traces'}
    =   {traceDefinition} [list]:traceDefinition*
    ;
    
traceDefinition {-> package='org.overture.ast.definitions.traces'
	|	[location]:location}
    =   {instance}
    |   {letBeStBinding} [bind]:multipleBind [stexp]:exp [body]:traceDefinition [def]:definition.multiBindList
    |   {letDefBinding} [localDefs]:definition* [body]:traceDefinition
    |   {repeat} [core]:traceCoreDefinition [from]:java_Long [to]:java_Long
    ;
    
traceCoreDefinition {-> package='org.overture.ast.definitions.traces'
	|	[location]:location}
    =   {applyExpression} [callStatement]:stm [currentModule]:java_String
    |   {bracketedExpression} [terms]:term.traceDefinition*
    |   {concurrentExpression} [defs]:traceDefinition*
    ;
//trace end....

#class {-> package='org.overture.ast.definitions'
	| (supertypes):type* 
	| (supernames):LexNameToken*// try out () 
	| (definitions):definition* 
	| (allInheritedDefinitions):definition*
	| (localInheritedDefinitions):definition* 
	| [hasContructors]:java_Boolean
	| [settingHierarchy]:ClassDefinitionSettings
	| (superDefs):definition.#class*
	| [gettingInheritable]:java_Boolean
	| (superInheritedDefinitions):definition*
	| [gettingInvDefs]:java_Boolean
	| [isAbstract]:java_Boolean
	| [isUndefined]:java_Boolean
	| (classtype):type
	| (typeChecked):java_Boolean
	| (invariant):definition.#Operation.explicit}
    = {bus} (instance):definition.#class.bus
    | {cpu}
    | {system}
    | {class}//Hmm we cant instanciate SClassDefinition...
    ;

modules {-> package='org.overture.ast.modules'}
    = {module}  [name]:LexIdentifierToken 
                [imports]:imports.module
                [exports]:exports.module
                [defs]:definition*
                [files]:clonableFile*
                (importdefs):definition*
                (exportdefs):definition*
              // [delegate]:Delegate
              	[isFlat]:java_Boolean
                (typeChecked):java_Boolean
                [isDLModule]:java_Boolean //The typechecker needs to know this, since the actual exports does not exists in a DLModule
    ;


imports {-> package='org.overture.ast.modules'} 
    = {module} [name]:LexIdentifierToken [imports]:imports.fromModule* //no root
    | {fromModule} [name]:LexIdentifierToken [signatures]:import** //no root
//    | {signatures} [importList]:import*
    ;
    
import {-> package='org.overture.ast.modules'
	|	[location]:location 
	|	[name]:LexNameToken 
	|	[renamed]:LexNameToken 
	|	(from):modules.module}
    =   {all}
    |   {type} [def]:definition.type
    |   #value
    ;
    
#value {-> package='org.overture.ast.modules'
	|	(importType):type}
    =   {value}//since we cant instanciate #value
    |   {function} [typeParams]:LexNameToken*
    |   {operation}
    ;
    
    
exports {-> package='org.overture.ast.modules'}
    =   {module} [exports]:export**
    ;

export {-> package='org.overture.ast.modules'
	|	[location]:location 
	|	[definition]:definition*}
    =   {all}
    |   {function} [nameList]:LexNameToken* (exportType):type [typeParams]:LexNameToken*
    |   {operation} [nameList]:LexNameToken* (exportType):type
    |   {type} [name]:LexNameToken [struct]:java_Boolean
    |   {value} [nameList]:LexNameToken* (exportType):type
    ;
    
/*
    Statements
*/

stm {-> package='org.overture.ast.statements'
	|	[location]:location 
	|	(type):type}
    =   {always} [always]:stm [body]:stm
    |   {assignment} [target]:stateDesignator [exp]:exp (targetType):type (expType):type 
                     (classDefinition):definition.#class (stateDefinition):definition.state (inConstructor):java_Boolean
    |   {atomic} [assignments]:stm.assignment* (statedef):definition.state 
    |   {callObject} [designator]:objectDesignator [classname]:LexNameToken [fieldname]:LexIdentifierToken 
                     [field]:LexNameToken [args]:exp* [explicit]:java_Boolean
    |   {call} [name]:LexNameToken [args]:exp* (rootdef):definition
    |   {cases} [exp]:exp [cases]:alternativeStm.case* [others]:stm
    |   {classInvariant} [name]:LexNameToken (invDefs):definition*
    |   {cycles} [cycles]:exp [statement]:stm (value):java_Long
    |   {duration} [duration]:exp [statement]:stm (step):java_Long
    |   {elseIf} [elseIf]:exp [thenStm]:stm
    |   {error}
    |   {exit} [expression]:exp (expType):type
    |   {forAll} [pattern]:pattern [set]:exp [statement]:stm
    |   {forIndex} [var]:LexNameToken [from]:exp [to]:exp [by]:exp [statement]:stm
    |   {forPatternBind} [patternBind]:patternBind.def [reverse]:java_Boolean [exp]:exp [statement]:stm (seqType):type.#seq
    |   {if} [ifExp]:exp [thenStm]:stm [elseIf]:stm.elseIf* [elseStm]:stm
    |   {letBeSt} [bind]:multipleBind [suchThat]:exp [statement]:stm (def):definition.multiBindList
    |	{let} [localDefs]:definition* [statement]:stm
    |   {notYetSpecified} [opname]:LexNameToken [args]:exp* /* FIXME -- these params are probably useless */
    |   {return} [expression]:exp
    |   #SimpleBlock
    |   {skip}
    |   {specification} [externals]:clause.external* [precondition]:exp [postcondition]:exp [errors]:case.error*
    |   {start} [obj]:exp
    |   {stop} [obj]:exp
    |   {subclassResponsibility}
    |   {tixe} [traps]:stmtAlternative.tixe* [body]:stm
    |   {trap} [patternBind]:patternBind.def [with]:stm [body]:stm
    |   {while} [exp]:exp [statement]:stm
    |   {periodic} [opname]:LexNameToken [args]:exp* (period):java_Long (jitter):java_Long (delay):java_Long (offset):java_Long
    |   {sporadic} [opname]:LexNameToken [args]:exp* (minDelay):java_Long (maxDelay):java_Long (offset):java_Long
    ; 
    
#SimpleBlock {-> package='org.overture.ast.statements'
	|	[statements]:stm*}
    =   {block} [assignmentDefs]:definition.assignment*
    |   {nonDeterministic}
    ;
    
stateDesignator {-> package='org.overture.ast.statements'
	|	[location]:location 
	|	(type):type}
    =   {field} [object]:stateDesignator [field]:LexIdentifierToken (objectfield):LexNameToken
    |   {identifier} [name]:LexNameToken
    |   {mapSeq} [mapseq]:stateDesignator [exp]:exp (mapType):type.#Map (seqType):type.#seq
    ;
    
objectDesignator {-> package='org.overture.ast.statements'
	|	[location]:location}
    =   {apply} [object]:objectDesignator [args]:exp*
    |   {field} [object]:objectDesignator [className]:LexNameToken [fieldName]:LexIdentifierToken (field):LexNameToken
    |   {identifier} [name]:LexNameToken [expression]:exp.variable
    |   {new} [expression]:exp.new
    |   {self} [self]:LexNameToken
    ;

/* jwc - why is cexp in this, anyway? (FIXME?) cexp is the expression in the parent cases statement */
alternativeStm {-> package='org.overture.ast.statements'}
    = {case} [location]:location [cexp]:exp [pattern]:pattern [result]:stm (defs):definition* (ctype):type 
    ;
    
stmtAlternative {-> package='org.overture.ast.statements'}
    = {tixe} [patternBind]:patternBind.def [statement]:stm (exp):type
    ;
    
clause {-> package='org.overture.ast.statements'}
    = {external} [mode]:LexToken [identifiers]:LexNameToken* (type):type
    ;
    
case {-> package='org.overture.ast.statements'}
    = {error} [name]:LexIdentifierToken [left]:exp [right]:exp
    ;
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy