Use distinct token for navigation and namespace
In the current textual syntax the token .
is used both for navigation (ex. anAttacker.location.assign()
)
and for namespace resolution (ex: Building_def.Attacker
)
this may raise ambiguities in the grammar making it difficult to evolve.
It would be more confortable if we use a separate token both these 2 concepts.
A possible implementation would be to keep the .
for navigation and ::
for namespaces.
ex with the proposed syntax:
AssetBasedSystem
//with default_def::*;
//with Building_def::*;
with Building_behavior_def::*;
with ThreeZones_system::*;
DefinitionGroup default_def {
assetTypes {
// root of all assetType ?
AssetType Any {}
}
primitiveDataTypes {
PrimitiveDataType String
PrimitiveDataType Boolean
PrimitiveDataType Integer
EnumDataType DoorState { opened, closed, locked }
}
staticMethods {
StaticMethod contains
StaticMethod containsAll
StaticMethod containsAny
StaticMethod filter
StaticMethod isEmpty
}
tags {
Tag Building
Tag Human
}
}
DefinitionGroup Building_def {
assetTypes {
AssetType Zone {
level "1"
tags ( default_def::Building )
}
AssetType Door {
level "2"
tags ( default_def::Building )
reference inside : Zone
reference outside : Zone
}
AssetType Attacker {
tags (default_def::Building)
//reference testRef : Information [*]
}
}
}
DefinitionGroup Building_behavior_def {
assetTypes {
AssetTypeAspect Building_def::Attacker {
reference location : Building_def::Zone
}
AssetTypeAspect Building_def::Door {
// @runtime
attribute state : default_def::DoorState default default_def::DoorState::locked
}
}
guardedActions {
GuardedAction goes_from_to_via( anAttacker : Building_def::Attacker, startZone : Building_def::Zone, destZone : Building_def::Zone, usedAccess : Building_def::Door ) {
guard = usedAccess.state == default_def::DoorState::opened
action {
anAttacker.location.assign(destZone);
}
}
}
}
the with default_def::*
allowing to shorten the namespace in all the places they are used.