end of prac3 no bonus

This commit is contained in:
simonkellet
2023-09-26 16:34:17 +01:00
parent 841a7c9af2
commit b1da248676
6 changed files with 31 additions and 14 deletions
@@ -1,2 +1,13 @@
connection.project.dir=..
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(LOCAL_INSTALLATION(/usr/share/java/gradle))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/lib/jvm/java-11-openjdk
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
@@ -34,7 +34,7 @@ public final class StdEnvironment {
public static ConstDeclaration falseDecl, trueDecl, maxintDecl;
public static UnaryOperatorDeclaration notDecl;
public static UnaryOperatorDeclaration notDecl, barDecl;
public static BinaryOperatorDeclaration andDecl, orDecl, addDecl, subtractDecl, multiplyDecl, divideDecl,
moduloDecl, equalDecl, unequalDecl, lessDecl, notlessDecl, greaterDecl, notgreaterDecl;
@@ -43,4 +43,6 @@ public final class StdEnvironment {
public static FuncDeclaration chrDecl, ordDecl, eolDecl, eofDecl;
//public static Object barDecl;
}
@@ -953,6 +953,9 @@ public final class Checker implements ActualParameterVisitor<FormalParameter, Vo
StdEnvironment.booleanType);
StdEnvironment.notlessDecl = declareStdBinaryOp(">=", StdEnvironment.integerType, StdEnvironment.integerType,
StdEnvironment.booleanType);
//PRAC3 # Here we are adding the barDecl, Unary op. that takes 1 val and returns 1 val
StdEnvironment.barDecl = declareStdUnaryOp("|", StdEnvironment.integerType, StdEnvironment.integerType);
StdEnvironment.charDecl = declareStdType("Char", StdEnvironment.charType);
StdEnvironment.chrDecl = declareStdFunc("chr",
@@ -162,7 +162,9 @@ public class LayoutVisitor implements ActualParameterVisitor<Void, DrawingTree>,
@Override
public DrawingTree visitRepeatCommand(RepeatCommand ast, Void obj) {
return null;
var d1 = ast.E.visit(this);
var d2 = ast.C.visit(this);
return layoutBinary("RepeatCom.", d1, d2);
}
// Expressions