tn action 11 Parse Elevator Tech Note - modelint/shlaer-mellor-metamodel GitHub Wiki
mint.sm-meta.action.tn.11 / Leon Starr / Version 0.1.0 / 22-8-10
Here we stress test our action language subsystem by roughly parsing some Scrall taken from the Elevator Case Study and see if it can be accommodated.
This is a method on the Cabin class. Starting with the first line...
calling fname, calling height = Floor( Name: in.calling floor ).(Name, Height)
We break this into a few pieces. Let's start with the incoming parameter value:
in.calling floor
This is a scalar flow feeding into a selection criteria.
It is matched against an attribute so we have:
<attr> <relop> <scalar flow>
It is apparent that we have two kinds of criteria, ranking and comparison. The criteria above is a comparison.
The other type is ranking:
<ascend><attr>
Here we specify ascending or descending ranking associated with an attribute to select the highest or lowest values.
The selection subsystem needs to be updated accordingly.
Now we look at the entire selection action:
Floor( Name: in.calling floor ).(Name, Height)
Here we see that two attributes are projected. It does not appear that the attribute projection is modeled. It should be part of the selection subsystem.
The selection action yields a tuple. We know this becaue it matches an identifier of the class.
We also know because the assignment operator assigns scalar flows and those must originate from a tuple, not a table value.
Two scalar flows are extracted from the tuple, one per attribute.
calling up!calling down = (in.service dir == .up)
This bit of Scrall performs a comparison which outputs a boolean result. Two scalar flows are output, one matching the condition of the expression and the other is the opposite (true false or false true)
cabin high = (cabin height > calling height)
behind the call arrow = ( cabin low and calling up ) or ( cabin high and calling down )
In both statements above we flow a scalar out of a computation
We need a place in the action semantics where computations can be expressed.
countable aslevs ..= aslevs by height(Height: cabin fheight<>calling fheight)
This needs to be expanded by Scrall into:
(Height > calling fheight and Height < cabin fheight)
Before parsing into the action semantics