Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
csci71-lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Brian Guadalupe
csci71-lib
Commits
b7eaff6b
Commit
b7eaff6b
authored
Mar 18, 2023
by
Brian Guadalupe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved debugger invocation to main submodule
parent
dda8bf05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
expander.rkt
tm/expander.rkt
+9
-8
No files found.
tm/expander.rkt
View file @
b7eaff6b
...
@@ -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
))))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment