block
This commit is contained in:
@@ -32,6 +32,8 @@ public interface Interface{
|
||||
|
||||
public interface InstrVisitor<H,S>{
|
||||
public S visitReturn(Return_instrImp instr, H h);
|
||||
public S visitBloc(BlocImp instr, H h);
|
||||
public S visitBlocDec (BlocDecImp instr, H h);
|
||||
public S visitAssign(AssignImp instr, H h);
|
||||
public S visitDeclaration(DeclarationImp instr,H h);
|
||||
public S visitPrint(PrintImp instr, H h);
|
||||
|
||||
@@ -43,6 +43,18 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
|
||||
return indent+"RETURN " + instr.e().accept(this,"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitBloc(BlocImp instr, String h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBloc'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitBlocDec(BlocDecImp instr, String h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBlocDec'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitAssign(AssignImp instr, String indent) {
|
||||
return indent + instr.t()+ " := " + instr.e().accept(this,"");
|
||||
|
||||
@@ -61,6 +61,18 @@ public class Program{
|
||||
}
|
||||
}
|
||||
|
||||
public static record BlocDecImp(Declaration e, ArrayList<Instruction> l) implements Instruction{
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitBlocDec(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record BlocImp(ArrayList<Instruction> l) implements Instruction{
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitBloc(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record AssignImp(String t, Expression e) implements Instruction{
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitAssign(this, h);
|
||||
|
||||
@@ -68,6 +68,18 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitBloc(BlocImp instr, SymTable h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBloc'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitBlocDec(BlocDecImp instr, SymTable h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBlocDec'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitAssign(AssignImp instr, SymTable h) {
|
||||
InstrAndVal res = instr.e().accept(this,h);
|
||||
|
||||
Reference in New Issue
Block a user