gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
samples renamed to more logical names
authorDoni Pracner <quinnuendo@gmail.com>
Fri, 24 Jan 2014 12:23:21 +0000 (13:23 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Fri, 24 Jan 2014 12:23:21 +0000 (13:23 +0100)
samples/eratos.mj [new file with mode: 0644]
samples/pos-neg.mj [new file with mode: 0644]
samples/sample-ext.mj [deleted file]
samples/sample.mj [deleted file]
samples/sample0-h1.wsl [deleted file]
samples/sample0.mj [deleted file]
samples/sample0.wsl [deleted file]
samples/sample1.mj [deleted file]
samples/while-print.mj [new file with mode: 0644]

diff --git a/samples/eratos.mj b/samples/eratos.mj
new file mode 100644 (file)
index 0000000..620bd2d
--- /dev/null
@@ -0,0 +1,38 @@
+program Eratos\r
+\r
+       char[] sieve;\r
+       int max;                // maximum prime to be found\r
+       int npp;                // numbers per page\r
+\r
+{\r
+       void put(int x)\r
+       {\r
+               if (npp == 10) {print(chr(13)); print(chr(10)); npp = 0;}\r
+               print(x, 5);\r
+               npp++;\r
+       }\r
+       \r
+       void found(int x)\r
+               int i;\r
+       {\r
+               put(x);\r
+               i = x;\r
+               while (i <= max) {sieve[i] = 'o'; i = i + x;}\r
+       }\r
+\r
+       void main()\r
+               int i;\r
+       {\r
+               read(max);\r
+               npp = 0;\r
+               sieve = new char[max+1];\r
+               i = 0;\r
+               while (i <= max) {sieve[i] = 'x'; i++;}\r
+               i = 2;\r
+               while (i <= max) {\r
+                       found(i);\r
+                       while(i <= max && sieve[i] == 'o') i++;\r
+               }\r
+       }\r
+\r
+}//test
\ No newline at end of file
diff --git a/samples/pos-neg.mj b/samples/pos-neg.mj
new file mode 100644 (file)
index 0000000..5bf3771
--- /dev/null
@@ -0,0 +1,40 @@
+program P
+       final int size = 10;
+       class Table {
+               int[] pos;
+               int[] neg;
+       }
+       Table val;
+{
+       void main()
+               int x, i;
+       { //---------- Initialize val
+               val = new Table;
+               val.pos = new int[size]; val.neg = new int[size];
+               i = 0;
+               while (i < size) {
+                       val.pos[i] = 0; val.neg[i] = 0;
+                       i++;
+               }
+       //---------- Read values
+               read(x);
+               while (x != 0) {
+                       if (0 <= x && x < size) {
+                               val.pos[x]++;
+                       } else if (-size < x && x < 0) {
+                               val.neg[-x]++;
+                       }
+                       read(x);
+               }
+       
+       // output everything
+               i = 0;
+               while (i < size) {
+                       print(i,3);
+                       print(val.pos[i],5);
+                       print(val.neg[i],5);
+                       print(chr(10));
+                       i++;
+               }
+       }
+}
diff --git a/samples/sample-ext.mj b/samples/sample-ext.mj
deleted file mode 100644 (file)
index 5bf3771..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-program P
-       final int size = 10;
-       class Table {
-               int[] pos;
-               int[] neg;
-       }
-       Table val;
-{
-       void main()
-               int x, i;
-       { //---------- Initialize val
-               val = new Table;
-               val.pos = new int[size]; val.neg = new int[size];
-               i = 0;
-               while (i < size) {
-                       val.pos[i] = 0; val.neg[i] = 0;
-                       i++;
-               }
-       //---------- Read values
-               read(x);
-               while (x != 0) {
-                       if (0 <= x && x < size) {
-                               val.pos[x]++;
-                       } else if (-size < x && x < 0) {
-                               val.neg[-x]++;
-                       }
-                       read(x);
-               }
-       
-       // output everything
-               i = 0;
-               while (i < size) {
-                       print(i,3);
-                       print(val.pos[i],5);
-                       print(val.neg[i],5);
-                       print(chr(10));
-                       i++;
-               }
-       }
-}
diff --git a/samples/sample.mj b/samples/sample.mj
deleted file mode 100644 (file)
index 8442ca8..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-program P\r
-       final int size = 10;\r
-       class Table {\r
-               int[] pos;\r
-               int[] neg;\r
-       }\r
-       Table val;\r
-{\r
-       void main()\r
-               int x, i;\r
-       { //---------- Initialize val\r
-               val = new Table;\r
-               val.pos = new int[size]; val.neg = new int[size];\r
-               i = 0;\r
-               while (i < size) {\r
-                       val.pos[i] = 0; val.neg[i] = 0;\r
-                       i++;\r
-               }\r
-       //---------- Read values\r
-               read(x);\r
-               while (x != 0) {\r
-                       if (0 <= x && x < size) {\r
-                               val.pos[x]++;\r
-                       } else if (-size < x && x < 0) {\r
-                               val.neg[-x]++;\r
-                       }\r
-                       read(x);\r
-               }\r
-       }\r
-}\r
diff --git a/samples/sample0-h1.wsl b/samples/sample0-h1.wsl
deleted file mode 100644 (file)
index 905cb16..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-C:" This file automatically converted from microjava bytecode";
-C:" with mjc2wsl v 0.1";
-VAR < tempa := 0, tempb := 0, tempres :=0,
-loc0 := 0, loc1 := 0, loc2 := 0, loc3 := 0, 
-       estack := < >, t_e_m_p := 0 > :
- ACTIONS A_S_start:
- A_S_start == 
-
-C:" enter not fully procesed yet";
-estack := <0 > ++ estack;
-loc0 := HEAD(estack); estack := TAIL(estack);
-CALL a19 END
-a19 ==
-estack := <loc0 > ++ estack;
-estack := <5 > ++ estack;
-tempa := HEAD(estack); estack := TAIL(estack);
-tempb := HEAD(estack); estack := TAIL(estack);
-C:" IF CALL 13";
-IF tempb >= tempa THEN CALL a34 FI;
-estack := <loc0 > ++ estack;
-estack := <0 > ++ estack;
-tempa := HEAD(estack); estack := TAIL(estack);
-tempa := HEAD(estack); estack := TAIL(estack);
-PRINT(tempa);
-estack := <loc0 > ++ estack;
-estack := <1 > ++ estack;
-tempa := HEAD(estack); estack := TAIL(estack);
-tempb := HEAD(estack); estack := TAIL(estack);
-tempres := tempb + tempa;
-estack := <tempres > ++ estack;
-loc0 := HEAD(estack); estack := TAIL(estack);
-C:" CALL -12";
-CALL a19 END
-a34 ==
-C:" exit not fully procesed yet";
-C:" return not fully procesed yet";
-CALL Z
-END
-ENDACTIONS;
-SKIP
-ENDVAR
diff --git a/samples/sample0.mj b/samples/sample0.mj
deleted file mode 100644 (file)
index cdc0851..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-program P\r
-{\r
-       void main()\r
-               int i;\r
-       { \r
-               i = 0;\r
-               while (i < 5) {\r
-                       print(i);\r
-                       i = i + 1;\r
-               }\r
-       }\r
-}\r
diff --git a/samples/sample0.wsl b/samples/sample0.wsl
deleted file mode 100644 (file)
index 7fcb024..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-C:" This file automatically converted from microjava bytecode";
-C:" with mjc2wsl v 0.1.2";
-VAR < tempa := 0, tempb := 0, tempres :=0,
-loc0 := 0, loc1 := 0, loc2 := 0, loc3 := 0, 
-       estack := < >, t_e_m_p := 0 > :
-SKIP;
- ACTIONS A_S_start:
- A_S_start == CALL a14 END
-a14 == 
-C:" enter not fully procesed yet";
-CALL a17 END
-a17 == 
-estack := <0 > ++ estack;
-CALL a18 END
-a18 == 
-loc0 := HEAD(estack); estack := TAIL(estack);
-CALL a19 END
-a19 == 
-estack := <loc0 > ++ estack;
-CALL a20 END
-a20 == 
-estack := <5 > ++ estack;
-CALL a21 END
-a21 == 
-tempa := HEAD(estack); estack := TAIL(estack);
-tempb := HEAD(estack); estack := TAIL(estack);
-IF tempb >= tempa THEN CALL a34 FI;
-CALL a24 END
-a24 == 
-estack := <loc0 > ++ estack;
-CALL a25 END
-a25 == 
-estack := <0 > ++ estack;
-CALL a26 END
-a26 == 
-tempa := HEAD(estack); estack := TAIL(estack);
-tempb := HEAD(estack); estack := TAIL(estack);
-PRINT(tempb);
-CALL a27 END
-a27 == 
-estack := <loc0 > ++ estack;
-CALL a28 END
-a28 == 
-estack := <1 > ++ estack;
-CALL a29 END
-a29 == 
-tempa := HEAD(estack); estack := TAIL(estack);
-tempb := HEAD(estack); estack := TAIL(estack);
-tempres := tempb + tempa;
-estack := <tempres > ++ estack;
-CALL a30 END
-a30 == 
-loc0 := HEAD(estack); estack := TAIL(estack);
-CALL a31 END
-a31 == 
-CALL a19;
-CALL a34 END
-a34 == 
-C:" exit not fully procesed yet";
-CALL a35 END
-a35 == 
-C:" return not fully procesed yet";
-CALL Z;
-SKIP END
-ENDACTIONS;
-
-SKIP
-ENDVAR
diff --git a/samples/sample1.mj b/samples/sample1.mj
deleted file mode 100644 (file)
index 620bd2d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-program Eratos\r
-\r
-       char[] sieve;\r
-       int max;                // maximum prime to be found\r
-       int npp;                // numbers per page\r
-\r
-{\r
-       void put(int x)\r
-       {\r
-               if (npp == 10) {print(chr(13)); print(chr(10)); npp = 0;}\r
-               print(x, 5);\r
-               npp++;\r
-       }\r
-       \r
-       void found(int x)\r
-               int i;\r
-       {\r
-               put(x);\r
-               i = x;\r
-               while (i <= max) {sieve[i] = 'o'; i = i + x;}\r
-       }\r
-\r
-       void main()\r
-               int i;\r
-       {\r
-               read(max);\r
-               npp = 0;\r
-               sieve = new char[max+1];\r
-               i = 0;\r
-               while (i <= max) {sieve[i] = 'x'; i++;}\r
-               i = 2;\r
-               while (i <= max) {\r
-                       found(i);\r
-                       while(i <= max && sieve[i] == 'o') i++;\r
-               }\r
-       }\r
-\r
-}//test
\ No newline at end of file
diff --git a/samples/while-print.mj b/samples/while-print.mj
new file mode 100644 (file)
index 0000000..cdc0851
--- /dev/null
@@ -0,0 +1,12 @@
+program P\r
+{\r
+       void main()\r
+               int i;\r
+       { \r
+               i = 0;\r
+               while (i < 5) {\r
+                       print(i);\r
+                       i = i + 1;\r
+               }\r
+       }\r
+}\r
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner