A CPS compiler for a tiny language.
Expressions:
- integer literals
(a + b)
, returns the sum ofa
andb
(a < b)
, comparea
andb
, returns a boolean value, mainly used in if-condition(if cond if-part else-part)
(print value)
, print an integer(begin expressions ...)
, evaluate all expressions and return the result of the last one(λ (parameters ...) body)
, an unevaluated lambda, return reduced body when evaluated(foo arguments ...)
, evaluate lambdafoo
and then apply it with the evaluatedarguments
(return val)
, early return from a lambda
Proposed features:
- throw and catch
Description:
This language follows the call-by-value semantics. i.e. In a lambda application process, arguments are evaluated before being passed to lambdas.
Lambda arguments are evaluated from left to right.
(compile-cps expr)
, compileexpr
of the tiny language into a native racket CPS program
TODO