forth: \, POSTPONE-imm split, >NUMBER, DOES> — Hayes 486→618 (97%)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 03:33:13 +00:00
parent 1b2935828c
commit c28333adb3
7 changed files with 213 additions and 30 deletions

View File

@@ -11,6 +11,7 @@
(define hayes-actual-set false)
(define hayes-failures (list))
(define hayes-first-error "")
(define hayes-error-hist (dict))
(define
hayes-reset!
@@ -23,7 +24,8 @@
(set! hayes-actual (list))
(set! hayes-actual-set false)
(set! hayes-failures (list))
(set! hayes-first-error "")))
(set! hayes-first-error "")
(set! hayes-error-hist (dict))))
(define
hayes-slice
@@ -97,6 +99,25 @@
;; Run a single preprocessed chunk (string of Forth source) on the shared
;; state. Catch any raised error and move on — the chunk boundary is a
;; safe resume point.
(define
hayes-bump-error-key!
(fn
(err)
(let
((msg (str err)))
(let
((space-idx (index-of msg " ")))
(let
((key
(if
(> space-idx 0)
(substr msg 0 space-idx)
msg)))
(dict-set!
hayes-error-hist
key
(+ 1 (or (get hayes-error-hist key) 0))))))))
(define
hayes-run-chunk
(fn
@@ -109,6 +130,7 @@
(when
(= (len hayes-first-error) 0)
(set! hayes-first-error (str err)))
(hayes-bump-error-key! err)
(dict-set! state "dstack" (list))
(dict-set! state "rstack" (list))
(dict-set! state "compiling" false)
@@ -131,4 +153,6 @@
"total"
(+ (+ hayes-pass hayes-fail) hayes-error)
"first-error"
hayes-first-error)))
hayes-first-error
"error-hist"
hayes-error-hist)))