Subject: Re: SICP (2Ed) Ch. 5 question?...
From: (Rob Warnock)
Date: 1999/05/13
Newsgroups: comp.lang.scheme
Message-ID: <7hdvhk$>
James McCarron <> wrote:
|   '((assign ,target (op lookup-variable-value) (const ,exp) (reg env))))))
| ... In particular, I don't see why the code in the last list is well-formed.
| I expected there to be a "perform" instruction wrapping the
| (op lookup-variable-value) part. Is there any chance that this is a typo?
| (More likely, though, I just don't understand the "assign" instruction.)

The latter. IIRC [I don't have it handy], SICP2 changed the format of the
"assign" instruction from just (assign reg <value>) -- where <value> could
be any functional call, such as (cons (reg a) (reg b)) -- to imply an
implicit "perform" on the tail of the "assign" to produce the value.
So things like this [grep'd out of "ch5.scm"] are perfectly legal in
the SICP2 register machine:

	(assign proc (op lookup-variable-value) (const +) (reg env))
	(assign env (op compiled-procedure-env) (reg proc))
	(assign val (op compiled-procedure-entry) (reg proc))

as well as these simpler forms:

	(assign val (const 2))
	(assign val (reg n))
	(assign continue (label print-result))


Rob Warnock, 8L-855
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA