Skip to content
Snippets Groups Projects
Commit fa51f89e authored by BAUQUIN Niels's avatar BAUQUIN Niels
Browse files

BAHAHHAHAHAHAHAHAHHAHAHAHHAHAHAHHAHAHAHAHHAHAHAH

parent 02784007
No related branches found
No related tags found
No related merge requests found
......@@ -38,9 +38,10 @@ public class Compiler
System.out.println("[TYPE CHECKING]");
typeCheck();
/*
System.out.println("[BUILD C3A] ");
buildC3a();
/*
System.out.println("[BUILD PRE NASM] ");
buildPreNasm();
System.out.println("[BUILD FLOW GRAPH] ");
......
......@@ -19,16 +19,16 @@ public class Sa2c3a extends SaDepthFirstVisitor <C3aOperand> {
public void defaultIn(SaNode node)
{
//for(int i = 0; i < indentation; i++){System.out.print(" ");}
//indentation++;
//System.out.println("<" + node.getClass().getSimpleName() + ">");
for(int i = 0; i < indentation; i++){System.out.print(" ");}
indentation++;
System.out.println("<" + node.getClass().getSimpleName() + ">");
}
public void defaultOut(SaNode node)
{
//indentation--;
// for(int i = 0; i < indentation; i++){System.out.print(" ");}
// System.out.println("</" + node.getClass().getSimpleName() + ">");
indentation--;
for(int i = 0; i < indentation; i++){System.out.print(" ");}
System.out.println("</" + node.getClass().getSimpleName() + ">");
}
......@@ -45,5 +45,190 @@ public class Sa2c3a extends SaDepthFirstVisitor <C3aOperand> {
return result;
}
@Override
public C3aOperand visit(SaProg node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaDecTab node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExp node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpInt node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpVrai node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpFaux node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpVar node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstEcriture node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstTantQue node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaLInst node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaDecFonc node) throws Exception {
defaultIn(node);
C3aOperand result = c3a.newAutoLabel();
c3a.ajouteInst(new C3aInstFBegin(node.tsItem, "begin"));
node.getCorps().accept(this);
c3a.ajouteInst(new C3aInstFEnd("end"));
defaultOut(node);
return result;
}
@Override
public C3aOperand visit(SaDecVar node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstAffect node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaLDecVar node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaLDecFonc node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaVarSimple node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaAppel node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpAppel node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpSub node) throws Exception {
defaultIn(node);
C3aOperand op1 = node.getOp1().accept(this);
C3aOperand op2 = node.getOp2().accept(this);
C3aOperand result = c3a.newTemp();
c3a.ajouteInst(new C3aInstSub(op1, op2, result, ""));
defaultOut(node);
return result;
}
@Override
public C3aOperand visit(SaExpMult node) throws Exception {
defaultIn(node);
C3aOperand op1 = node.getOp1().accept(this);
C3aOperand op2 = node.getOp2().accept(this);
C3aOperand result = c3a.newTemp();
c3a.ajouteInst(new C3aInstMult(op1, op2, result, ""));
defaultOut(node);
return result;
}
@Override
public C3aOperand visit(SaExpDiv node) throws Exception {
defaultIn(node);
C3aOperand op1 = node.getOp1().accept(this);
C3aOperand op2 = node.getOp2().accept(this);
C3aOperand result = c3a.newTemp();
c3a.ajouteInst(new C3aInstDiv(op1, op2, result, ""));
defaultOut(node);
return result;
}
@Override
public C3aOperand visit(SaExpInf node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpEqual node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpAnd node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpOr node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpNot node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaExpLire node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstBloc node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstSi node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaInstRetour node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaLExp node) throws Exception {
return super.visit(node);
}
@Override
public C3aOperand visit(SaVarIndicee node) throws Exception {
return super.visit(node);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment