- JavaScript 78.1%
- HTML 13.6%
- Lua 3.9%
- Vim Script 1.7%
- CSS 1.5%
- Other 1.2%
| deps | ||
| editors/vim | ||
| examples | ||
| games/spirograph | ||
| lib | ||
| original_notes | ||
| scrap | ||
| sites/stk.junglecoder.com | ||
| cli.js | ||
| install.stk | ||
| nstk.sh | ||
| package.json | ||
| project.stk | ||
| qcli.js | ||
| qstk.sh | ||
| README.md | ||
| stkweb.js | ||
| stvm.js | ||
| test | ||
StackTalk
This is a prototype for a language I'm calling StackTalk
The core's core ideas are as follows:
- Quotations, aka code as lists of symbols, that are runtime editable
- Objects, the main contents of which are multiple named stacks
- A global* value stack
- A global* "me" stack, for the current object
The limbs around that core look liek this:
- A handful of syntax sugars that make it easy to write most common shapes of program, nota
-
word[ code ]becomes[ code ] word, which gives more options w/r/t ordering things
-
word[ some code :or some other code ]produces an object that hassome codeas quotation in theprocstack andsome other codein theorstack. This allows writing programs with named and/or optional parts much more easily than in many quotation-based stack languages.
The end result ends up looking like a cross between Io, Smalltalk and Factor:
Account: is-obj[
0.0 >balance
deposit: fn[ balance: += ]
show: fn[ "Account balance: $" balance + /nl + Io .write ]
]
"Initial: " Io .write
Account .show
"Depositing $10" Io .println
Account .[ 10.0 deposit ]
"Final: " Io .write
Account .show
* Global being "global to a given interpreter state".
Trying it out
If you just want to try out a little bit of StackTalk, there's a playground at https://stk.junglecoder.com/playground.html.
Getting started locally
To run stacktalk locally, I recommend using node 22 or a compatible JS runtime. Then you should be able to run ./nstk.sh install.stk to install StackTalk to /home/$USER/.stacktalk, which you can then add to your $PATH to get access to stk on posix systems.
REPL
You can run stk -e repl to get a basic stacktalk REPL going.
Projects
If you want to make utility scripts for a given project/folder
TODOS
- Clean up error handling. Make it possible to request a stack trace?