use of ast.Expression.Loop in project L42 by ElvisResearchGroup.
the class Desugar method visit.
public Expression visit(While s) {
Expression cond = Desugar.getMCall(s.getP(), s.getCond(), "#checkTrue", Desugar.getPs());
RoundBlock b = Desugar.getBlock(s.getP(), cond, s.getThen());
Loop l = new Loop(b);
Type _void = Type.immVoid;
Expression.Catch k = Desugar.getK(s.getP(), SignalKind.Exception, "", _void, Expression._void.instance);
RoundBlock b2 = Desugar.getBlock(s.getP(), l, Collections.singletonList(k), Expression._void.instance);
return b2.accept(this);
}
use of ast.Expression.Loop in project L42 by ElvisResearchGroup.
the class DesugarW method with_E_handleIs.
private Expression with_E_handleIs(Position pos, List<VarDecXE> is, Expression b) {
//case e in 6 pages
//xs is dom(Is)
List<String> xs = new ArrayList<>();
for (VarDecXE i : is) {
xs.add(i.getX());
}
//di ki is block content =nexti(xs)
List<BlockContent> bc = new ArrayList<>();
for (int i = 0; i < xs.size(); i++) {
bc.add(withNext(pos, i, xs));
}
//inner =di ki s b[xs:=xs.#inner()]
for (String xi : xs) {
b = XInE.of(new X(pos, xi), Desugar.getMCall(pos, new X(pos, xi), "#inner", Desugar.getPs()), b);
}
RoundBlock inner = new RoundBlock(pos, Doc.empty(), b, bc);
Catch k = Desugar.getK(pos, SignalKind.Exception, "", Type.immVoid, Expression._void.instance);
inner = Desugar.getBlock(pos, new Loop(inner), Collections.singletonList(k), Expression._void.instance);
Expression result = withDeclareIts(is, inner);
//accept
return result;
}
Aggregations