|
@@ -127,7 +127,6 @@ PROCEDURE FlushPend;
|
|
|
BEGIN
|
|
BEGIN
|
|
|
k := 0;
|
|
k := 0;
|
|
|
WHILE k < nPendVar DO
|
|
WHILE k < nPendVar DO
|
|
|
- QbeGen.DeclVar(pendVarName[k], pendVarT[k]);
|
|
|
|
|
INC(k)
|
|
INC(k)
|
|
|
END;
|
|
END;
|
|
|
nPendVar := 0
|
|
nPendVar := 0
|
|
@@ -162,7 +161,6 @@ PROCEDURE FwdVarFlush;
|
|
|
ELSE oper := "w"
|
|
ELSE oper := "w"
|
|
|
END;
|
|
END;
|
|
|
ok := SymTab.GlobalRef(nm, g);
|
|
ok := SymTab.GlobalRef(nm, g);
|
|
|
- QbeGen.FwdPatch(fvarSlot[k], fvarSlot[k], nm, oper, ok)
|
|
|
|
|
END
|
|
END
|
|
|
END;
|
|
END;
|
|
|
INC(k)
|
|
INC(k)
|
|
@@ -337,8 +335,8 @@ PRODUCTIONS
|
|
|
END;
|
|
END;
|
|
|
SymTab.FwdClear;
|
|
SymTab.FwdClear;
|
|
|
FwdVarFlush;
|
|
FwdVarFlush;
|
|
|
- QbeGen.BeginInit(m1); .)
|
|
|
|
|
- [ StatSeq ] (. QbeGen.EndInit; .) ]
|
|
|
|
|
|
|
+ .)
|
|
|
|
|
+ [ StatSeq ] ]
|
|
|
"END"
|
|
"END"
|
|
|
GetIdent<m2> (. FlushPend;
|
|
GetIdent<m2> (. FlushPend;
|
|
|
k := 0;
|
|
k := 0;
|
|
@@ -387,7 +385,7 @@ PRODUCTIONS
|
|
|
END;
|
|
END;
|
|
|
SymTab.FwdClear;
|
|
SymTab.FwdClear;
|
|
|
FwdVarFlush;
|
|
FwdVarFlush;
|
|
|
- QbeGen.BeginBody; .)
|
|
|
|
|
|
|
+ .)
|
|
|
[ StatSeq ] ]
|
|
[ StatSeq ] ]
|
|
|
"END"
|
|
"END"
|
|
|
GetIdent<m2> (. FlushPend;
|
|
GetIdent<m2> (. FlushPend;
|
|
@@ -408,7 +406,6 @@ PRODUCTIONS
|
|
|
AST.SetChild(astNode, 2, astStmt);
|
|
AST.SetChild(astNode, 2, astStmt);
|
|
|
AST.SetChild(astNode, 3, astImp);
|
|
AST.SetChild(astNode, 3, astImp);
|
|
|
astUnit := astNode;
|
|
astUnit := astNode;
|
|
|
- QbeGen.EndModule(m1);
|
|
|
|
|
SymTab.EndUnit; .) .
|
|
SymTab.EndUnit; .) .
|
|
|
DeclSeq (. VAR astSeq, astTail: AST.Node; .)
|
|
DeclSeq (. VAR astSeq, astTail: AST.Node; .)
|
|
|
= (. astSeq := AST.NoNode;
|
|
= (. astSeq := AST.NoNode;
|
|
@@ -452,8 +449,8 @@ PRODUCTIONS
|
|
|
";" ]
|
|
";" ]
|
|
|
DeclSeq (. astStmt := AST.NoNode; .)
|
|
DeclSeq (. astStmt := AST.NoNode; .)
|
|
|
[ "BEGIN" (. astStmt := AST.NoNode;
|
|
[ "BEGIN" (. astStmt := AST.NoNode;
|
|
|
- QbeGen.BeginInit(m1); .)
|
|
|
|
|
- [ StatSeq ] (. QbeGen.EndInit; .) ]
|
|
|
|
|
|
|
+ .)
|
|
|
|
|
+ [ StatSeq ] ]
|
|
|
"END"
|
|
"END"
|
|
|
GetIdent<m2> (. AST.SetChild(astNode, 1, astDecl);
|
|
GetIdent<m2> (. AST.SetChild(astNode, 1, astDecl);
|
|
|
AST.SetChild(astNode, 2, astStmt);
|
|
AST.SetChild(astNode, 2, astStmt);
|
|
@@ -995,8 +992,8 @@ PRODUCTIONS
|
|
|
";" { MethodImpl<ct> ";" }
|
|
";" { MethodImpl<ct> ";" }
|
|
|
(. astStmt := AST.NoNode; .)
|
|
(. astStmt := AST.NoNode; .)
|
|
|
[ "BEGIN" (. astStmt := AST.MakeNode(AST.NkBlock);
|
|
[ "BEGIN" (. astStmt := AST.MakeNode(AST.NkBlock);
|
|
|
- QbeGen.BeginInit(cn); .)
|
|
|
|
|
- [ StatSeq ] (. QbeGen.EndInit; .) ]
|
|
|
|
|
|
|
+ .)
|
|
|
|
|
+ [ StatSeq ] ]
|
|
|
"END"
|
|
"END"
|
|
|
GetIdent<m2> (. IF NOT SymTab.Equal(cn, m2) THEN
|
|
GetIdent<m2> (. IF NOT SymTab.Equal(cn, m2) THEN
|
|
|
SemError(202) END;
|
|
SemError(202) END;
|
|
@@ -1071,7 +1068,6 @@ PRODUCTIONS
|
|
|
SemError(230)
|
|
SemError(230)
|
|
|
ELSE
|
|
ELSE
|
|
|
SymTab.SetSymVal(n, qv);
|
|
SymTab.SetSymVal(n, qv);
|
|
|
- QbeGen.DeclConst(n, qv, t)
|
|
|
|
|
END; .) .
|
|
END; .) .
|
|
|
VarBlock (. VAR astSeq, astTail: AST.Node; .)
|
|
VarBlock (. VAR astSeq, astTail: AST.Node; .)
|
|
|
= "VAR" (. astSeq := AST.NoNode;
|
|
= "VAR" (. astSeq := AST.NoNode;
|
|
@@ -1140,7 +1136,6 @@ PRODUCTIONS
|
|
|
ELSE
|
|
ELSE
|
|
|
WHILE i < SymTab.PendCount() DO
|
|
WHILE i < SymTab.PendCount() DO
|
|
|
SymTab.PendName(i, nm);
|
|
SymTab.PendName(i, nm);
|
|
|
- QbeGen.DeclVar(nm, t);
|
|
|
|
|
INC(i)
|
|
INC(i)
|
|
|
END
|
|
END
|
|
|
END;
|
|
END;
|