Repository Implementation Plan
This page is the canonical preserved copy of the older repository-level implementation plan.
Status: summary/reference only.
The authoritative current plan is
implementation_plan_from_requirements.md.
Siemens-Compatible Parser and Runtime
1. Goal
Turn PRD Section 5 requirements into incremental, testable code changes while
keeping main stable and each PR small.
Inputs:
../../product/prd/index.mdarchitecture.md../../project/backlog.md(T-037..T-047)- acceptance fixture:
testdata/integration/simple_integrated_case.ngc
2. Delivery Strategy
Principles:
- Build shared infrastructure first (modal/config/policy scaffolding).
- Then add one feature family per slice.
- Keep strict test-first and
./dev/check.shgreen at each step. - PRs are created only; merge after explicit user approval.
- Model every machine-carried behavior as an explicit executable instruction; decide per-instruction execution transport (motion packet vs runtime control).
3. Phase Plan
Phase A — Foundation (architecture scaffolding)
Target outcomes:
- explicit modal registry with group IDs
- machine profile/config objects
- policy interfaces (tool/M-code/runtime hooks)
Planned tasks:
T-041(feed model architecture; supplies modal/group scaffolding)T-042(dimensions/units architecture integration)
Expected code touch points:
src/new files:modal_registry.h/.cppmodal_engine.h/.cppmachine_profile.h/.cppruntime_policy.h/.cpp
- existing:
src/ail.h,src/ail.cppsrc/ast.h(state-carrying metadata expansions)
Tests:
- new
test/modal_engine_tests.cpp - new
test/machine_profile_tests.cpp
Phase B — Syntax and normalization extensions
Target outcomes:
- parser coverage for required syntax families and normalized statement schema.
Planned tasks:
T-037comments ((*...*),;, optional//compatibility mode)T-046M-code syntax + normalization baselineT-045rapid-traverse syntax/state (G0,RTLION,RTLIOF)
Expected code touch points:
grammar/GCode.g4src/gcode_parser.cppsrc/semantic_rules.cppsrc/semantic_normalizer.h/.cpp(new)
Tests:
test/parser_tests.cppadditions- parser/CLI golden updates in
testdata/
Phase C — Modal behavior integration
Target outcomes:
- modal groups represented and validated centrally with deterministic conflict handling.
Planned tasks:
T-039Group 7T-040working planeT-044Groups 10/11/12T-043Group 8 offsets/suppress contexts- complete Group 14/13 and Group 15 behavior from
T-041/T-042
Expected code touch points:
src/modal_engine.*src/ail.cppsrc/messages*.cppsrc/packet*.cpp
Tests:
test/modal_engine_tests.cpptest/ail_tests.cpptest/ail_executor_tests.cpp- targeted new suites:
test/work_offset_tests.cpptest/feed_mode_tests.cpptest/transition_mode_tests.cpp
Phase D — Tool/runtime behavior
Target outcomes:
- configurable Siemens-style tool behavior and runtime-executable semantics.
Planned tasks:
T-038tool-change semantics with/without tool managementT-046runtime-executable M-code subset mapping
Expected code touch points:
src/ail.cpp,src/ail.hsrc/runtime_policy.*- possible new
src/tool_policy.*,src/mcode_policy.*
Tests:
test/tool_change_tests.cpp(new)test/mcode_tests.cpp(new)- executor integration tests
4. Backlog Dependency Order
Recommended execution order:
T-041feed model architecture (introduce modal/config scaffold)T-042dimensions/units architecture (Group 13/14 integration)T-037comments syntax completionT-046M-code syntax/model baselineT-045rapid traverse modelT-039Group 7 compensation stateT-040plane selection stateT-044exact-stop/continuous-path stateT-043work offsets and suppression contextsT-038tool change + tool management policiesT-047incremental parse session API
Reasoning:
- Steps 1-2 create common state/config foundation.
- Steps 3-5 strengthen syntax/model inputs.
- Steps 6-9 implement grouped modal behavior.
- Step 10 applies the most machine-dependent runtime semantics last.
5. PR Slicing Policy
For each task:
- one narrow behavior slice
- tests first/with code
- docs updated in same PR (
../../product/spec/index.md,CHANGELOG_AGENT.md, optionally../../product/prd/index.md) - evidence of
./dev/check.shpass
Suggested PR size:
- 200-500 LOC preferred
- avoid mixing unrelated modal groups in one PR
6. Validation Matrix (minimum per feature)
- Parser tests:
- syntax acceptance/rejection
- source-location diagnostics
- AIL tests:
- normalized instruction shape
- modal metadata correctness
- Executor tests:
- runtime branch/state behavior where applicable
- CLI tests:
- stable debug/json outputs if schemas change
- Integration fixture:
- run parse + ail/lower on
testdata/integration/simple_integrated_case.ngc - compare key invariants (no unintended diagnostics, stable line mapping, expected modal/motion/control items present)
- run parse + ail/lower on
7. Risk and Mitigation
Risk:
- Modal logic spread across parser/lowering/runtime causing regressions. Mitigation:
- centralize modal transitions in modal engine; add unit tests before feature rollout.
Risk:
- machine-specific semantics hardcoded too early. Mitigation:
- require
MachineProfile+ policy interfaces before advanced features.
Risk:
- golden fixture churn. Mitigation:
- update goldens only in focused PRs and include change rationale.
8. Review Checklist (per PR)
- requirement trace to PRD subsection
- architecture alignment with
architecture.md - tests added/updated and meaningful
./dev/check.shgreen- no unintended schema break without doc updates