purrr/forth-begin.ss
#lang scheme/base



(provide
 forth-begin
 forth-module-begin)

(require
 "../tools.ss"
 "../target.ss"
 "../comp.ss"   ;; target-compile and wrap/...
 "../scat.ss"
 (for-syntax
  "../macro-tx.ss"
  "forth-begin-tx.ss"
  scheme/base))


;; SPECIALIZED

;; These are just examples bound to the 'macro compiler.
(define-syntax (forth-module-begin stx)
  (with-macro-syntax ;; FIXME: lift this out of the driver.
   (lambda ()
     (let ((module-name
            (syntax-property
             stx 'enclosing-module-name)))
       #`(#%plain-module-begin
          #,(forth-begin-tx stx
                            '((provide (all-defined-out)))
                            #'register-code))))))

(define-syntax (forth-begin stx)
  (with-macro-syntax ;; FIXME: lift this out of the driver.
   (lambda ()
     (forth-begin-tx stx '() #'register-code))))