Skip to content

Rewrite Go library to faithfully port TypeScript architecture#40

Merged
rjrodger merged 1 commit intomasterfrom
claude/go-library-implementation-4H449
Feb 28, 2026
Merged

Rewrite Go library to faithfully port TypeScript architecture#40
rjrodger merged 1 commit intomasterfrom
claude/go-library-implementation-4H449

Conversation

@rjrodger
Copy link
Collaborator

No description provided.

Replace the previous recursive descent parser with the same matcher-based
lexer and rule-based parser architecture as the TypeScript implementation:

- Matcher-based lexer: fixed, space, line, string, comment, number, text
  matchers tried in order, with IGNORE token skipping
- Rule engine: Rule/RuleSpec/AltSpec with open/close states, push/replace/pop
  stack operations, 2-token lookahead, counter methods (Eq/Lt/Gt/Lte/Gte)
- Grammar: val/map/list/pair/elem rules with exact alternate orderings
  matching the TypeScript JSON phase + Jsonic extension phase (including
  unshift vs push semantics, modlist delete/move operations)
- Undefined sentinel to distinguish "no value" from nil (null), matching
  TypeScript's undefined vs null semantics
- Slice propagation: elem.BC propagates updated slices to parent list
  rule to handle Go's append semantics (vs JS reference-type arrays)
- Result chain following: parser follows replacement chain to find the
  actual result rule for implicit list cases

All 30 TSV spec tests pass (26 parser + 4 utility).

https://claude.ai/code/session_01FUyByRfJWUvyPkFoLZ5z6H
@rjrodger rjrodger merged commit 801aaaa into master Feb 28, 2026
0 of 10 checks passed
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.

2 participants