This is a developer preview of Jock, a friendly programming language that compiles to the Nock instruction set architecture.
This repo contains the Jock base language, tutorial materials, and language unit tests.
The Jock compiler is written in Hoon and runs on the NockApp architecture, part of Nockchain.
Jock code results in Nock which can be run on any Nock VM (NockVM, Vere).
Nock serves as the instruction set architecture for Nockchain, Nock ZKVM, and Urbit, among other projects. The Nock ISA is a minimalist combinator calculus. All computations are reduced to a set of twelve opcodes that are easy to reason about and make proofs about.
- Zorp, “Nock Definition”
- Urbit, “Nock Definition” (with discussion)
- ~timluc-miptev, “Nock for Everyday Coders” (tutorial)
The NockApp framework consists of NockVM, a runtime VM interpreter for Nock, the NockApp Rust framework, and hoonc, which builds Nock programs from Jock or Hoon into executable standalones.
-
Download and build
hoonc, a NockApp compiler which forms part of Nockchain.- GitHub: zorp-corp/nockchain
make install-hoonc
-
In a separate location, download the Jock language repo (this repo).
- GitHub: zorp-corp/jock-lang
-
Copy
hooncfromnockchain/target/releaseto the root ofjock-lang.cp nockchain/target/release/hoonc jock-lang/
If you are developing Jock code, you should use the Jock compiler tool jockc.
-
Build the Jock compiler and command-line execution environment:
make jockc
-
Copy
jockcfrom./target/releaseto the root ofjock-lang.cp ./target/release/jockc . -
Run a Jock program directly using its path:
./jockc ./common/hoon/try/hello-world --import-dir ./common/hoon/jib
See available demos:
ls common/hoon/try
Supply a path for library imports:
./jockc ./common/hoon/try/import --import-dir ./common/hoon/jib
-
Run a demo with its name and any arguments:
./jockc ./common/hoon/try/hello-world --import-dir ./common/hoon/jib ./jockc ./common/hoon/try/fib 10 --import-dir ./common/hoon/jib
The demo will output several pieces of information:
%parse, the tokenization.%jeam, the Jock abstract syntax tree (AST).%mint, the compiled Nock (which will be rather long; output is currently slow).%jype, the Jock result type.%nock, the evaluated Nock result, as an atom (unsigned decimal value).
For a tutorial like
hello-world, the Nock text will be printed as the numeric equivalent of the hexadecimal for the time being.(Rust logs from
hoonctend to be obnoxiously verbose; to make them more concise, useMINIMAL_LOG_FORMAT=trueas a command-line environment variable, e.g.MINIMAL_LOG_FORMAT=true ./jockc fib 10. You can also run the same minified log format withmake run fib 10.) -
Add a new demo by saving Jock code in
/common/hoon/tryand running it by name.If you modify the Hoon code located in
/crates/jockc/hoon/libor/common/hoon/try, runmake jockcbefore running the new code.If you modify the Rust code in
/crates/jockc/main.rs, runmake jockc.
If you are developing Jock itself, you should use the Jock testing tool jockt to verify behavior.
-
Build the Jock testing tool:
make jockt
-
Copy
jocktfromtarget/releaseto the root ofjock-lang.cp ./target/release/jockt . -
Run a Jock program using its internal index:
./jockt exec 5 --import-dir ./common/hoon/jibThese are listed in
/hoon/lib/test-jock.hoon.The demo will output several pieces of information:
%parse, the tokenization.%jeam, the Jock abstract syntax tree (AST).%mint, the compiled Nock (which will be rather long).%jype, the Jock result type.%nock, the evaluated Nock result, as an atom.
Alternatively, run all codes:
./jockt exec-all --import-dir ./common/hoon/jib
-
Run a Jock program with all tests:
./jockt test 5 --import-dir ./common/hoon/jibThese indices are identical to those obtained in the previous step from
/hoon/lib/test-jock.hoon.Alternatively, run all tests (slow):
./target/release/jockt test-all --import-dir ./common/hoon/jib
- 0.0.0-dp, Developer Preview, ~2024.10.24
- 0.1.0-alpha, ~2025.6.26
