A Forth system implemented in Dart.
- π An interface-independent library.
- π Includes a Command Line Interface.
- π Includes a Web Interface. π
- β Forth Standard compliant. π
- π Supports UTF-8.
- Manipulate the Canvas.
- Manipulate the DOM.
- Interface with JavaScript.
- The interactive interpreter from the CLI interface is pretty functional.
- Already implemented are almost all the words for: text interpreting, manipulating the stacks, mathematical operations (floats included), storing and fetching to the data space, and programming tools.
- Still many essential Forth primitives are not implemented yet, like for: defining words, saving and manipulating strings and control structures.
You'll first need to install the appropriate version of Dart for your system. And then you could either:
-
Simply activate the package.
This is the quickest way of installing and running a snapshot of the forandar CLI.
pub global activate --sgit https://github.com/andamira/forandar.git
To update the package, just run the same command again.
-
Clone the project.
Useful for tinkering with the sourcecode and also trying out the web interface.
git clone https://github.com/andamira/forandar cd forandar pub get
Then you can activate the
forandar
command for global execution like this:pub global activate --source path ./
Usage Examples
-
To enter the interpretation console:
forandar
-
To see the help screen:
forandar -h
-
To evaluate Forth source code from a string, and exit:
forandar -e "2 3 + . bye"
-
To include Forth source code from a file:
forandar -i "path/to/forth-source.fs"
-
You can evaluate strings and include files in any number and combination:
forandar -e "1 2 swap .s" -i forth-source.fs -e "1e 2.7e 3e / .fs"`
Once you have cloned this project, there are several ways to try the web interface. For example:
- Run
pub serve
from the project directory and then visithttp://localhost:8080
. You can either use the Dartium browser (useful while developing) or a normal web browser (in which case you'll have to wait for the javascript transpilation to finish). - Build the web interface with
pub build
and open the file./build/web/index.html
with any browser. You could also deploy thebuild/web/
directory to a production server.
Usage Examples
This interface is not functional yet.