#lang scheme/base
 "purrr/forth-begin.ss"   ;; parser driver in the form of 'begin' macros.
 "purrr/parsing-words.ss" ;; bindings for (non-concatenative) forth parser words
 "purrr/repl.ss"          ;; string -> toplevel form expansion
 "coma.ss"                ;; single stack pure macros
 "control.ss"             ;; dual stack control macros
 "comp.ss"                ;; compiler (macro instantiation + postprocess)
 "scat.ss"                ;; intermediate language
 "asm.ss"                 ;; for convenience, export assembler interface
 "live.ss"                ;; target interaction

;; Macros defined in .f files use a superset of the macro/2stack
;; language state to implement multiple entry and exit points for
;; instantiated code, and multiple exit for macros. All macro
;; evaluation that's not part of instantiation needs to use this
;; augmented state. (i.e. this is used in macro/constants.ss)

;; The Purrr language all by itself, without specialization to a real
;; machine, is at this moment only useful for debugging.

;; Printing reverses the standard reversed order.
(define (print-asm-code chains)
   (lambda (x)
     (print-target-word x)
   (reverse chains)))

;; Since 'repl' can't run inside a parameterize env (this is because
;; of the use of toplevel forms), the only way to change what happens
;; to compiled code is to change the mode of the compiler.

(define (asm-debug!)
    (lambda (chains . _)
      (print-asm-code chains)))))


(loading "purrr")