Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcascaval/forth
https://github.com/dcascaval/forth
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dcascaval/forth
- Owner: dcascaval
- Created: 2019-01-12T01:08:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-14T01:35:06.000Z (about 6 years ago)
- Last Synced: 2024-11-05T23:19:45.942Z (2 months ago)
- Language: OCaml
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Forth Interpreter
Interprets a subset of Forth, including arithmetic, branching, loops, and some basic I/O.
Some conventions:
* All tokens must be strictly space delimited. This includes comment starts, ends, etc.
* Interpreter-defined tokens are in all-caps, such as `DROP`,`SWAP`,`IF`... `ELSE` ... `THEN`, etc.
* Loop indices are denoted as `i` tokens and take on the loop index value at runtime. This forth does not support nested loops.#### To Compile:
run `make` on a system that has OCaml 4.05+ and Jane Street Core installed.#### To Run:
`./finth test/basic.forth`#### Supported interpreter-defined tokens:
* `+`,`-`, `*`, `/`,`%` (Arithmetic)
* `&`,`|`,`=`,`<`,`>`,`INVERT` (Comparsions and Booleans)
* `DROP`,`SWAP`,`DUP`,`ROT`,`OVER` (Stack manipulation)
* `.`,`EMIT`,`CR` (Output)