add parser

This commit is contained in:
Vu Tuan Minh
2025-04-10 10:26:34 +02:00
parent f75ca554aa
commit 9ea10fb031
6 changed files with 106 additions and 2 deletions

View File

@@ -88,6 +88,27 @@ public class Program{
}
}
public static record IfThenImp(Expression e, Instruction i1) implements Instruction {
@Override
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
return v.visitIfThen(this, h);
}
}
public static record IfThenElseImp(Expression e, Instruction i1, Instruction i2) implements Instruction {
@Override
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
return v.visitIfThenElse(this, h);
}
}
public static record WhileImp(Expression e, Instruction i1) implements Instruction {
@Override
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
return v.visitWhile(this, h);
}
}
//Type
public static record Type_voidImp() implements Type{
@Override
@@ -103,4 +124,5 @@ public class Program{
return v.visitInt(this, h);
}
}
}