symtable works but not multiple variable
This commit is contained in:
@@ -184,6 +184,25 @@ public class Program{
|
||||
}
|
||||
}
|
||||
|
||||
public static record DeclarationImp(Type t, String s) implements Instruction{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitDeclaration(this, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String prettyprinter(String indent) {
|
||||
return "declare "+t.toString()+s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> toLLVM() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'toLLVM'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static record Type_voidImp() implements Type{
|
||||
public String prettyprinter() {
|
||||
@@ -241,8 +260,7 @@ public class Program{
|
||||
|
||||
@Override
|
||||
public Integer visitReturn(Return_instrImp e, Map<String, Integer> h) {
|
||||
ExprEval exprEval = new ExprEval();
|
||||
return e.e().accept(exprEval, h);
|
||||
return e.accept(this, h);
|
||||
}
|
||||
@Override
|
||||
public Integer visitAssign(AssignImp e, Map<String, Integer> h) {
|
||||
@@ -250,6 +268,10 @@ public class Program{
|
||||
//TODO
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public Integer visitDeclaration(DeclarationImp e, Map<String, Integer> h) {
|
||||
return e.accept(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user