Skip to content

docs(dd): DD-017 RS274NGC parametric programs — Proposed (#189 phase 7) - #263

Merged
sobechestnut-dev merged 1 commit into
devfrom
docs/189-dd017-rs274ngc
Jul 31, 2026
Merged

docs(dd): DD-017 RS274NGC parametric programs — Proposed (#189 phase 7)#263
sobechestnut-dev merged 1 commit into
devfrom
docs/189-dd017-rs274ngc

Conversation

@sobechestnut-dev

Copy link
Copy Markdown

Phase 7, scoped as a DD for your acceptance

The largest remaining #189 gap: real LinuxCNC / CAM output uses the RS274NGC programming layer — parameters (#100 = 5), expressions (X[#1 + 2*sin[30]]), and O-word subroutines/loops/conditionals. The parser lexes these away today (Number('[#1+5]')NaN, dropped), so a parametric program renders partial or empty geometry.

Unlike the laser semantics, this is fully spec-derivable (RS274NGC / NIST IR 6556, as-implemented by LinuxCNC) — build it right from the spec; hardware only re-confirms. But it turns the forward-only line processor into a small interpreter (symbol table + expression evaluator + control flow that re-runs/skips lines), which is architecture-sensitive → DD before code, per governance.

The decisions I'd want your call on

  • D1 (pivotal) — execution model: an on-demand program-buffered interpreter, engaged only when a #, [, or leading O-word is detected. Everything else (all FDM, most simple GRBL/laser CNC) keeps the untouched forward-only fast path → byte-identical. One motion/classification core; the interpreter only feeds resolved lines into it.
  • D5 (required) — bounded execution: RS274NGC is Turing-complete, so two new DD-003 limits — maxProgramIterations (~1M) and maxCallDepth (~50) — so o while [1] or infinite recursion can't hang/OOM the worker. Pure arithmetic evaluator, no eval, no I/O.
  • D2/D3/D4 — parameter store (numbered/named + read-only system subset), the RS274NGC expression grammar, and the O-word subset (sub/call, if, while/do/repeat).
  • D6/D7parametricProgram capability + per-construct disclosure; FDM byte-identical gate + new synthetic parametric goldens.

Non-goals: external subroutine files / Fanuc M98 (no I/O), persistent .var params, machine-config mutation, full conformance.

Four open questions for acceptance are listed in §7 (capability name, limit defaults, system-param allow-list, loop-form scope). Nothing is built — this is Proposed; on acceptance the phased plan (§5) is: (1) expressions+params, (2) O-word flow+limits, (3) subroutines, (4) capability/docs.

Docs-only; links green; added to the DD index.

🤖 Generated with Claude Code

Drafts the design for the largest remaining #189 gap: LinuxCNC/CAM parametric
programs — numbered/named parameters (#100 = 5), expressions (X[#1 + sin[30]]),
and O-word subroutines/loops/conditionals — which the forward-only line
processor drops today.

Key decisions for acceptance (D1–D8):
- D1: on-demand program-buffered interpreter engaged ONLY when #/[ /O-words
  appear; FDM + simple CNC keep the untouched forward-only fast path
  (byte-identical). One motion/classification core; the interpreter only feeds it.
- D5: two new DD-003 limits (maxProgramIterations, maxCallDepth) so a while[1]
  or infinite recursion can't hang/OOM the worker — bounded, no eval, no I/O.
- Spec-derivable from RS274NGC (NIST IR 6556) / LinuxCNC — hardware only
  re-confirms; parity targets only, no spec text copied (RR-004 §6).

Proposed only — architecture-sensitive, so blocked until Accepted per governance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sobechestnut-dev
sobechestnut-dev merged commit 88873bd into dev Jul 31, 2026
4 checks passed
@sobechestnut-dev
sobechestnut-dev deleted the docs/189-dd017-rs274ngc branch July 31, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant