Skip to content

Commit 4f0be8e

Browse files
authored
Miscellaneous corrections (#713)
* 5.3.1 * all added according to sheet
1 parent 8380bc5 commit 4f0be8e

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

xml/chapter5/section3/subsection1.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,9 @@ perform(list(op("set_tail"), reg(<META>reg</META>$_1$), reg(<META>reg</META>$_2$
519519
(op vector-set!) (reg the-cdrs) (reg reg$_{1}$) (reg reg$_{2}$))
520520
</SCHEME>
521521
<JAVASCRIPT>
522-
perform(op("vector_set"), list(reg("the_heads"), reg(<META>reg</META>$_1$), reg(<META>reg</META>$_2$)))
522+
perform(list(op("vector_set"), reg("the_heads"), reg(<META>reg</META>$_1$), reg(<META>reg</META>$_2$)))
523523

524-
perform(op("vector_set"), list(reg("the_tails"), reg(<META>reg</META>$_1$), reg(<META>reg</META>$_2$)))
524+
perform(list(op("vector_set"), reg("the_tails"), reg(<META>reg</META>$_1$), reg(<META>reg</META>$_2$)))
525525
</JAVASCRIPT>
526526
</SNIPPET>
527527
</TEXT>
@@ -609,10 +609,10 @@ assign(<META>reg</META>$_1$, list(op("pair"), reg(<META>reg</META>$_2$), reg(<ME
609609
(assign free (op +) (reg free) (const 1))
610610
</SCHEME>
611611
<JAVASCRIPT>
612-
perform(op("vector_set"),
613-
list(reg("the_heads"), reg("free"), reg(<META>reg</META>$_2$))),
614-
perform(op("vector_set"),
615-
list(reg("the_tails"), reg("free"), reg(<META>reg</META>$_3$))),
612+
perform(list(op("vector_set"),
613+
reg("the_heads"), reg("free"), reg(<META>reg</META>$_2$))),
614+
perform(list(op("vector_set"),
615+
reg("the_tails"), reg("free"), reg(<META>reg</META>$_3$))),
616616
assign(<META>reg</META>$_1$, reg("free")),
617617
assign("free", list(op("+"), reg("free"), constant(1)))
618618
</JAVASCRIPT>
@@ -716,7 +716,7 @@ assign("the_stack", list(op("tail"), reg("the_stack")))
716716
<SCHEME><SCHEMEINLINE>(perform (op initialize-stack))</SCHEMEINLINE>
717717
</SCHEME>
718718
<JAVASCRIPT>
719-
<JAVASCRIPTINLINE>perform(op("initialize_stack"))</JAVASCRIPTINLINE>
719+
<JAVASCRIPTINLINE>perform(list(op("initialize_stack")))</JAVASCRIPTINLINE>
720720
</JAVASCRIPT>
721721
</SPLITINLINE>
722722
can be implemented as

xml/chapter5/section3/subsection2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ already-moved
751751
branch(label("already_moved")),
752752
assign("new", reg("free")), // new location for pair
753753
// Update $\texttt{free}$ pointer
754-
assign("free", list((op("+"), reg("free"), constant(1))),
754+
assign("free", list(op("+"), reg("free"), constant(1))),
755755
// Copy the head and tail to new memory
756756
perform(list(op("vector_set"),
757757
reg("new_heads"), reg("new"),

xml/chapter5/section5/subsection2.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ function compile_name(component, target, linkage) {
291291
<JAVASCRIPT>
292292
The function <JAVASCRIPTINLINE>compile_assignment_declaration</JAVASCRIPTINLINE>
293293
recursively generates code that computes the value to be
294-
associated with the symbol, appends to it a two-instruction
294+
associated with the symbol and appends to it a two-instruction
295295
sequence that updates the value associated with the symbol
296-
in the environment, and assigns the value of the whole component
296+
in the environment and assigns the value of the whole component
297297
<!-- (the <JAVASCRIPTINLINE>final_value</JAVASCRIPTINLINE>) --> <!-- FIXME PAGINATION: can be restored if final_value is visible on this page -->
298298
(the assigned value for an assignment or <JAVASCRIPTINLINE>undefined</JAVASCRIPTINLINE> for a declaration)
299299
to the target register.
@@ -371,9 +371,9 @@ function compile_assignment_declaration(
371371
make_instruction_sequence(list("env", "val"),
372372
list(target),
373373
list(perform(list(op("assign_symbol_value"),
374-
constant(symbol),
375-
reg("val"),
376-
reg("env"))),
374+
constant(symbol),
375+
reg("val"),
376+
reg("env"))),
377377
assign(target, final_value)))));
378378
}
379379
</JAVASCRIPT>

xml/chapter5/section5/subsection3.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ primitive-branch
541541
after-call
542542
</SCHEME>
543543
<JAVASCRIPT latex="yes"><!-- The $\texttt{ }\texttt{ }$ below is a hack to ensure the leading spaces are not consumed-->
544-
$\texttt{ }\texttt{ }$test(op("primitive_function"), reg("fun")),
544+
$\texttt{ }\texttt{ }$test(list(op("primitive_function"), reg("fun"))),
545545
branch(label("primitive_branch")),
546546
"compiled_branch",
547547
<METAPHRASE>code to apply compiled function with given target and appropriate linkage</METAPHRASE>

xml/chapter5/section5/subsection5.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ $\langle restore$ env $if\ saved\ above\rangle$
180180
perform(list(op("assign_symbol_value"),
181181
constant("factorial"),
182182
reg("val"),
183-
reg("env")),
183+
reg("env"))),
184184
assign("val", constant(undefined))
185185
</JAVASCRIPT>
186186
</SNIPPET>
@@ -1056,7 +1056,7 @@ primitive-branch22
10561056
</SCHEME>
10571057
<JAVASCRIPT><!-- The $\texttt{ }\texttt{ }$ below is a hack to ensure the leading spaces are not consumed-->
10581058
$\texttt{ }\texttt{ }$assign("val", list(op("make_compiled_function"),
1059-
label("entry1"), reg("env")))
1059+
label("entry1"), reg("env"))),
10601060
"entry1"
10611061
assign("env", list(op("compiled_function_env"), reg("fun"))),
10621062
assign("env", list(op("extend_environment"),
@@ -1272,8 +1272,8 @@ after-lambda15
12721272
(assign val (op +) (reg val) (const 1))
12731273
</SCHEME>
12741274
<JAVASCRIPT>
1275-
assign("val", list(op("lookup_symbol_value"), constant("a"), reg("env")),
1276-
assign("val", list(op("+"), reg("val"), constant(1))
1275+
assign("val", list(op("lookup_symbol_value"), constant("a"), reg("env"))),
1276+
assign("val", list(op("+"), reg("val"), constant(1)))
12771277
</JAVASCRIPT>
12781278
</SNIPPET>
12791279
In this exercise we will extend our compiler to support open coding of

0 commit comments

Comments
 (0)