Recover agent-loop progress: lua/prolog/forth/erlang/haskell phases 1-2
Salvaged from worktree-agent-* branches killed during sx-tree MCP outage: - lua: tokenizer + parser + phase-2 transpile (~157 tests) - prolog: tokenizer + parser + unification (72 tests, plan update lost to WIP) - forth: phase-1 reader/interpreter + phase-2 colon/VARIABLE (134 tests) - erlang: tokenizer + parser (114 tests) - haskell: tokenizer + parse tests (43 tests) Cherry-picked file contents only, not branch history, to avoid pulling in unrelated ocaml-vm merge commits that were in those branches' bases.
This commit is contained in:
@@ -54,11 +54,11 @@ Key mappings:
|
||||
## Roadmap
|
||||
|
||||
### Phase 1 — tokenizer + parser + layout rule
|
||||
- [ ] Tokenizer: reserved words, qualified names, operators, numbers (int, float, Rational later), chars/strings, comments (`--` and `{-` nested)
|
||||
- [x] Tokenizer: reserved words, qualified names, operators, numbers (int, float, Rational later), chars/strings, comments (`--` and `{-` nested)
|
||||
- [ ] Layout algorithm: turn indentation into virtual `{`, `;`, `}` tokens per Haskell 98 §10.3
|
||||
- [ ] Parser: modules, imports (stub), top-level decls, type sigs, function clauses with patterns + guards + where-clauses, expressions with operator precedence, lambdas, `let`, `if`, `case`, `do`, list comp, sections
|
||||
- [ ] AST design modelled on GHC's HsSyn at a surface level
|
||||
- [ ] Unit tests in `lib/haskell/tests/parse.sx`
|
||||
- [x] Unit tests in `lib/haskell/tests/parse.sx` (43 tokenizer tests, all green)
|
||||
|
||||
### Phase 2 — desugar + eager-ish eval + ADTs (untyped)
|
||||
- [ ] Desugar: guards → nested `if`s; `where` → `let`; list comp → `concatMap`-based; do-notation stays for now (desugared in phase 3)
|
||||
@@ -107,7 +107,27 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- _(not started)_
|
||||
- **2026-04-24** — Phase 1: Haskell 98 tokenizer (`lib/haskell/tokenizer.sx`, 490 lines)
|
||||
covering idents (lower/upper/qvarid/qconid), 23 reserved words, 11 reserved ops,
|
||||
varsym/consym operator chains, integer/hex/octal/float literals incl. exponent
|
||||
notation, char + string literals with escape sequences, nested `{- ... -}` block
|
||||
comments with depth counter, `-- ... EOL` line comments (respecting the
|
||||
"followed by symbol = not a comment" Haskell 98 rule), backticks, punctuation,
|
||||
and explicit `newline` tokens for the upcoming layout pass. 43 structural tests
|
||||
in `lib/haskell/tests/parse.sx`, a lightweight `hk-deep=?` equality helper
|
||||
and a custom `lib/haskell/test.sh` runner (pipes through the OCaml epoch
|
||||
protocol, falls back to the main-repo build when run from a worktree). 43/43
|
||||
green.
|
||||
|
||||
Also peeked at `/root/rose-ash/sx-haskell/` per briefing: that directory is a
|
||||
Haskell program implementing an **SX interpreter** (Types.hs, Eval.hs,
|
||||
Primitives.hs, etc. — ~2800 lines of .hs) — the *opposite* direction from this
|
||||
project. Nothing to fold in.
|
||||
|
||||
Gotchas hit: `emit!` and `peek` are SX evaluator special forms, so every local
|
||||
helper uses the `hk-` prefix. `cond`/`when`/`let` clauses evaluate ONLY the
|
||||
last expression; multi-expression bodies MUST be wrapped in `(do ...)`. These
|
||||
two together account for all the tokenizer's early crashes.
|
||||
|
||||
## Blockers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user