
a small stack-based language for creating procedural binary graphic (1-bit). run in FORTH-like interpreter, written in lua, hence the name flure (FORTH-like lua).
basically, flure (build-image mode) run in 128px * 128px, correspond to x,y coordinates.
which means it can compute a 1-bit image from simple code like x y ^ 5 % !.
prerequisites
- install lua packages by
sh ./requirements_install.sh, makesureluarocksis already installed.
run
lua main.luafor REPL mode.lua main.lua --build <OPTIONAL_FILE_NAME>, to output 1-bit graphic image.
example codes
x y ^ 5 % !will compute an image as.pbmfile. the procedurals are- start from
xxory - then modulo by
5 - and convert to
1or0by! - the process will be computed in matrix's manner(current size is
128px*128px, these number can be substituted byw,h). - you can try copy
x y ^ 5 % !to the playground to see the result.
- start from
usages
flureuse reverse polish notation (RPN) eg10 10 +=20xandycorrespond to x,y coordinateswandh=128(px),128(px), eg.x w 2 / - w 4 / * y w 2 / - % !try on flure playground- [operators] arithmatics =
+,-,*,/,%,abs(make absolute number) - [operators] bitwise =
&,|,^,<<,>> - [operators] stack =
pop,push,show - [operators] core = (
-1=true,0=false) see example= (equal)<> (not_equal)andor> (greater_than)< (less_than)dup (duplicate)swap2dup (double duplicates)rot (rotate)
- function declaration (or
wordinFORTH's term): <function_name> <...args> ;eg.: loop 1 - dup 0 = if else loop then ; - compile mode =
:, delimited compile mode =; - basic control flow
<condition> if <if_case> else <else_case> then ; - comments =
( <...any_comments_here> ) immediately call a function = eg.: bob 20 20 + ; immediate, will return40without callingbobfunction.- to exit =
bye