#lang scheme/base
(require "../tools.ss")
(require/provide "../pic18.ss")
(provide (all-defined-out))
(target-print-word-bytes 2)
(target-print-address-bits 16)
(define (optimize-state optimizer state)
(macro-list->state
(for/list ((macro (state->macro-list state)))
(macro: ,macro ,optimizer))
state:stack))
(define (optimize state . optimizers)
(foldl optimize-state state optimizers))
(define-syntax-rule (code> . code)
(state-print-code
((macro: . code) (state:stack))))
(define-syntax-rule (pic18> . code)
(state-print-code
(optimize ((macro: . code) (state:stack))
(macro: pseudo)
(macro: opti-save))))
(define-syntax-rule (forth> str)
(begin
(forth-compile str)
(code-print)
(code-clear!)))