- Java 92.1%
- Forth 7.5%
- Shell 0.2%
- M 0.2%
| dependencies | ||
| dist | ||
| docs | ||
| src/com/terraweather/mini | ||
| tests | ||
| .gitignore | ||
| build.sh | ||
| LICENSE | ||
| README.md | ||
Smojo
Smojo is a FORTH-like interpreter implemented in Java, with a small VM/runtime core and a larger standard library layered in .m scripts.
The current runtime banner reports version 1.3.7.
Features
- FORTH-style stack-based execution model
- interpreted and compiled words
- execution tokens (
XT) and immediate words - locals, blocks, branching, looping, and
does> - Java-backed primitive libraries
- script-based standard library modules
- REPL support via
jline
Repository Layout
src: Java sources and bundled.mscriptsbin: compiled classesdependencies: external jarstests: regression testsdocs: architecture notes and diagrams
Build
Smojo currently builds with a small bash script.
Create the runnable jar:
./build.sh
That produces:
dist/smojo-1.3.7.jar
If you want the raw class build instead, the equivalent manual steps are:
find src -name '*.java' | sort > /tmp/smojo-java-files.txt
javac -cp bin:dependencies/jline-1.0.jar -d bin @/tmp/smojo-java-files.txt
Run
Start the REPL from the jar:
java -jar dist/smojo-1.3.7.jar
Run a single command from the jar:
java -jar dist/smojo-1.3.7.jar "version?"
Download
If you just want the binary, download the packaged jar from the repository or the GitHub release assets:
dist/smojo-1.3.7.jar
Run it with:
java -jar dist/smojo-1.3.7.jar
Start the REPL from class files:
java -cp bin:dependencies/jline-1.0.jar com.terraweather.mini.REPL
Run a single command:
java -cp bin:dependencies/jline-1.0.jar com.terraweather.mini.REPL "version?"
Run a script:
java -cp bin:dependencies/jline-1.0.jar com.terraweather.mini.REPL path/to/script.m
Tests
Regression tests are currently small Java programs under tests, with one directory per bug fix.
Current tests:
tests/001-token-stream-restoretests/002-find-by-name-error-handlingtests/003-import-locals-restore
Example:
javac -cp bin:dependencies/jline-1.0.jar -d tests/001-token-stream-restore/bin tests/001-token-stream-restore/TestSimpleInterpreterTokenStreamRestore.java
java -cp bin:dependencies/jline-1.0.jar:tests/001-token-stream-restore/bin TestSimpleInterpreterTokenStreamRestore
Architecture
See docs/architecture.md for a higher-level description of the runtime, interpreter, loader, compilation model, and SVG diagrams.
License
This project is licensed under the GNU General Public License v3.0 or later.
See LICENSE.