Skip to content

Commit

Permalink
Fix up mfont a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
skaller committed Dec 14, 2022
1 parent ed54400 commit 77137ab
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mfront.flx
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ chip stmt
//prln$ "# eval[inp] " + cat " " tokens;
//prln$ "# eval[parsed] " + e2.str;
pr$ symtab&.postfix e2 indent;
prln$ " " * indent + "local." + symtab&.get_address name;
prln$ " " * indent + "pop.local." + symtab&.get_address name +"# init " + name;

// assignment (requires "assign" binder)

Expand All @@ -498,7 +498,7 @@ chip stmt
if not sym.mut do
fail("Write to immutable variable " + name);
done
prln$ " " * indent + "pop.local." + sym.loc.str;
prln$ " " * indent + "pop.local." + sym.loc.str + "# assign " + name;

/* NOTE on if/else stuff

Expand Down Expand Up @@ -537,7 +537,7 @@ chip stmt
// evaluate condition
e,rest = parse_expr t;
pr$ symtab&.postfix e indent;
prln(" " * indent + "if.true # Rust");
prln(" " * indent + "if.true # Rust if");
ifelsestack = Cons(ifblock 1,ifelsestack);
// NOTE: at the end, a leading if indents already
// this currently applies to both miden "if" and a Rust "if"
Expand All @@ -557,15 +557,15 @@ chip stmt
var nest = n;
while nest > 0 do
--indent;
prln$ " " * indent + "end #endif";
prln$ " " * indent + "end # Rust endif";
--nest;
done
| Cons(elseblock n,stk) =>
ifelsestack = stk; // terminate ifelse block else
nest = n;
while nest > 0 do
--indent;
prln$ " " * indent + "end #Rust endif";
prln$ " " * indent + "end # Rust endif";
--nest;
done
endmatch;
Expand All @@ -580,7 +580,7 @@ chip stmt
| Cons(ifblock n,stk) =>
ifelsestack = Cons (elseblock n, stk);
--indent;
prln$ " " * indent + "else #Rust";
prln$ " " * indent + "else # Rust else";
++indent;
endmatch;

Expand All @@ -591,12 +591,12 @@ chip stmt
| Cons(ifblock n,stk) =>
ifelsestack = Cons (ifblock (n+1), stk);
--indent;
prln$ " " * indent + "else #Rust else if";
prln$ " " * indent + "else # Rust else if";
++indent;
// evaluate condition
e,rest = parse_expr t;
pr$ symtab&.postfix e indent;
prln(" " * indent + "if.true #Rust else if");
prln(" " * indent + "if.true # Rust else if");
++indent;
endmatch; // ifelse
endmatch; // else
Expand Down Expand Up @@ -647,6 +647,7 @@ chip printer
endmatch;
println line;
done
x = head xs;
done
}

Expand Down

0 comments on commit 77137ab

Please sign in to comment.