declare works with list
This commit is contained in:
@@ -169,8 +169,7 @@ public class Program{
|
||||
|
||||
@Override
|
||||
public String prettyprinter(String indent) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'prettyprinter'");
|
||||
return t+ " :=" + e.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,7 +183,7 @@ public class Program{
|
||||
}
|
||||
}
|
||||
|
||||
public static record DeclarationImp(Type t, String s) implements Instruction{
|
||||
public static record DeclarationImp(Type t, ArrayList<String> s) implements Instruction{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
@@ -193,17 +192,21 @@ public class Program{
|
||||
|
||||
@Override
|
||||
public String prettyprinter(String indent) {
|
||||
return "declare "+t.toString()+s;
|
||||
String str = indent + "declare "+t.prettyprinter() + " ";
|
||||
for(int i = 0; i<s.size();i++){
|
||||
str += s.get(i) + ", ";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> toLLVM() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'toLLVM'");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Type
|
||||
public static record Type_voidImp() implements Type{
|
||||
public String prettyprinter() {
|
||||
return "VOID";
|
||||
@@ -264,9 +267,7 @@ public class Program{
|
||||
}
|
||||
@Override
|
||||
public Integer visitAssign(AssignImp e, Map<String, Integer> h) {
|
||||
//h.put(e.t(), e.e());
|
||||
//TODO
|
||||
return 1;
|
||||
return e.accept(this, h);
|
||||
}
|
||||
@Override
|
||||
public Integer visitDeclaration(DeclarationImp e, Map<String, Integer> h) {
|
||||
|
||||
Reference in New Issue
Block a user