feat(dsl): standard library — movement actions (p7-s5) - #102
Merged
Conversation
Translates §8.8.2–§8.8.4 into bundled DSL source: fifteen actions for `movable_object`, thirteen for `vehicle`, `walk` for `person`, and the four enums they use. Also declares `action_for_vehicle` and `action_for_person`. §8.8.1 gives `osc_action` exactly two children, then §8.8.3 and §8.8.4 name these two as parents without any table declaring them; §8.8.1's prose supplies them — actions for actors below `movable_object` inherit `action_for_movable_object`. Fourteen actions would otherwise have no parent to name. Judgement calls, all recorded in the worksheet: - Mutually exclusive parameters are still plain fields. §8.8.2.4 says "use only one of the three"; `replay_path` marks both `absolute` and `relative` mandatory though only one can be given. The language has no choice group and §7.3.11 already lets a scenario leave a field unconstrained. - `change_position.target_xyz` is marked deprecated in the same row that declares it. It is declared: there is no deprecation marker in the language, and dropping a field the standard prints would reject a conforming scenario. - `change_lane.reference` documents `Default=it.actor`, which is not a constant expression, so no default is declared. - The `change_*`/`keep_*` gap pairs take different direction enums — `gap_direction` has six values, `road_distance_direction` two. Carried as printed and pinned, because it reads like an oversight. `change_speed`, `keep_speed` and `change_lane` are actions here and modifiers in §8.9. They do not collide: an action's name is a qualified behavior name (§7.2.2.2.5), so this chapter declares `movable_object.change_speed` while §8.9 will declare a plain `change_speed`. Pinned in both directions so the next slice cannot blur it. The worksheet README now records the reading technique that made this chapter tractable: §8.8 is 2190 lines, of which 725 are normative tables and the rest worked examples. Dropping the Examples subsections first is the difference between "too big for one sitting" and "one sitting". 1278 gtest (+8), 184 pytest. The library still checks with zero diagnostics of any severity. Refs #43
8 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.
Slice 43f of #43. §8.8.2–§8.8.4 as bundled DSL source: 15 actions for
movable_object, 13 forvehicle,walkforperson, and the fourenums they use (
dynamic_profile,lane_change_side,gap_direction,headway_direction).Two bases the standard names but never declares
§8.8.1 gives
osc_actionexactly two children,action_for_environmentandaction_for_movable_object(both landed in 43d). §8.8.3 and §8.8.4 then nameaction_for_vehicleandaction_for_personin their "Parents" rows, and notable declares either. §8.8.1's prose supplies them: "Actions for actors that
are children of
movable_object, likevehicleorperson, inherit fromaction_for_movable_object."Fourteen actions would otherwise have no parent to name, so both are declared
here and their placement is pinned by test.
Judgement calls
Each is recorded in the worksheet with the row that forced it.
only one of the three possible arguments";
replay_pathmarks bothabsoluteandrelativemandatory though only one can be supplied. Thelanguage has no choice-group construct, and §7.3.11 already lets a scenario
leave a field unconstrained. Same rule that made every table row a field in
43b.
change_position.target_xyzis marked deprecated in the same row thatdeclares it, in favour of
target_position. Both are declared: there is nodeprecation marker in the language, and dropping a field the standard prints
would reject a conforming scenario. Reporting the deprecation belongs to a
later pass.
change_lane.referencedocumentsDefault=it.actor. A default naming theinvoking actor is not a constant expression, so none is declared — the field
is simply left unconstrained, which is what §7.3.11 already means.
change_*/keep_*gap pairs take different direction enums. Achange_time_gaptakes the six-valuedgap_direction;keep_time_gaptakesthe two-valued
road_distance_direction(§8.7.22). Carried as printed andpinned by
TheChangeAndKeepActionsTakeDifferentDirectionEnums, because itreads like an oversight and someone will otherwise "fix" it.
Actions and modifiers may share a simple name
change_speed,keep_speedandchange_laneare actions here and modifiers in§8.9. They do not collide: an action's name is a qualified behavior name
(§7.2.2.2.5), so this chapter declares
movable_object.change_speedwhile §8.9will declare a plain
change_speed.AnActionAndAModifierMayShareASimpleNamepins both directions — the qualified name exists, the unqualified one does not
yet — so the next slice cannot blur the distinction.
ADirectionLiteralNeedsItsEnumNamecovers the other consequence of thischapter:
leftis now a member of four enums andaheadof two, so §7.3.3'squalification is the normal case rather than the exception.
The reading technique, written down
§8.8 is 2190 lines. Its normative tables are 725 of them; the rest is worked
examples, which are illustrative and not what a translation needs. Dropping the
Examplessubsections before reading is the difference between "too big for onesitting" and "one sitting", and
docs/dev/stdlib-worksheets/README.mdnow saysso with the one-liner that does it.
The examples still earn a second pass — §8.15.10's showed which actor the
traffic-light actions hang off, and §8.12.2's showed
create_routebeing calledwith fewer arguments than it declares — but they are not the first pass.
Tests
frontends/dsl/tests/dsl_stdlib_test.cpp, +8 cases: the intermediate bases andtheir place in the hierarchy; every
movable_object,vehicleandpersonaction with its parent and parameter count; the change/keep direction
asymmetry; the four enums; the deprecated parameter; the action-vs-modifier
name distinction; and the new enum ambiguity in both directions.
1278 gtest (+8), 184 pytest.
TheBundledLibraryChecksCleanstill assertszero diagnostics of any severity.
Docs:
osc-dsl-coverage.md, the new worksheet, and the worksheet README.Refs #43