From 35e3899a5f91a01c46deb492af8a3746faaf98d7 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Fri, 14 Jun 2024 15:15:22 +0200 Subject: [PATCH 01/11] Moved to the latest rascal and rascal-plugin release --- CITATION => CITATION.md | 0 FUNDING => FUNDING.md | 0 LICENSE => LICENSE.md | 0 pom.xml | 4 ++-- src/lang/flybytes/Syntax.rsc | 2 +- src/lang/flybytes/internal/ASTgen.rsc | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) rename CITATION => CITATION.md (100%) rename FUNDING => FUNDING.md (100%) rename LICENSE => LICENSE.md (100%) diff --git a/CITATION b/CITATION.md similarity index 100% rename from CITATION rename to CITATION.md diff --git a/FUNDING b/FUNDING.md similarity index 100% rename from FUNDING rename to FUNDING.md diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/pom.xml b/pom.xml index 37cbced..508fd2b 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.23.0 + 0.27.3 true ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.34.0 + 0.40.2 org.ow2.asm diff --git a/src/lang/flybytes/Syntax.rsc b/src/lang/flybytes/Syntax.rsc index 188f23c..e43249b 100644 --- a/src/lang/flybytes/Syntax.rsc +++ b/src/lang/flybytes/Syntax.rsc @@ -447,7 +447,7 @@ Method staticMethod(Type ret, str name, list[Formal] args, list[Stat] block) @synopsis{Short-hand for generating a constructor.} @pitfalls{Don't forgot to generate a super call.} Method constructor(Modifier access, list[Formal] formals, list[Stat] block) - = method(constructorDesc([ var.\type | var <- formals]), formals, block, modifiers={access}); + = method(constructorDesc([ var.\type | Formal var <- formals]), formals, block, modifiers={access}); @synopsis{"new" short-hand with parameters} Exp new(Type class, list[Type] argTypes, list[Exp] args) diff --git a/src/lang/flybytes/internal/ASTgen.rsc b/src/lang/flybytes/internal/ASTgen.rsc index 9a173cc..976bff6 100644 --- a/src/lang/flybytes/internal/ASTgen.rsc +++ b/src/lang/flybytes/internal/ASTgen.rsc @@ -200,7 +200,7 @@ str type2FactoryCall(Symbol t){ case \str() : return "IString"; case \datetime() : return "IDateTime"; case \tuple(_) : return "ITuple"; - case \func(_, _): return "ICallableValue"; + case \func(_, _, _): return "ICallableValue"; case \alias(_,_,a) : return typeToJavaType(a); default : return "IValue"; } From 5c8ecf3bb7f1a5c44f3cdc6f3b0ed65d5dfb17a7 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Fri, 14 Jun 2024 22:29:57 +0200 Subject: [PATCH 02/11] Update pom.xml Better let the build fall while we have static errors --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 508fd2b..bcfd563 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ rascal-maven-plugin 0.27.3 - true + false ${project.build.outputDirectory} ${project.basedir}/src From bc857c8afaaefde9296867868fa878b907ad4d60 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 17 Jun 2024 13:58:09 +0200 Subject: [PATCH 03/11] fixed real static errors --- src/lang/flybytes/demo/protol/Compiler.rsc | 4 +-- src/lang/flybytes/tests/ArithmeticTests.rsc | 32 ++++++++++----------- src/lang/flybytes/tests/BranchingTests.rsc | 24 ++++++++-------- src/lang/flybytes/tests/VariableTests.rsc | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/lang/flybytes/demo/protol/Compiler.rsc b/src/lang/flybytes/demo/protol/Compiler.rsc index 0ff1460..eed94d6 100644 --- a/src/lang/flybytes/demo/protol/Compiler.rsc +++ b/src/lang/flybytes/demo/protol/Compiler.rsc @@ -99,9 +99,9 @@ Stat compile((Command) `print ;`) = stdout(compile(e)); Exp compile(e:(Expr) `this`) = load("this", src=e@\loc); Exp compile((Expr) `.(<{Expr ","}* args>)`) - = invokeDynamic(bootstrap(Prototype, "bootstrap", []), methodDesc(Prototype, "", [Prototype]/*receiver*/ + [Prototype | _ <- args] ), [compile(rec), *compile(args) ])[src=name@\loc]; + = invokeDynamic(bootstrap(Prototype, "bootstrap", []), methodDesc(Prototype, "", [Prototype]/*receiver*/ + [Prototype | _ <- args] ), [compile(rec), *compileList(args) ])[src=name@\loc]; -list[Exp] compile({Expr ","}* args) = [compile(a)[src=a@\loc] | a <- args]; +list[Exp] compileList({Expr ","}* args) = [compile(a)[src=a@\loc] | a <- args]; Exp compile(x:(Expr) `[<{Expr ","}* elems>]`) = new(Arr, [array(Prototype)], [newInitArray(array(Prototype), [compile(e) | e <- elems])])[src=x@\loc]; diff --git a/src/lang/flybytes/tests/ArithmeticTests.rsc b/src/lang/flybytes/tests/ArithmeticTests.rsc index f0bbfe5..7c98e2c 100644 --- a/src/lang/flybytes/tests/ArithmeticTests.rsc +++ b/src/lang/flybytes/tests/ArithmeticTests.rsc @@ -62,10 +62,10 @@ bool testUnOp(Class c, Type t, num arg, num answer) { bool testBinOpRange(Class c, Type t, num lhs, num rhs, real answer) { m = loadClass(c); - real reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); + reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); - if (abs(answer - reply) > 0.1) { - println("op(,) == != (diff: )"); + if (real r := reply, abs(answer - r) > 0.1) { + println("op(,) == != (diff: )"); return false; } @@ -87,12 +87,12 @@ list[Type] exactArithmeticTypes = [integer(), short(), byte(), long()]; test bool testNeg1(int i) = all(t <- exactArithmeticTypes, - I := i % maxValue(t), testUnOp(unOpClass(t, neg), t, I, -1 * I)); + I := i % maxIntValue(t), testUnOp(unOpClass(t, neg), t, I, -1 * I)); test bool testAdd2(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)) / 2, - J := (j % maxValue(t)) / 2, + I := (i % maxIntValue(t)) / 2, + J := (j % maxIntValue(t)) / 2, testBinOp(binOpClass(t, add), t, I, J, I + J)); test bool testMul2(int i, int j) @@ -103,20 +103,20 @@ test bool testMul2(int i, int j) test bool testSub2(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)) / 2, - J := ((j % maxValue(t)) / 2), + I := (i % maxIntValue(t)) / 2, + J := ((j % maxIntValue(t)) / 2), testBinOp(binOpClass(t, sub), t, I, J, I - J)); test bool testDivInt(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)), - J := abs(((j % maxValue(t)) / 2)) + 1, // never 0, + I := (i % maxIntValue(t)), + J := abs(((j % maxIntValue(t)) / 2)) + 1, // never 0, testBinOp(binOpClass(t, div), t, I, J, I / J)); test bool testRem(int i, int j) - = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)), - J := abs(((j % maxValue(t)) / 2)) + 1, // never 0, + = all (t <- exactArithmeticTypes + I := (i % maxIntValue(t)), + J := abs(((j % maxIntValue(t)) / 2)) + 1, // never 0, testBinOp(binOpClass(t, rem), t, I, J, I % J)); list[Type] floatingPointTypes = [float(), double()]; @@ -159,7 +159,7 @@ private real round(float(), real f) = precision(f, 0); private real round(double(), real f) = precision(f, 0); private default int round(Type _, int f) = f; -private real val(float(), Mirror r) = r.toValue(#real); -private real val(double(), Mirror r) = r.toValue(#real); -private default int val(Type _, Mirror r) = r.toValue(#int); +private num val(float(), Mirror r) = r.toValue(#real); +private num val(double(), Mirror r) = r.toValue(#real); +private default num val(Type _, Mirror r) = r.toValue(#int); diff --git a/src/lang/flybytes/tests/BranchingTests.rsc b/src/lang/flybytes/tests/BranchingTests.rsc index 659f40b..f95ff6a 100644 --- a/src/lang/flybytes/tests/BranchingTests.rsc +++ b/src/lang/flybytes/tests/BranchingTests.rsc @@ -88,46 +88,46 @@ list[str] condTypes = ["ifThenTest", "ifThenElseTest"]; test bool testEqTrue(int i) = all (t <- intTypes, - I := prim(t, abs(i) % maxValue(t)), cl <- condTypes, + I := prim(t, abs(i) % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, eq), t, cl, I, I, true)); test bool testEqFalse(int i) = all (t <- intTypes, - I := abs(i) % maxValue(t), cl <- condTypes, + I := abs(i) % maxIntValue(t), cl <- condTypes, testIf(ifCmpClass(t, eq), t, cl, prim(t, I), prim(t, I - 1), false)); test bool testNEqTrue(int i) = all (t <- intTypes, - I := abs(i) % maxValue(t), cl <- condTypes, + I := abs(i) % maxIntValue(t), cl <- condTypes, testIf(ifCmpClass(t, ne), t, cl, prim(t, I), prim(t, I - 1), true)); test bool testNEqFalse(int i) = all (t <- intTypes, - I := prim(t, abs(i) % maxValue(t)), cl <- condTypes, + I := prim(t, abs(i) % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, ne), t, cl, I, I, false)); test bool testLt(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, lt), t, cl, prim(t, I), prim(t, J), I < J)); test bool testGt(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, gt), t, cl, prim(t, I), prim(t, J), I > J)); test bool testGe(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, ge), t, cl, prim(t, I), prim(t, J), I >= J)); test bool testLe(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, le), t, cl, prim(t, I), prim(t, J), I <= J)); diff --git a/src/lang/flybytes/tests/VariableTests.rsc b/src/lang/flybytes/tests/VariableTests.rsc index 933f07b..1eb339a 100644 --- a/src/lang/flybytes/tests/VariableTests.rsc +++ b/src/lang/flybytes/tests/VariableTests.rsc @@ -44,7 +44,7 @@ bool testVarClass(Class c) { list[Type] intTypes = [integer(), long(), short(), character(), byte()]; test bool intVariables(int i) - = all(t <- intTypes, I := i % maxValue(t), testVarClass(primVarTestClass(t, I))); + = all(t <- intTypes, I := i % maxIntValue(t), testVarClass(primVarTestClass(t, I))); list[Type] floatTypes = [float(), double()]; From 3437f3437cf4cb557c6151ca39011a4814e3ed6f Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 25 Jun 2024 20:28:18 +0200 Subject: [PATCH 04/11] Using latest rascal-maven-plugin --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bcfd563..7cdb948 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.27.3 + 0.27.4-RC3 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.2 + 0.40.3-RC2 org.ow2.asm From 60ba8ac1edf4d6f48cac3157da6104d2992edd4d Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Wed, 26 Jun 2024 11:24:05 +0200 Subject: [PATCH 05/11] fixed issues in ArithmeticTests --- src/lang/flybytes/tests/ArithmeticTests.rsc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lang/flybytes/tests/ArithmeticTests.rsc b/src/lang/flybytes/tests/ArithmeticTests.rsc index 7c98e2c..3392e8c 100644 --- a/src/lang/flybytes/tests/ArithmeticTests.rsc +++ b/src/lang/flybytes/tests/ArithmeticTests.rsc @@ -38,7 +38,7 @@ Class unOpClass(Type t, UnOp op) { bool testBinOp(Class c, Type t, num lhs, num rhs, num answer) { m = loadClass(c); - reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); + reply = intVal(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); if (answer != reply) { println("op(,) == != "); @@ -50,7 +50,7 @@ bool testBinOp(Class c, Type t, num lhs, num rhs, num answer) { bool testUnOp(Class c, Type t, num arg, num answer) { m = loadClass(c); - reply = val(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); + reply = intVal(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); if (answer != reply) { println("op() == != "); @@ -62,7 +62,7 @@ bool testUnOp(Class c, Type t, num arg, num answer) { bool testBinOpRange(Class c, Type t, num lhs, num rhs, real answer) { m = loadClass(c); - reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); + reply = realVal(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); if (real r := reply, abs(answer - r) > 0.1) { println("op(,) == != (diff: )"); @@ -74,7 +74,7 @@ bool testBinOpRange(Class c, Type t, num lhs, num rhs, real answer) { bool testUnOpRange(Class c, Type t, num arg, real answer) { m = loadClass(c); - real reply = val(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); + real reply = realVal(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); if (abs(answer - reply) > 0.1) { return false; @@ -114,7 +114,7 @@ test bool testDivInt(int i, int j) testBinOp(binOpClass(t, div), t, I, J, I / J)); test bool testRem(int i, int j) - = all (t <- exactArithmeticTypes + = all (t <- exactArithmeticTypes, I := (i % maxIntValue(t)), J := abs(((j % maxIntValue(t)) / 2)) + 1, // never 0, testBinOp(binOpClass(t, rem), t, I, J, I % J)); @@ -159,7 +159,7 @@ private real round(float(), real f) = precision(f, 0); private real round(double(), real f) = precision(f, 0); private default int round(Type _, int f) = f; -private num val(float(), Mirror r) = r.toValue(#real); -private num val(double(), Mirror r) = r.toValue(#real); -private default num val(Type _, Mirror r) = r.toValue(#int); +private real realVal(float(), Mirror r) = r.toValue(#real); +private real realVal(double(), Mirror r) = r.toValue(#real); +private int intVal(Type _, Mirror r) = r.toValue(#int); From 216dece9124b7663bd475251c7d143b9db4e9fa6 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 2 Jul 2024 16:47:20 +0200 Subject: [PATCH 06/11] Updated to latest rascal-maven plugin --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7cdb948..8f32e3a 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.27.4-RC3 + 0.27.4-RC4 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.3-RC2 + 0.40.3-RC3 org.ow2.asm From 94bd199925c41c7f7209394d8a29e1067cf18bf0 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Fri, 5 Jul 2024 09:45:00 +0200 Subject: [PATCH 07/11] Updated to non-rc version of new rascal release --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8f32e3a..0db9b93 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.27.4-RC4 + 0.27.5 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.3-RC3 + 0.40.4 org.ow2.asm From 7e5611c5ca286a99f8a89c06a242e3b442dc6601 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Tue, 9 Jul 2024 13:52:53 +0200 Subject: [PATCH 08/11] fixed two static errors in Decompiler.rsc; one missing keyword parameter for an overloaded alternative and two different return types for two overloaded alternatives --- src/lang/flybytes/Decompiler.rsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lang/flybytes/Decompiler.rsc b/src/lang/flybytes/Decompiler.rsc index 5992801..476673f 100644 --- a/src/lang/flybytes/Decompiler.rsc +++ b/src/lang/flybytes/Decompiler.rsc @@ -62,7 +62,7 @@ Method decompile(Method m:static([asm(list[Instruction] instrs)]), bool cleanup= return cleanup? m[block=done] : m[block=[asm(withStat)]]; } -Method decompile(Method m) = m when \abstract in m.modifiers; +default Method decompile(Method m, bool cleanup=true) = m when \abstract in m.modifiers; // LINES: data Instruction(int LINE = -1); @@ -612,8 +612,8 @@ BinOp binOp("ALOAD") = aload; alias UnOp = Exp (Exp); -UnOp invertedCond("NULL") = nonnull; -UnOp invertedCond("NONNULL") = null; +UnOp invertedUnaryCond("NULL") = nonnull; +UnOp invertedUnaryCond("NONNULL") = null; Exp nonnull(Exp e) = ne(e, null()); Exp null(Exp e) = eq(e, null()); From 6dab01a16093dd321187b14c1a9ea0848873de40 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Mon, 15 Jul 2024 17:13:57 +0200 Subject: [PATCH 09/11] Using latest versions of rascal and rascal-core --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0db9b93..eb761cb 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.27.5 + 0.28.0-RC1 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.4 + 0.40.6 org.ow2.asm From c5bd08dc9c619de1caaac7fe3a8cf6a808854c5c Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Mon, 22 Jul 2024 14:50:06 +0200 Subject: [PATCH 10/11] Using latest rascal-core maven plugin --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index eb761cb..95caa30 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.28.0-RC1 + 0.28.1 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.6 + 0.40.7 org.ow2.asm From a8f8ee6060e4a01bce67a469486b23a1d99fa9b2 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Thu, 17 Oct 2024 14:48:16 +0200 Subject: [PATCH 11/11] Moved to latest version of rascal-core and rascal --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 95caa30..a7d79ba 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ org.rascalmpl rascal-maven-plugin - 0.28.1 + 0.28.5 false ${project.build.outputDirectory} @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.40.7 + 0.40.11 org.ow2.asm