From 660ef68f7eb63ce55716194cf4d4c5e9510f9e41 Mon Sep 17 00:00:00 2001 From: Fayez Abu Alia Date: Wed, 20 Jun 2018 18:07:17 +0200 Subject: [PATCH] generateBytecode() um Parameter path erweitert. Alle Tests angepasst --- .../bytecode/BytecodeGenMethod.java | 2 ++ src/de/dhbwstuttgart/core/JavaTXCompiler.java | 11 +++--- test/bytecode/BinaryTest.java | 2 +- test/bytecode/FacTest.java | 2 +- test/bytecode/GenTest.java | 2 +- test/bytecode/GreaterEqualTest.java | 2 +- test/bytecode/GreaterThanTest.java | 2 +- test/bytecode/LambdaTest.java | 2 +- test/bytecode/LessEqualTest.java | 2 +- test/bytecode/LessThanTest.java | 2 +- test/bytecode/MatrixTest.java | 2 +- test/bytecode/OLTest.java | 2 +- test/bytecode/OpTest.java | 2 +- test/bytecode/OverloadingTest.java | 2 +- test/bytecode/PlusTest.java | 3 +- test/bytecode/PostIncTest.java | 2 +- test/bytecode/PreIncTest.java | 2 +- test/bytecode/RelOpsTest.java | 2 +- test/bytecode/StaticTest.java | 2 +- test/bytecode/Tph2Test.java | 2 +- test/bytecode/TphTest.java | 2 +- test/bytecode/WhileTest.java | 2 +- test/logFiles/.log.swp | Bin 0 -> 12288 bytes test/logFiles/log | 34 ++++++++++++++++++ 24 files changed, 62 insertions(+), 26 deletions(-) create mode 100644 test/logFiles/.log.swp create mode 100644 test/logFiles/log diff --git a/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index edec62e7..bead57c1 100644 --- a/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -636,6 +636,8 @@ public class BytecodeGenMethod implements StatementVisitor { @Override public void visit(MethodCall methodCall) { + //ClassLoader.getSystemClassLoader().loadClass(className).getMethod(name, parameterTypes) + System.out.println("Methodcall type : " + resultSet.resolveType(methodCall.getType()).resolvedType.acceptTV(new TypeToDescriptor())); methodCall.receiver.accept(this); methodCall.arglist.accept(this); diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index 8646b484..bccb88aa 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -240,8 +240,8 @@ public class JavaTXCompiler { SourceFile ret = generator.convert(tree, environment.packageCrawler); return ret; } - - public void generateBytecode() throws ClassNotFoundException, IOException { + // um pfad erweitern + public void generateBytecode(String path) throws ClassNotFoundException, IOException { for(File f : sourceFiles.keySet()) { HashMap classFiles = new HashMap<>(); SourceFile sf = sourceFiles.get(f); @@ -249,16 +249,17 @@ public class JavaTXCompiler { BytecodeGen bytecodeGen = new BytecodeGen(classFiles,typeinferenceResult); // BytecodeGen bytecodeGen = new BytecodeGen(classFiles,typeinferenceResult.get(0)); bytecodeGen.visit(sf); - this.writeClassFile(bytecodeGen.getClassFiles()); + this.writeClassFile(bytecodeGen.getClassFiles(), path); } } - private void writeClassFile(HashMap classFiles) throws IOException { + private void writeClassFile(HashMap classFiles, String path) throws IOException { FileOutputStream output; for(String name : classFiles.keySet()) { byte[] bytecode = classFiles.get(name); System.out.println("generating "+name+ ".class file ..."); - output = new FileOutputStream(new File(System.getProperty("user.dir") + "/testBytecode/generatedBC/" +name+".class")); + //output = new FileOutputStream(new File(System.getProperty("user.dir") + "/testBytecode/generatedBC/" +name+".class")); + output = new FileOutputStream(new File(path +name+".class")); output.write(bytecode); output.close(); System.out.println(name+".class file generated"); diff --git a/test/bytecode/BinaryTest.java b/test/bytecode/BinaryTest.java index 7f2f5fa4..07a70d54 100644 --- a/test/bytecode/BinaryTest.java +++ b/test/bytecode/BinaryTest.java @@ -25,8 +25,8 @@ public class BinaryTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/BinaryInMeth.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("BinaryInMeth"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/FacTest.java b/test/bytecode/FacTest.java index c4cab24e..f5dd86ea 100644 --- a/test/bytecode/FacTest.java +++ b/test/bytecode/FacTest.java @@ -27,8 +27,8 @@ public class FacTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Fac.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Fac"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/GenTest.java b/test/bytecode/GenTest.java index d0067d08..e8ca6938 100644 --- a/test/bytecode/GenTest.java +++ b/test/bytecode/GenTest.java @@ -26,8 +26,8 @@ public class GenTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Gen.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Gen"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/GreaterEqualTest.java b/test/bytecode/GreaterEqualTest.java index c65a4015..b60c446c 100644 --- a/test/bytecode/GreaterEqualTest.java +++ b/test/bytecode/GreaterEqualTest.java @@ -28,8 +28,8 @@ public class GreaterEqualTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/GreaterEqual.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("File://"+pathToClassFile)}); classToTest = loader.loadClass("GreaterEqual"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/GreaterThanTest.java b/test/bytecode/GreaterThanTest.java index 8ab07ff1..1a460a8c 100644 --- a/test/bytecode/GreaterThanTest.java +++ b/test/bytecode/GreaterThanTest.java @@ -28,8 +28,8 @@ public class GreaterThanTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/GreaterThan.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("File://"+pathToClassFile)}); classToTest = loader.loadClass("GreaterThan"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/LambdaTest.java b/test/bytecode/LambdaTest.java index f29690cb..72d21f54 100644 --- a/test/bytecode/LambdaTest.java +++ b/test/bytecode/LambdaTest.java @@ -16,7 +16,7 @@ public class LambdaTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Lambda.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); + compiler.generateBytecode(System.getProperty("user.dir")+"/testBytecode/generatedBC/"); } diff --git a/test/bytecode/LessEqualTest.java b/test/bytecode/LessEqualTest.java index de9cdb8c..dc439af9 100644 --- a/test/bytecode/LessEqualTest.java +++ b/test/bytecode/LessEqualTest.java @@ -28,8 +28,8 @@ public class LessEqualTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/LessEqual.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("LessEqual"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/LessThanTest.java b/test/bytecode/LessThanTest.java index 6846f820..99eba80c 100644 --- a/test/bytecode/LessThanTest.java +++ b/test/bytecode/LessThanTest.java @@ -28,8 +28,8 @@ public class LessThanTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/LessThan.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("LessThan"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/MatrixTest.java b/test/bytecode/MatrixTest.java index 98884151..db8dc8ab 100644 --- a/test/bytecode/MatrixTest.java +++ b/test/bytecode/MatrixTest.java @@ -25,8 +25,8 @@ public class MatrixTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Matrix.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Matrix"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/OLTest.java b/test/bytecode/OLTest.java index ff91073e..288e580f 100644 --- a/test/bytecode/OLTest.java +++ b/test/bytecode/OLTest.java @@ -25,8 +25,8 @@ public class OLTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/OL.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("OL"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/OpTest.java b/test/bytecode/OpTest.java index 1d213a78..3909f0cd 100644 --- a/test/bytecode/OpTest.java +++ b/test/bytecode/OpTest.java @@ -28,8 +28,8 @@ public class OpTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Op.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Op"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/OverloadingTest.java b/test/bytecode/OverloadingTest.java index 294bf533..6b4bf8eb 100644 --- a/test/bytecode/OverloadingTest.java +++ b/test/bytecode/OverloadingTest.java @@ -30,8 +30,8 @@ public class OverloadingTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Overloading.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Overloading"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/PlusTest.java b/test/bytecode/PlusTest.java index 51503c58..85f05b75 100644 --- a/test/bytecode/PlusTest.java +++ b/test/bytecode/PlusTest.java @@ -27,9 +27,8 @@ public class PlusTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Plus.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); - pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Plus"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/PostIncTest.java b/test/bytecode/PostIncTest.java index 36e63816..6c3ebc33 100644 --- a/test/bytecode/PostIncTest.java +++ b/test/bytecode/PostIncTest.java @@ -27,8 +27,8 @@ public class PostIncTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/PostIncDec.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("PostIncDec"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/PreIncTest.java b/test/bytecode/PreIncTest.java index 434b88e1..29feac33 100644 --- a/test/bytecode/PreIncTest.java +++ b/test/bytecode/PreIncTest.java @@ -27,8 +27,8 @@ public class PreIncTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/PreInc.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://" + pathToClassFile)}); classToTest = loader.loadClass("PreInc"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/RelOpsTest.java b/test/bytecode/RelOpsTest.java index 06b24630..1bdf1a1d 100644 --- a/test/bytecode/RelOpsTest.java +++ b/test/bytecode/RelOpsTest.java @@ -27,8 +27,8 @@ public class RelOpsTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/RelOps.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("RelOps"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/StaticTest.java b/test/bytecode/StaticTest.java index f639645c..98642b4e 100644 --- a/test/bytecode/StaticTest.java +++ b/test/bytecode/StaticTest.java @@ -26,8 +26,8 @@ public class StaticTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/StaticM.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://" + pathToClassFile)}); classToTest = loader.loadClass("StaticM"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/Tph2Test.java b/test/bytecode/Tph2Test.java index 4cda4148..de706431 100644 --- a/test/bytecode/Tph2Test.java +++ b/test/bytecode/Tph2Test.java @@ -26,8 +26,8 @@ public class Tph2Test { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Tph2.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Tph2"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/TphTest.java b/test/bytecode/TphTest.java index 449db765..92b786ce 100644 --- a/test/bytecode/TphTest.java +++ b/test/bytecode/TphTest.java @@ -25,8 +25,8 @@ public class TphTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Tph.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Tph"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/bytecode/WhileTest.java b/test/bytecode/WhileTest.java index 5690facb..b3020ffe 100644 --- a/test/bytecode/WhileTest.java +++ b/test/bytecode/WhileTest.java @@ -27,8 +27,8 @@ public class WhileTest { path = System.getProperty("user.dir")+"/test/bytecode/javFiles/While.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; + compiler.generateBytecode(pathToClassFile); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("While"); instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); diff --git a/test/logFiles/.log.swp b/test/logFiles/.log.swp new file mode 100644 index 0000000000000000000000000000000000000000..4741e023f9dbf0f22cc572b45749ba9d1a316006 GIT binary patch literal 12288 zcmeI2O>fgc5Qe85Y55TRfuV4)QR>9yf&vvP{SeS54M__Utq+c~Y12Bkv0c8ZQi(Gh zLF$!Xz=1PIIQ0Y)oVX(KD|pv9RT>F_dZ<)1mR{}d?9A-s+3_Jtnx%WUD}2=|5uUR| zU!%**U)+(Q;U7e8_o;fO?SFY@wO=w;alM;ixG`3XL(306*B=afo+T_!hmQk4bX!UB zj{C@+3cFFqSMgLBt758>wCIPcv#=z3GMGZvLO=){n!qW#GHz$D`o+-;eE!_hp)*OK z5D)@FKnMr{As_^VfDjM@$B#f74bcwDK9QF`nvX*RW4@F@2nYcoAOwVf5D)@FKnMr{ zAs_^VfDkx_1l$(U-btc|!zdoV|M$NC@0}rf550k2Lpx9#a-bFH0aS%5P!Sr1ex4@! z41Iz=Lhqnm=oR!5dI2TSD%6Hnpl_#$-a@<3CFsKl@}ap7{pttW58d_e?MK_C-e(}@ZL?fntli@K zm@_Avk%|q&G_PTal!j?+5vDz_Ma-FFm2SoX8_hhnk$EFYox9_P&eq`OK;+#6k!~J2 zuOpcaFJD)Af(;{G>m<2h!9vFUgDPfjuKkYFM^)MD9Y4q2?DTnd3#|7lc^RJXCfP0U z7HtzvtHjIhuof#lS;zm~E#D1Rt%c^g@=}Ko9<5Ex_^MmxYS>Z+mgauopnvA=&>yqS QPL)@-27~&u5AK=t3(Y4>{r~^~ literal 0 HcmV?d00001 diff --git a/test/logFiles/log b/test/logFiles/log new file mode 100644 index 00000000..72e1f029 --- /dev/null +++ b/test/logFiles/log @@ -0,0 +1,34 @@ +FC:\{java.lang.Object=Elem: Node(java.lang.Object) +Prec: [java.lang.Object] +Desc: [java.lang.Object, Tph] + +, Tph=Elem: Node(Tph) +Prec: [java.lang.Object] +Desc: [] + +} +class Tph { + + TPH K m(TPH L a, TPH M b)({ + TPH N c; + (c)::TPH N = ((this)::TPH O.m2((b)::TPH M))::TPH P; + return (a)::TPH L; + })::TPH Q + + TPH R m2(TPH S b)({ + return (b)::TPH S; + })::TPH T + + Tph()({ + super(()); + })::TPH W + +}0 AA: [] +1 Unifikation: [(L <. K, 1, -1), (R =. P, -1, -1), (O =. Tph, 0), (S <. R, 1, -1), (O <. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)] +nextSet: [[(O =. Tph, 0)], [(O =. ? extends Tph, 0)]] +1 AA: [] +2 Unifikation: [(L <. K, 1, -1), (R =. P, -1, -1), (S <. P, 1, -1), (O =. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)] +[(L <. K, 1, -1), (R =. P, -1, -1), (S <. P, 1, -1), (O =. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)] +Result1 [[(L <. K, 1, -1), (R =. P, -1, -1), (S <. P, 1, -1), (O =. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)]] +Result1 [[(L <. K, 1, -1), (R =. P, -1, -1), (S <. P, 1, -1), (O =. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)]] +RES: [[(L <. K, 1, -1), (R =. P, -1, -1), (S <. P, 1, -1), (O =. Tph, 0), (P <. N, -1, -1), (M <. S, 1, 1)]]