Skip to content

vms-9f6: real LIB$TABLE_PARSE / LIB$TPARSE TPARSE engine (RTL prereq for MMK + vms-486) - #409

Merged
baron-3dl merged 1 commit into
mainfrom
vms-9f6-lib-tparse
Aug 13, 2026
Merged

baron-3dl merged 1 commit into
mainfrom
vms-9f6-lib-tparse

Conversation

@baron-3dl

Copy link
Copy Markdown
Contributor

vms-9f6 -- replace the lib_tparse.c stub with a real TPARSE engine

Parent: vms-801 (source-compat / RTL coverage). Unblocks the P2 gap in the
self-host MMK spine (docs/design-self-host-mmk-spine.md 1.3): lib$table_parse
was absent and lib$tparse was a 14-line SS$_UNSUPPORTED stub. This blocks
parse_tables.mar -> C (vms-486) and native MMK.

What changed

  • src/libvms/rtl/lib_tparse.c -- real TPARSE finite-state engine. Ordered
    per-state transitions matching literal chars, case-blind keywords (optional
    TPA$M_ABBREV), the TPA$_ special classes (LAMBDA/EOS/ANY/BLANK/ALPHA/DIGIT/
    SYMBOL/STRING/DECIMAL/OCTAL/HEX/UIC), and subexpression calls; token/number
    capture into the TPA block; action-routine callbacks that get the block address
    and whose even (failure) return rejects the transition and backtracks (MMK's
    CHECK_GNU/CHECK_COND gate pattern); TPA$M_BLANKS inter-token blank skipping;
    TPA$_EXIT/TPA$_FAIL/next-state dispatch. Exports both lib$table_parse
    and the lib$tparse alias.
  • src/libvms/include/tpadef.h -- OVMX C table format (TPA_GRAMMAR/TPA_STATE/
    TPA_TRAN, action typedef). The state/key table byte layout is unpublished by
    VSI, so this is labelled an OVMX design choice per Rule 8. It is the format
    vms-486 will target; observable behaviour, not table bytes, is what matches VMS.
  • src/libvms/include/lib$routines.h -- declare lib$table_parse.
  • src/libvms/CMakeLists.txt + src/vmslink/mk_libvms_shr.sh -- add
    rtl/lib_tparse (the shr vector is nm-generated, so both names auto-export).

Clean-room (Rule 8)

Semantics derived only from the public VSI OpenVMS RTL Library Reference
(LIB$TABLE_PARSE / LIB$TPARSE, the TPA$ token classes, the action-routine TPA
block). No VSI/HPE source or binaries consulted.

Tests

  • tests/libvms/test_lib_tparse.c -- five real grammars (UIC parser, a
    SET/SHOW command language, action-driven backtracking, a subexpression, keyword
    abbreviation) driven through lib$table_parse, asserting status + action side
    effects. 23 assertions, all pass.
  • Full Debug ctest: 100% (156 tests, 0 failed) (11 e2e Skipped, pre-existing).
  • Native-link reproduced locally (OVMX_LINK_NATIVE, x86_64 link_native_graph):
    9 artifacts, all EM_X86_64, zero DT_NEEDED; LIBVMS$SHR.EXE .vms$sv now carries
    lib$table_parse + lib$tparse.

Not merged; work item not closed here.

🤖 Generated with Claude Code

…for MMK + vms-486)

Replace the 14-line SS$_UNSUPPORTED stub in src/libvms/rtl/lib_tparse.c with a
real TPARSE finite-state parser, and export the previously-missing
lib$table_parse symbol (plus the lib$tparse alias MMK relies on).

Engine (clean-room from the public VSI RTL Library Reference LIB$TABLE_PARSE
semantics — no VSI source/binaries): ordered per-state transitions matching
literal chars, case-blind keywords (with optional TPA$M_ABBREV abbreviation),
the TPA$_ special classes (LAMBDA/EOS/ANY/BLANK/ALPHA/DIGIT/SYMBOL/STRING/
DECIMAL/OCTAL/HEX/UIC), and subexpression calls; token/number capture into the
TPA block; action-routine callbacks that receive the block address and whose
even (failure) return REJECTS the transition and backtracks (MMK's CHECK_GNU/
CHECK_COND gate pattern); TPA$M_BLANKS inter-token blank skipping; and
TPA$_EXIT/TPA$_FAIL/next-state dispatch.

The in-memory state/key table LAYOUT is not published by VSI, so tpadef.h
defines OVMX's own representation (TPA_GRAMMAR/TPA_STATE/TPA_TRAN), labelled an
OVMX design choice per Rule 8. This is the C table format the parse_tables.mar
-> C port (vms-486) will target; behaviour, not table bytes, is what matches VMS.

Wiring:
- rtl/lib_tparse.c added to src/libvms/CMakeLists.txt and to the LIST in
  src/vmslink/mk_libvms_shr.sh (the vector is nm-generated, so both lib$-names
  auto-export). Verified: OVMX_LINK_NATIVE x86_64 link_native_graph builds all
  9 artifacts (EM_X86_64, zero DT_NEEDED) and LIBVMS$SHR.EXE's .vms$sv now
  carries lib$table_parse + lib$tparse.
- lib$table_parse declared in lib$routines.h alongside lib$tparse.

Test: tests/libvms/test_lib_tparse.c drives five real grammars (UIC parser,
a SET/SHOW command language, action-driven backtracking, a subexpression, and
keyword abbreviation) through lib$table_parse and asserts status + action side
effects (23 assertions, all pass). Full Debug ctest: 100% (156 tests, 0 fail).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@baron-3dl
baron-3dl merged commit bed6e7f into main Aug 13, 2026
60 checks passed
baron-3dl added a commit that referenced this pull request Aug 13, 2026
#445)

Bump OVMX_PRODUCT_VERSION V0.4 → V0.4-1. 24 PRs / 32 commits since V0.4,
packed across dimensions (point release toward the 0.5 milestone):

  self-host (R7)  #409 lib$tparse · #411 CLI$ compiled-CLD · #413 sys$setddir
                  #414 lib$get_foreign · #415 sys$filescan (RTL foundation)
                  #418 parse_tables.mar→C (spine #2) · #429 LIBRARIAN.EXE+.OLB (spine #3)
                  #435 shareable-vector freeze (GSMATCH stability)
  authenticity    #421 veracity rubric (Q1 oracle-source/Q2 real-inject) · #424 30 oracle-pinned constants
                  #433 rmsdef.h 74 fabricated RMS codes → oracle
  UX/DCL/RMS      #422 SHOW CLUSTER real membership · #441 DCL per-@-level local scope
                  #442 RMS XAB dates → VMS 1858-epoch quadword
  networking      #419 virtio NIC (user-mode default + opt-in tap/bridge)
  docs            #423 clustering release train
  + swept: other threads' merged work on main since V0.4

Clustering config-authoring UX (vms-098) + its public-manual grounding gate
remain 0.5 (minor) deliverables — not triggered by this point cut.

Co-authored-by: alice <alice@workspace.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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