Page:Scheme - An interpreter for extended lambda calculus.djvu/32



is the main loop of the interpreter. It may be thought of as the instruction dispatch in the micro-code of the implementation machine. If an alarmclock tick has occurred, and interrupts are allowed, then the scheduler is called to switch processes. Otherwise the "instruction" specified by  is executed via.

is essentially a  optimized for compiled "microcode". Note the way it pulls the  property to the front of the property list if possible for speed.

Interrupts are allowed unless the variable  is bound to   in the current environment. This is used to implement the  primitive.

Next comes the scheduler. It is apparently interrupt-driven, but in fact is not. The key here is to think microcode! There is one place in the microcoded instruction interpretation loop which checks to see if there is an interrupt pending; in our "machine", this occurs in, where   is checked on every cycle. This is another case where we must beware of using too much of the power of the host language; just as we must avoid using host recursion directly to implement recursion, so we must avoid using host interrupts directly to implement interrupts. We may not modify any register during a host language interrupt, except one (such as ) which is