Commit d93765fe authored by Sapphie's avatar Sapphie
Browse files

Finish implementation of If

parent 5b783c84
......@@ -47,11 +47,22 @@ object CL3ToCPSTranslator extends (S.Tree => C.Tree) {
// 'Then' continuation name and body
val thenCNme = Symbol.fresh("ct")
val thenCBody = transform(thn)(v2 => C.AppC(ctxCNme, Seq(v2)))
val thenC = C.Cnt(thenCNme, Seq(), thenCBody)
// 'Else' continuation name and body
val elseCNme = Symbol.fresh("ce")
val elseCBody = transform(thn)(v3 => C.AppC(ctxCNme, Seq(v3)))
???
val elseC = C.Cnt(elseCNme, Seq(), elseCBody)
val letBody = transformTestPrimitive(p, primArgs, thenCNme, elseCNme)
C.LetC(Seq(ctxC),
C.LetC(Seq(thenC),
C.LetC(Seq(elseC), letBody)
)
)
case e1 =>
val pArgs = S.Lit(BooleanLit(false))(cnd.pos)
val newCnd = S.Prim(L3.Eq, Seq(e1, pArgs))(cnd.pos)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment