#lang scheme/base
(require
"../coma/macro.ss"
"../forth/forth-lex.ss"
"state.ss")
(provide macro> forth-compile
(ns-out (macro) clear))
(define *state* #f)
(define (new-state) (state:compiler))
(define (update-state [s (new-state)]) (set! *state* s))
(define (print-state) (comp-print-state *state*))
(update-state)
(define-syntax-rule (macro> . code)
(begin
(update-state ((macro: . code) *state*))
(print-state)))
(define-syntax-rule (forth-compile str)
(forth-lex-string/cps macro> str))
(ns (macro) (define (clear state) (new-state)))