Skip to content

aprell/spill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spill

spill is a tiny stack-based programming language that borrows ideas from Forth and Factor. The interpreter is written in Python. A previous version of spill was implemented in the MoonScript dialect of Lua.

Examples

Start the REPL with ./spill.

Say hello:

spill> "Hello, spill!" print
Hello, spill!

Evaluate simple expressions:

spill> 1 2 3 + / .
0.2

Define and use functions:

spill> : ++ 1 + ;
spill> 42 ++ .
43

Apply quotations with combinators:

spill> 1 2 3 [ ++ ] dip
spill> show
[1, 3, 3]

Inspect generated "bytecode":

spill> [ 3 0 > if "yes" else "no" then . ] spill show
[push, 3, push, 0, >, branch?, 11, push, yes, branch, 13, push, no, .]

Check src/prelude.spill for more examples.

TODO

Stuff that could be added to make the language more useful:

  • Stack effect comments
  • Better control constructs
  • Proper support for strings and sequences
  • Map/dictionary data type
  • Vocabularies of words

References

Forth

Factor

Other

About

A tiny stack-based programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published