Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/ Staple Public archive

A stack-oriented, interpreted, minimal programming language

License

Notifications You must be signed in to change notification settings

wandernauta/Staple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Staple logo

Staple

Staple is a minimalistic ('esoteric'), interpreted language based around stack manipulation. It resembles languages like Forth and Factor, but also takes ideas from the likes of Lisp (code is data in Staple) and Smalltalk (it has symbols). Everything (everything) in Staple is in postfix notation.

What does Staple code look like?

Here's a program that calculates the circumference of a circle:

[
  /* Ask the user about their circle's radius, convert the input */
  " What's the radius of your circle? " prompt float

  /* Multiply that with two pi */
  3.14 2 * *

  /* Print the result as a string */
  " Your circle's circumference is about " print
  string println

  " " println
] loop

What's different?

Staple doesn't care about whether you use spaces, newlines or tabs, but whitespace is important in Staple. In other languages, ((4+2)==6) may be perfectly valid - in Staple, it's 4 2 + 6 eq. Even the spaces around double quotes are non-optional (although that may change in the near future).

Staple will never automagically cast values from one type to another (not even integers to floating point values or booleans to integers).

Everything in Staple is in postfix notation. 'if' is a no-op that exists for readability reasons, and carries no meaning at all for Staple.

Building and contributing

To build the interpreter, just run make in the Interpreter directory. There is no ./configure.

The Staple interpreter is released under the MIT license. Contributions are more than welcome, as are bug reports. Fork away!

About

A stack-oriented, interpreted, minimal programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published