feat(dsl): movement actions, the map file and scena-run .osc (p8-s1) - #108
Merged
Conversation
Completes p8-s1: a DSL scenario now runs end to end.
Seven §8.8 movement actions lower onto the runtime actions P2/P5 already
implement — assign_speed, change_speed, remain_stationary, assign_position,
change_lane, change_space_gap, change_time_gap. The generic move/drive/walk
carry no target of their own and lower to nothing, because they exist to be
shaped by §8.9 modifiers (p8-s3); every other §8.8 action is reported by name
rather than silently dropped.
The `do` directive becomes one Story, one Act and one ManeuverGroup per phase.
`serial` chains a phase on its predecessor reaching completeState (§7.6.2.1.2),
`parallel` leaves the triggers absent (§7.6.1.1); one_of, nesting, until, wait,
emit, call and an invocation duration are reported and belong to p8-s2.
§8.5.4's map_file is read in both spellings the standard prints —
`map.set_map_file("m.xodr")` (Code 61) and `keep(my_map.map_file == "...")`
(Code 62) — and travels beside the IR in a LowerResult, mirroring
xml::Document, because a road-network path is a host input and not kernel
state (ADR-0003).
The first spelling needed one resolution rule the checker did not have: a bare
actor type name is a receiver in its own right, since the map is a singleton no
scenario declares a field for. Without it the standard's own concrete-scenario
example (Code 6) was rejected. A declared field of the same name still wins.
scena-run picks its frontend from the extension: .osc goes to the DSL frontend,
everything else to XML, and past the load only the Scenario IR is visible.
--entry names the §7.7.2 entry point and -I adds an import search path.
ADR-0030 gains decisions 6-8; the coverage matrix, the scena-run user guide and
the DSL frontend README move with them. The parity audit now reads lower.h as
well, so dsl::lower's missing binding is recorded rather than invisible.
1366 gtest (+27), 194 pytest.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes p8-s1: a DSL scenario now runs end to end.
§8.8 movement actions → IR actions
Seven have an unambiguous counterpart and lower; the runtime is the one both
frontends already share, so lowering decides only which IR action a DSL action
is.
assign_speedSpeedAction, Stepchange_speedSpeedActionwith the transition §8.8.2.18 asks forremain_stationarySpeedActionto zeroassign_positionTeleportActionto aWorldPositionchange_laneLaneChangeActionwith aRelativeTargetLanechange_space_gap/change_time_gapLongitudinalDistanceActionmove,driveandwalkcarry no target of their own — they exist to beshaped by §8.9 modifiers (p8-s3) — so on their own they lower to nothing.
Everything else in §8.8 is reported by name, never silently dropped.
Two readings the standard does not state, both recorded in ADR-0030:
dynamic_profilenames a shape,rate_peaka magnitude, and neither is aduration. With no peak rate there is no number to ramp over, so the change
is a Step (§7.4.1.2).
asapis a Step from the other direction: §8.7declares no performance envelope, so "as soon as possible" is bounded by
nothing.
change_laneneeds an explicitleftorright. §8.8.3.14'sinside,outsideandsameneed road geometry to say which way that is, and anunstated side would have to be chosen — which the determinism contract
does not allow.
The
dodirective → a storyboardOne Story, one Act, one ManeuverGroup per phase — the group is where an actor
lives, so a group per phase keeps each invocation's actor with its actions.
serialchains a phase on its predecessor reaching completeState, which is thetrigger form §7.6.2.1.2's "starts when its predecessor ends" already has in the
runtime;
parallelleaves the triggers absent (§7.6.1.1).one_of, nesting,until,wait,emit,calland an invocationdurationare reported andbelong to p8-s2.
The map file, and one resolution rule it needed
§8.5.4's
map_fileis read in both spellings the standard prints —map.set_map_file("m.xodr")(Code 61) andkeep(my_map.map_file == "m.xodr")(Code 62) — and travels beside the IR in a
LowerResult, mirroringxml::Document. A road-network path is an input to the host, not kernelstate: the engine reaches roads only through
IRoadQuery(ADR-0003).The first spelling needed something the checker did not have: a bare actor
type name is a receiver in its own right.
mapin Code 61 names the actortype, because the road network is a singleton no scenario declares a field
for, and without that rule the standard's own concrete-scenario example
(Code 6) was rejected. A declared field of the same name still wins — the
receiver a reader means by a name is the declaration in front of them.
Struct-valued arguments
The DSL has no struct constructor: §7.2.2.6.7 declares list and range
constructors and nothing else. So
assign_position(position: start)can onlyname a declaration, and the
keeps on it are where the numbers are — the samebinding table ADR-0030 already uses for an actor's own attributes, applied one
level further out. A coordinate nothing constrains is reported, not assumed.
scena-runruns.oscThe extension picks the frontend; everything past the load sees only the
Scenario IR, so the options, exit codes and trace format are unchanged.
--entrynames the §7.7.2 entry point (a file with several scenarios isreported, never guessed at) and
-Iadds an import search path.Tests and docs
dsl_lowering_test.cpp17 → 37: each action's mapping, the storyboard shape,both map-file spellings, and every deferral reported rather than dropped.
dsl_types_test.cpp+3: the actor-type receiver, a field shadowing it, and anon-actor type still getting the ordinary "that is a type, not a value".
scena_run_test.cpp+4: a.oscrunning end to end,--entryselection, amalformed
.osc, and the DSL-named road network.matrix, the
scena-runuser guide and the DSL frontend README move with thecode.
lower.has well, sodsl::lower's missingbinding is recorded with its reason instead of being invisible — the IR has
no binding carrier until p8-s4 ([p8-s4] XML-DSL parity & DSL golden scenarios #47).
1366 gtest (+27), 194 pytest.
Closes #44