Commit b7eaff6b authored by Brian Guadalupe's avatar Brian Guadalupe

Moved debugger invocation to main submodule

parent dda8bf05
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
#:when (tm-label? (tm-line-cmd line))) #:when (tm-label? (tm-line-cmd line)))
(let ([name (tm-label-name (tm-line-cmd line))]) (let ([name (tm-label-name (tm-line-cmd line))])
(if (hash-has-key? labels-set name) (if (hash-has-key? labels-set name)
(error (format "Label name ~v already defined in line ~a" name (hash-ref labels-set name))) (raise-user-error
(format "Label name ~v already defined in line ~a" name (hash-ref labels-set name)))
(hash-set! labels-set name (tm-line-number line))))) (hash-set! labels-set name (tm-line-number line)))))
; Build the label table ; Build the label table
...@@ -68,7 +69,7 @@ ...@@ -68,7 +69,7 @@
(define start-line-no (define start-line-no
(hash-ref label-table "Start" (hash-ref label-table "Start"
(λ () (λ ()
(error "This program is missing a \"Start\" label")))) (raise-user-error "This program is missing a \"Start\" label"))))
(define raw-end-line-no (define raw-end-line-no
(tm-line-number (last raw-prgm))) (tm-line-number (last raw-prgm)))
(define end-line-no (define end-line-no
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
[(tm-if? cmd) [(tm-if? cmd)
(tm-goto-dest (tm-if-cmd cmd))])]) (tm-goto-dest (tm-if-cmd cmd))])])
(when (not (hash-has-key? labels-set dest)) (when (not (hash-has-key? labels-set dest))
(error (format "Goto statement (in line ~a) references undefined label ~v" (raise-user-error (format "Goto statement (in line ~a) references undefined label ~v"
(tm-line-number line) dest))))) (tm-line-number line) dest)))))
; Return the interpreter object ; Return the interpreter object
...@@ -112,8 +113,8 @@ ...@@ -112,8 +113,8 @@
(define raw-prgm (list STMTS ...)) (define raw-prgm (list STMTS ...))
(define this-tm (define this-tm
(make-tm-config raw-prgm)) (make-tm-config raw-prgm))
(display "Input string: ") (module+ main
(define input (read-line)) (display "Input string: ")
(set-input! this-tm input) (define input (read-line))
(simulate this-tm))) (set-input! this-tm input)
(simulate this-tm))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment