Fix hyperscript conformance: 54/112 passing (was 31/81 baseline)

Runtime visibility fix:
- eval-hs now injects runtime helpers (hs-add, hs-falsy?, hs-strict-eq,
  hs-type-check, hs-matches?, hs-contains?, hs-coerce) via outer let
  binding so the tree-walker evaluator can resolve them

Parser fixes:
- null/undefined: return (null-literal) AST node instead of bare nil
  (nil was indistinguishable from "no parse result" sentinel)
- === / !== tokenized as single 3-char operators
- mod operator: emit (modulo) instead of (%) — modulo is a real primitive

Compiler fixes:
- null-literal → nil
- % → modulo
- contains? → hs-contains? (avoids tree-walker primitive arity conflict)

Runtime additions:
- hs-contains?: wraps list membership + string containment

Tokenizer:
- Added keywords: a, an (removed — broke all tokenization), exist
- Triple operators: === and !== now tokenized correctly

Scorecard: 54/112 test groups passing, +23 from baseline.
Unlocked: really-equals, english comparisons, is-in, null is empty,
null exists, type checks, strict equality, mod.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-08 19:46:42 +00:00
parent 2278443182
commit 1f7f47b4c1
6 changed files with 471 additions and 779 deletions

View File

@@ -112,9 +112,9 @@
((and (= typ "keyword") (= val "true")) (do (adv!) true))
((and (= typ "keyword") (= val "false")) (do (adv!) false))
((and (= typ "keyword") (or (= val "null") (= val "nil")))
(do (adv!) nil))
(do (adv!) (list (quote null-literal))))
((and (= typ "keyword") (= val "undefined"))
(do (adv!) nil))
(do (adv!) (list (quote null-literal))))
((and (= typ "keyword") (= val "not"))
(do (adv!) (list (quote not) (parse-expr))))
((and (= typ "keyword") (= val "no"))