diff --git a/Cargo.lock b/Cargo.lock index 044cb17..bf964e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "OOLANG" -version = "0.1.0" +version = "0.1.1" dependencies = [ "unicode-segmentation", ] diff --git a/Cargo.toml b/Cargo.toml index b53b65e..2b362f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "OOLANG" -version = "0.1.0" +version = "0.1.1" edition = "2021" authors = ["Joey Harrison "] repository= "https://github.com/RNM-Enterprises/oolang" diff --git a/examples/add.oo b/examples/add.oo new file mode 100644 index 0000000..66ffd72 --- /dev/null +++ b/examples/add.oo @@ -0,0 +1,4 @@ +# program to compute 5 + 10 +O ǾǾǾǾ +O ǾǾǾǾǾǾǾǾǾ +⭕ \ No newline at end of file diff --git a/examples/add.txt b/examples/add.txt deleted file mode 100644 index d1735f1..0000000 --- a/examples/add.txt +++ /dev/null @@ -1,2 +0,0 @@ -PUSH INC INC INC INC -PUSH INC INC INC INC INC INC INC INC INC \ No newline at end of file diff --git a/examples/fibonacci-stack.txt b/examples/fibonacci-stack.txt deleted file mode 100644 index e69de29..0000000 diff --git a/examples/fibonacci.oo b/examples/fibonacci.oo new file mode 100644 index 0000000..0ead9f0 --- /dev/null +++ b/examples/fibonacci.oo @@ -0,0 +1,18 @@ +O +O +O ◯ # store in memory 1 +OǾ◯ # store in memory 2 + +OǾǾǾǾǾ # push 6 (calculate 6th fibonacci number) + +O ◎ # load in memory 1 +OǾ◎ # load in memory 2 +⭕ # add +OǾ◎|O◯ # mov memory 2 to memory 1 +OǾ◯ # store in memory 2 + +Ꮻ +OǾǾǾǾǾǾǾǾǾǾǾǾ +𐍉 # jump to char 14 if not equal to 0 + +OǾ◎ # load in memory 2 \ No newline at end of file diff --git a/examples/multiply.oo b/examples/multiply.oo new file mode 100644 index 0000000..2d245f3 --- /dev/null +++ b/examples/multiply.oo @@ -0,0 +1,16 @@ +O ǾǾǾǾǾ # push 6 to stack +Ꮻ +O ǾǾǾǾǾǾǾǾ # push 9 to stack +O ◯ # store 9 in memory 1 +O ◎ # load 9 back into stack +O Ǿ ◯ # store 9 in memory 2 + +O ◎ # load in memory 1 +O Ǿ ◎ # load in memory 2 +⭕ +O Ǿ ◯ # store result in memory 2 +Ꮻ # decrease counter +O ǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾǾ # push 23 +𐍉 + +O Ǿ ◎ # load answer back in from memory 2 \ No newline at end of file diff --git a/examples/multiply.txt b/examples/multiply.txt deleted file mode 100644 index be62f71..0000000 --- a/examples/multiply.txt +++ /dev/null @@ -1,29 +0,0 @@ -PUSH -INC -INC -INC -INC -INC -DEC -PUSH -INC -INC -INC -INC -INC -INC -INC -INC -PUSH STORE -PUSH INC STORE -PUSH LOAD -PUSH INC LOAD -ADD -PUSH INC STORE -DEC -PUSH 17 -BNZ -PUSH INC LOAD - -mem: 1,9; 2,54 -54 should be end of execution \ No newline at end of file diff --git a/examples/power-of-2.txt b/examples/power-of-2.txt deleted file mode 100644 index 54c6370..0000000 --- a/examples/power-of-2.txt +++ /dev/null @@ -1,17 +0,0 @@ -PUSH -PUSH -STORE -PUSH INC INC INC INC -PUSH -LOAD -PUSH -LOAD -ADD -PUSH -STORE -DEC -JNZ -PUSH -LOAD - -// computes 1 * 2**5 \ No newline at end of file