
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

1 fun plus(x) = x + 1; 2 fun main(x) = 3 let val y = x + 1 4 in let fun repeat(f,x) = 5 let y = f(x) 6 in f(y) 7 end 8 in repeat(plus, y) 9 end 10 end; 11 main (5); 12
The activation record for each function needs to have a control link, an access link, a return address, a return value address, parameters, and local variables. Remember that function values are represented by closures and that a closure is a pair consisting of an environment (pointer to an activation record) and compiled code. Use the line numbers in the code to indicate the return address of each function call (the line number immediately following the function call). Follow guidelines in lab8.