Intermediate Compilers & Programming Language Theory
Q42 / 100

What is continuation-passing style (CPS)?

Correct! Well done.

Incorrect.

The correct answer is B) A program transformation representing all control flow (including return, exception, loop exit) as explicit continuation functions rather than using the call stack

B

Correct Answer

A program transformation representing all control flow (including return, exception, loop exit) as explicit continuation functions rather than using the call stack

Explanation

CPS: factorial(n, k) where k is the continuation (what to do with the result). Every call becomes a tail call. CPS enables: trampolining (space-efficient recursion), call/cc, and is the target of CPS transforms in compilers.

Progress
42/100