Skip to content

Commit a6e3c20

Browse files
committed
Touch up labels and registers in Abscond, Blackmail, and Con notes.
1 parent 7ba71c4 commit a6e3c20

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

www/notes/abscond.scrbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22

3-
@(require (for-label (except-in racket compile) a86/ast a86/printer))
3+
@(require (for-label (except-in racket compile) a86/ast a86/printer a86/registers))
44
@(require scribble/examples
55
redex/reduction-semantics
66
redex/pict
@@ -429,7 +429,7 @@ So the AST representation of our example is:
429429

430430
@racketblock[
431431
(list (Label 'entry)
432-
(Mov 'rax 42)
432+
(Mov rax 42)
433433
(Ret))
434434
]
435435

www/notes/blackmail.scrbl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22

3-
@(require (for-label (except-in racket compile ...) a86/ast a86/printer))
3+
@(require (for-label (except-in racket compile ...) a86/ast a86/printer a86/registers a86/interp))
44
@(require scribble/examples
55
redex/pict
66
"../fancyverb.rkt"
@@ -238,7 +238,7 @@ Just as we did with Abscond, let's approach writing the compiler by
238238
first writing an example.
239239

240240
Suppose we want to compile @racket[(add1 (add1 40))]. We already know
241-
how to compile the @racket[40]: @racket[(Mov 'rax 40)]. To do the
241+
how to compile the @racket[40]: @racket[(Mov rax 40)]. To do the
242242
increment (and decrement) we need to know a bit more a86. In
243243
particular, the @racket[Add] instruction is relevant. It increments
244244
the contents of a register by some given amount.
@@ -250,9 +250,9 @@ So, a program that adds 1 twice to 40 looks like:
250250
(asm-interp
251251
(prog (Global 'entry)
252252
(Label 'entry)
253-
(Mov 'rax 40)
254-
(Add 'rax 1)
255-
(Add 'rax 1)
253+
(Mov rax 40)
254+
(Add rax 1)
255+
(Add rax 1)
256256
(Ret)))]
257257

258258

@@ -275,7 +275,7 @@ recursion, much like the interpreter.
275275
In the case of a unary primitive @racket[(Prim1 p e)], the compiler
276276
first compiles the subexpression @racket[e] obtaining a list of
277277
instructions that, when executed, will place @racket[e]'s value in the
278-
@racket['rax] register. After that sequence of instructions, the
278+
@racket[rax] register. After that sequence of instructions, the
279279
compiler emits instructions for carrying out the operation @racket[p],
280280
defering to a helper function @racket[compile-op1]:
281281

www/notes/con.scrbl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#lang scribble/manual
22

3-
@(require (for-label (except-in racket compile ...) a86/printer a86/ast))
3+
@(require (for-label (except-in racket compile ...) a86/printer a86/ast a86/registers))
44
@(require redex/pict
55
racket/runtime-path
66
scribble/examples
@@ -191,8 +191,8 @@ We already know how to compile the @racket[8], @racket[2], and
191191
What needs to happen?
192192

193193
@itemlist[
194-
@item{Execute the code for @racket[8] leaving the result in @racket['rax],}
195-
@item{check whether @racket['rax] holds zero,}
194+
@item{Execute the code for @racket[8] leaving the result in @racket[rax],}
195+
@item{check whether @racket[rax] holds zero,}
196196
@item{if it does, execute the code for @racket[2],}
197197
@item{if it doesn't, execute the code for @racket[3].}
198198
]
@@ -219,10 +219,10 @@ In total, the code for this example would look like:
219219
@racketblock[
220220
(let ((l0 (gensym))
221221
(l1 (gensym)))
222-
(list (Mov 'rax 8)
223-
(Cmp 'rax 0)
222+
(list (Mov rax 8)
223+
(Cmp rax 0)
224224
(Je l0)
225-
(Mov 'rax 3)
225+
(Mov rax 3)
226226
(Jmp l1)
227227
(Label l0)
228228
(Mov rax 2)
@@ -232,7 +232,7 @@ In total, the code for this example would look like:
232232

233233
@section{A Compiler for Con}
234234

235-
Notice that the @racket[(Mov 'rax 8)], @racket[(Mov rax 3)] and
235+
Notice that the @racket[(Mov rax 8)], @racket[(Mov rax 3)] and
236236
@racket[(Mov rax 2)] parts are just the instructions generated by
237237
compiling @racket[8], @racket[2] and @racket[3]. Generalizing from
238238
this, we arrive at the following code for the compiler:
@@ -241,7 +241,7 @@ this, we arrive at the following code for the compiler:
241241
(let ((l0 (gensym 'if))
242242
(l1 (gensym 'if)))
243243
(seq (compile-e e1)
244-
(Cmp 'rax 0)
244+
(Cmp rax 0)
245245
(Je l0)
246246
(compile-e e3)
247247
(Jmp l1)

0 commit comments

Comments
 (0)