#lang scheme/base

;; postponed code and data


 scat/compile          ;; compile word refernce (struct target-word)
 scat/literal          ;; compile literal value (can be delayed
                       ;; computation depending on address of other
                       ;; struct target-word)

 macro/primitive-exit  ;; compiles procedure exit with proper tail call



;; Macro primitives are just scat words.

(define-sr (macro-prim: . code) (scat: . code))

;;(define-ns (scat) broem
;;  (begin
;;    (lambda (state) state)))

;; These are words that most certainly need to be redefined at some
;; point when mapping to a target architecture. They are used in
;; to implement the core of macro/forth/variable.

 (scat) scat:
 (literal 'qw >tag)
 (compile 'cw >tag))

;; The exit in (macro) is the authoritative one, and should be
;; redefined/extended in target specific code. Tail call elimination
;; is mandatory.
(patterns (macro)
          (([cw a] primitive-exit)  ([jw a]))
          ((primitive-exit)         ([exit])))