~aquaratixc/flow-language

7441d4858e96d2043406effc7542f70068a67ea0 — aquaratixc 4 years ago 3d5324b
Update source
A .dub/build/application-debug-linux.posix-x86_64-dmd_2089-7B0B0A50D607A8718FD9F7A7B9FA53B8/flow => .dub/build/application-debug-linux.posix-x86_64-dmd_2089-7B0B0A50D607A8718FD9F7A7B9FA53B8/flow +0 -0
A .dub/build/application-debug-linux.posix-x86_64-dmd_2089-7B0B0A50D607A8718FD9F7A7B9FA53B8/flow.o => .dub/build/application-debug-linux.posix-x86_64-dmd_2089-7B0B0A50D607A8718FD9F7A7B9FA53B8/flow.o +0 -0
A .dub/build/application-debug-linux.posix-x86_64-dmd_2092-B71FB587BF0EBF430BF2D9A4AC12E428/flow => .dub/build/application-debug-linux.posix-x86_64-dmd_2092-B71FB587BF0EBF430BF2D9A4AC12E428/flow +0 -0
A .dub/build/application-debug-linux.posix-x86_64-dmd_2092-B71FB587BF0EBF430BF2D9A4AC12E428/flow.o => .dub/build/application-debug-linux.posix-x86_64-dmd_2092-B71FB587BF0EBF430BF2D9A4AC12E428/flow.o +0 -0
M dub.sdl => dub.sdl +2 -2
@@ 3,5 3,5 @@ description "Dialect of FALSE Programming language"
authors "Oleg Bakharev" "Ryan Holstien (Scala implementation)"
copyright "Copyright © 2018, Oleg Bakharev, Ryan Holstien (Scala implementation of FALSE)"
license "ESL 1.0"
dflags "-J/home/invertyne/D/flow/source/views/"
postBuildCommands "upx -9 --best --ultra-brute --all-filters --lzma flow"
dflags "-J$PACKAGE_DIR/source/views/"
//postBuildCommands "upx -9 --best --ultra-brute --all-filters --lzma flow"
\ No newline at end of file

M examples/factorials.flow => examples/factorials.flow +1 -1
@@ 1,2 1,2 @@
{Факториалы чисел от 1 до 17}
0i:1f:[i;17=~][i; $."! = " 1+$i: f;$.10, *f:]#
\ No newline at end of file
0i:1f:[i;17=~][i; $."! = " 1+$i: f;$.10, *f:]#

M examples/store.flow => examples/store.flow +2 -2
@@ 1,2 1,2 @@
{absolute value}
[$0>$[]?~[_]?]m:
{sign}
[$0>$[%1]?~[0=~]?]s:

A flow => flow +0 -0
M source/app.d => source/app.d +1 -1
@@ 62,4 62,4 @@ void main(string[] arguments)
			TerminalWriting.error("Missing argument for command-line option\n");
		}
	}
}
}
\ No newline at end of file

M source/core/interpreter.d => source/core/interpreter.d +9 -29
@@ 106,7 106,7 @@ class Flow
			return result;
		}

			// add program fragment
		// add program fragment
		auto addToProgram(int position, string program, string func)
		{
			string programBegin = program[0..position+1];


@@ 199,16 199,10 @@ class Flow
								stack.push("0");
							}
							break;
						// logical not
						// bitwise not
						case '~':
							if (stack.pop == "0")
							{
								stack.push("-1");
							}
							else
							{
								stack.push("0");
							}
							int a = stack.pop.to!int;
							stack.push((~a).to!string);
							break;
						// greather than
						case '>':


@@ 223,31 217,17 @@ class Flow
								stack.push("0");
							}
							break;
						// logical and
						// bitwise and
						case '&':
							int a = stack.pop.to!int;
							int b = stack.pop.to!int;
							if ((a == 0) || (b == 0))
							{
								stack.push("0");
							}
							else
							{
								stack.push("-1");
							}
							stack.push((a & b).to!string);
							break;
						// logical or
						// bitwise or
						case '|':
							int a = stack.pop.to!int;
							int b = stack.pop.to!int;
							if ((a == -1) || (b == -1))
							{
								stack.push("-1");
							}
							else
							{
								stack.push("0");
							}
							stack.push((a | b).to!string);
							break;
						// duplicate
						case '$':


@@ 297,7 277,7 @@ class Flow
							{
								string result = stack.pop;
								stdout.write(result);
							}							
							}					
							break;
						// write character
						case ',':

M source/core/repl.d => source/core/repl.d +11 -2
@@ 87,8 87,10 @@ auto startREPL(Flow interpreter)
		string command = to!string(expression);
		
		// interpreters command
		switch (command.strip.toLower)
		switch (command.strip.toLower.chomp)
		{
			case "":
				break;
			// about program
			case ":about":
				write(ABOUT);


@@ 136,7 138,14 @@ auto startREPL(Flow interpreter)
				}
				catch(Throwable)
				{
					TerminalWriting.error("Invalid command(s)");
					if (previousCommand != (cast(char) 10).to!string)
					{
						TerminalWriting.error("Invalid command(s)");
					}
					else
					{
						previousCommand = "";
					}
				}
				break;
		}

A test.ppm => test.ppm +4 -0
@@ 0,0 1,4 @@
P6
255
2 79
67$,['!--$,]x:47+$,'.x;!'%x;!19+$,'0x;!'"x;!'D-$,66+$,23+$,'Y-$,44+$,29+$,'#x;!1+$,12+$,',-$,39+$,6+$,'#x;!'/x;!'E-$,51+$,28+$,'*x;!14+$,3+$,'7x;!17+$,'.x;!% 
\ No newline at end of file