WIP stack-based compiled concatenative programming language.
Currently is developement is postponed, due to other projects (and university) with higher priority.
It's somewhere between B and C programming languages in universe where B was stack based concatenative language.
- Turing completness
- Optional type checking
- Low level OS access ability
# hello.stacky
"io" import
"hello, world" puts nl
$ stacky run hello.stacky
hello, world
# date.stacky
"io" import
"time" import
"Date is " puts
now # returns seconds in Unix time
date # returns year, month, day, hours, minutes
putu "-" puts
2 aputu "-" puts
2 aputu " " puts
2 aputu ":" puts
2 aputu nl
$ stacky run date.stacky
Date is 2021-10-17 23:13
Consumes top of the stack. If value was nonzero, executes if branch, otherwise else branch.
"io" import
10 if "value is 10!" else "value is not 10 :c" end puts nl
While condition part (between while
and do
) is nonzero, executes repeatadly loop part (between do
and end
).
# puts numbers from 0 to 10
"io" import
0 while dup 11 = ! do
dup .
1 +
end
<name> fun <code> end
creates function with given name and code block.
"io" import
say-hello fun "Hi, " puts puts "!\n" puts end
"Mark" say-hello # prints "Hi, Mark!"
&<name>
puts <name>
address onto stack, for example: &foo
call
calls function pointed by address on top of the stack.
"Mark" &say-hello call
uniform32
-(a b -- n)
returns random integern
in range[a, b]
nl
- putss newline to stdoutputs
-(pointer --)
- prints null terminated string to stdout.
-(uint --)
- puts unsigned integer to stdout with a newline at the end
Max_Digits10
-(-- uint)
- returns maximum number of decimal digits that unsigned integer may have
-
now
-(-- seconds)
- returns number of seconds since Unix time -
sleep
-(seconds --)
- sleeps given number of seconds -
date
-(seconds -- year month day hours minutes)
- decomposes seconds since Unix time into human readable form -
+minutes
-(minutes seconds -- seconds)
- adds minutes to seconds -
+hours
-(hours seconds -- seconds)
- adds hours to seconds -
+days
-(days seconds -- seconds)
- adds days to seconds -
+weeks
-(weekds seconds -- seconds)
- adds weeks to seconds -
-minutes
-(minutes seconds -- seconds)
- subtracts minutes from seconds -
-hours
-(hours seconds -- seconds)
- subtracts hours from seconds -
-days
-(days seconds -- seconds)
- subtracts days from seconds -
-weeks
-(weekds seconds -- seconds)
- subtracts weeks from seconds
Contains definition of constants related to POSIX compatible operating systems.
SYS_<syscall>
- constants holding syscall numbers, likeSYS_exit
=60
stdin
,stdout
,stderr
CLOCK_<type>
- definition of clocks constants forclock_gettime
syscall
make install-nvim
- installs Stacky's syntax highlighting for Neovimmake stacky
- makes only compilermake test
- runs all testsmake clean
- cleans all intermidiate files
- NASM
- LD
- GCC with C++ compiler for compiler and stdlib compilation
- Boost Program_Options
For Arch-based users:
pacman -S gcc binutils nasm boost