doc-src/Tutorial/CodeGen/exec
author berghofe
Tue, 01 Jun 2004 15:02:05 +0200
changeset 14861 ca5cae7fb65a
parent 5377 efb799c5ed3c
permissions -rw-r--r--
Removed ~10000 hack in function idx that can lead to inconsistencies when unifying terms with a large number of abstractions.

consts exec :: ('a => 'v) => 'v list => (('a,'v) instr) list => 'v list
primrec
"exec s vs [] = vs"
"exec s vs (i#is) = (case i of
    Const v  => exec s (v#vs) is
  | Load a   => exec s ((s a)#vs) is
  | Apply f  => exec s ( (f (hd vs) (hd(tl vs)))#(tl(tl vs)) ) is)"