summaryrefslogtreecommitdiff
path: root/parser.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-08 19:07:58 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-08 19:07:58 +0200
commita417225089fd78d53d73ad63cd79f57d1a4a8ff1 (patch)
treed9da68b0414fdaf08ddccbae20bd0e2977cdca25 /parser.fun
parentb0cb85edf2b60f6f0909355db717376f435ab312 (diff)
Register allocation
Diffstat (limited to 'parser.fun')
-rw-r--r--parser.fun11
1 files changed, 9 insertions, 2 deletions
diff --git a/parser.fun b/parser.fun
index 9e36f2c..0948305 100644
--- a/parser.fun
+++ b/parser.fun
@@ -178,6 +178,7 @@ functor Parser(structure Tree: TREE; structure P: PPC;
StmtDoWhile of stmt * exprAug |
StmtReturn of exprAug option |
StmtBreak |
+ StmtNone |
StmtContinue
datatype parseBinopRes = BRbinop of exprPart | BRfinish of int
@@ -3046,7 +3047,7 @@ functor Parser(structure Tree: TREE; structure P: PPC;
lx
end)
- | _ => raise Unimplemented
+ | _ => raise Unreachable
end
fun printOffsets (LcAux (offset, l)) out =
@@ -3467,6 +3468,7 @@ functor Parser(structure Tree: TREE; structure P: PPC;
| Tk T.kwBreak => parseJmp StmtBreak
| Tk T.kwContinue => parseJmp StmtContinue
| Tk T.kwReturn => parseReturn ctx
+ | Tk T.Semicolon => (StmtNone, #3 $ getTokenCtx ctx)
| _ => parseStmtExpr ctx
end
@@ -3670,8 +3672,12 @@ functor Parser(structure Tree: TREE; structure P: PPC;
| _ =>
let
val (stmt, ctx) = parseStmt ctx
+ val acc =
+ case stmt of
+ StmtNone => acc
+ | _ => stmt :: acc
in
- collectStmts (stmt :: acc) ctx
+ collectStmts acc ctx
end
end
@@ -3723,6 +3729,7 @@ functor Parser(structure Tree: TREE; structure P: PPC;
Printf out `"return " Popt pea ea `";" %
| pstmt' _ StmtBreak out = Printf out `"break;" %
| pstmt' _ StmtContinue out = Printf out `"continue;" %
+ | pstmt' _ StmtNone _ = raise Unreachable
and pCompBody off (S as (StmtCompound _)) out =
Printf out A2 pstmt' (off - 1) S %