Commit b7eaff6b authored by Brian Guadalupe's avatar Brian Guadalupe

Moved debugger invocation to main submodule

parent dda8bf05
......@@ -56,7 +56,8 @@
#:when (tm-label? (tm-line-cmd line)))
(let ([name (tm-label-name (tm-line-cmd line))])
(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)))))
; Build the label table
......@@ -68,7 +69,7 @@
(define start-line-no
(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
(tm-line-number (last raw-prgm)))
(define end-line-no
......@@ -86,7 +87,7 @@
[(tm-if? cmd)
(tm-goto-dest (tm-if-cmd cmd))])])
(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)))))
; Return the interpreter object
......@@ -112,8 +113,8 @@
(define raw-prgm (list STMTS ...))
(define this-tm
(make-tm-config raw-prgm))
(display "Input string: ")
(define input (read-line))
(set-input! this-tm input)
(simulate this-tm)))
(module+ main
(display "Input string: ")
(define input (read-line))
(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