diff --git a/beautiful-racket-demo/basic-demo/expander0.rkt b/beautiful-racket-demo/basic-demo/expander-runtime-errors.rkt similarity index 100% rename from beautiful-racket-demo/basic-demo/expander0.rkt rename to beautiful-racket-demo/basic-demo/expander-runtime-errors.rkt diff --git a/beautiful-racket-demo/basic-demo/expander.rkt b/beautiful-racket-demo/basic-demo/expander.rkt index 745c9af..b436835 100644 --- a/beautiful-racket-demo/basic-demo/expander.rkt +++ b/beautiful-racket-demo/basic-demo/expander.rkt @@ -18,34 +18,34 @@ (run line-table)))) (provide (rename-out [b-module-begin #%module-begin])) -(struct $program-end-signal ()) -(define (b-end) (raise ($program-end-signal))) +(struct end-program-signal ()) +(struct change-line-signal (val)) -(struct $change-line-signal (val)) -(define (b-goto expr) (raise ($change-line-signal expr))) +(define (b-end) (raise (end-program-signal))) +(define (b-goto num-expr) (raise (change-line-signal num-expr))) (define (run line-table) (define line-vec (list->vector (sort (hash-keys line-table) <))) - (with-handlers ([$program-end-signal? void]) + (with-handlers ([end-program-signal? (λ (exn-val) (void))]) (for/fold ([line-idx 0]) - ([i (in-naturals)]) - (unless (< line-idx (vector-length line-vec)) (b-end)) + ([i (in-naturals)] + #:break (>= line-idx (vector-length line-vec))) (define line-num (vector-ref line-vec line-idx)) - (define line-proc (hash-ref line-table line-num)) + (define line-func (hash-ref line-table line-num)) (with-handlers - ([$change-line-signal? + ([change-line-signal? (λ (cls) - (define clsv ($change-line-signal-val cls)) + (define clsv (change-line-signal-val cls)) (or (and (exact-positive-integer? clsv) (vector-member clsv line-vec)) (error (format "error in line ~a: line ~a not found" line-num clsv))))]) - (line-proc) + (line-func) (add1 line-idx))))) -(define b-rem void) +(define (b-rem val) (void)) (define (b-print [val ""]) (displayln val)) (define (b-sum . nums) (apply + nums)) (define (b-num-expr expr) diff --git a/beautiful-racket-demo/basic-demo/info.rkt b/beautiful-racket-demo/basic-demo/info.rkt new file mode 100644 index 0000000..9641805 --- /dev/null +++ b/beautiful-racket-demo/basic-demo/info.rkt @@ -0,0 +1,4 @@ +#lang info + +(define compile-omit-paths 'all) +(define test-omit-paths 'all) \ No newline at end of file