hikari-no-yume / Firth

Firth is a functional, strongly dynamically-typed, concatenative stack-oriented programming language.
Other
29 stars 2 forks source link

The Firth Programming Language

Firth is a functional, strongly dynamically-typed, concatenative stack-oriented programming language. Here's a program calculating the factorial of 5 written in it:

/factorial [
    dup. 1 gt.
    [
        dup. 1 sub.
        factorial. mul.
    ] [
        drop. 1
    ] ifelse.
] def.

5 factorial. print.

And here are some of its features:

Please note: Firth is in early development and any and all features are subject to change. Features that are implemented may not be implemented well, features may be implemented that the specification does not define, the specification may define features that are not implemented, etc. The specification is very much incomplete.

Interested? Great! Check out the following files in the /docs directory:

Or, read on to learn how to get Firth up and running!

Usage

The (incomplete) implementation is currently written in JavaScript, and you'll need node.js to buld it.

Use npm to install the dependencies:

$ npm install

Now you can try out the REPL:

$ ./bin/firth.js

Or, you can use gulp (npm install -g gulp) to compile the interpreter into a single file:

$ gulp

And try out test.html in your browser, which lets you type in Firth code and execute it, seeing its tokenised and parsed forms.