Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0b483cf
Varia; trivial case seems to work.
Apr 16, 2025
17287eb
Fix method constructor
Apr 16, 2025
1b2334c
Varia, still WIP
Apr 16, 2025
58f7bfc
WIP
Apr 16, 2025
0696e48
Refining Nock, WIP
Apr 17, 2025
94f182a
WIP Point(50) working
Apr 18, 2025
dd8fe11
WIP on Nock
Apr 22, 2025
2f1e7f3
Working with built-in operators.
Apr 22, 2025
995b0b6
WIP close Nock
Apr 22, 2025
504dfb3
Post
Apr 23, 2025
56c4afa
Fix sample location
Apr 24, 2025
5571502
WIP post
Apr 24, 2025
f72506c
WIP
Apr 24, 2025
f4a0690
Fix Nock addressing
Apr 25, 2025
b61cf09
Post examples
Apr 25, 2025
8d5d7f2
Cleanup
Apr 25, 2025
224e32e
Cleanup
Apr 25, 2025
ea882b4
Set up leg resolution preliminaries.
Apr 25, 2025
7cc7a43
Post WIP
Apr 25, 2025
61e7025
At the crux
Apr 28, 2025
b058218
Post working instance/invocation logic
Apr 28, 2025
a288179
Update w/ examples.
Apr 28, 2025
96a3c5c
varia
Apr 29, 2025
ce0994d
Post a working version
Apr 29, 2025
2f5d292
Caught in leg/arm dichotomy :(
Apr 30, 2025
6d5ac0d
Diagnose doors
Apr 30, 2025
6657018
trim logs
May 7, 2025
f99ab50
Upgrade everything to new choo
May 7, 2025
22dec3e
Various fixes
May 7, 2025
d249e2a
Revise docs
May 7, 2025
9168014
Update docs
May 7, 2025
da88b39
Comment
May 8, 2025
7827874
Various fixes for instances
May 8, 2025
89a81ac
Varia
May 10, 2025
5a62e23
Augment comments
May 14, 2025
98841cc
Fix much Jock
May 15, 2025
9b79385
Varia
May 15, 2025
a910323
Mostly there, but issue with gate call now....
May 17, 2025
136f942
Fix calls, next up methods
May 19, 2025
592a90f
Fix method setup for instance return
May 20, 2025
3f45e89
Merge
May 20, 2025
8453c3f
Merge
May 20, 2025
319e3c8
Merge pull request #51 from zorp-corp/sigilante/trial-by-stone
sigilante May 20, 2025
d2c642a
Remove TODO
May 20, 2025
0e57646
Update test format for assert
May 20, 2025
e1f6048
Post tests
May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .data.choo/jams/0.jam
Binary file not shown.
Binary file removed .data.choo/jams/1.jam
Binary file not shown.
Binary file removed .data.jock/jams/0.jam
Binary file not shown.
1,581 changes: 1,304 additions & 277 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "jock-testing"
name = "jocktest"
version = "0.1.0"
edition = "2021"

[dependencies]
crown = { git = "https://github.com/zorp-corp/nockapp", rev="d14578ad2108933b8a370155f07e7c30a43ec69f"}
sword = { git = "https://github.com/zorp-corp/sword.git", rev = "bcb2e7fba0e24d45d4887fae77389d7c5e86b507" }
sword_macros = { git = "https://github.com/zorp-corp/sword.git", rev = "bcb2e7fba0e24d45d4887fae77389d7c5e86b507" }
assert_no_alloc = { git = "https://github.com/zorp-corp/sword.git", rev = "bcb2e7fba0e24d45d4887fae77389d7c5e86b507" }
crown = { git = "https://github.com/zorp-corp/nockchain", rev="932c8e6b6d159e072d1f4b6d26cc0dccbae4a377"}
sword = { git = "https://github.com/zorp-corp/nockchain.git", rev = "932c8e6b6d159e072d1f4b6d26cc0dccbae4a377" }
sword_macros = { git = "https://github.com/zorp-corp/nockchain.git", rev = "932c8e6b6d159e072d1f4b6d26cc0dccbae4a377" }
assert_no_alloc = { git = "https://github.com/zorp-corp/nockchain.git", rev = "932c8e6b6d159e072d1f4b6d26cc0dccbae4a377" }
clap = { version = "4.4.4", features = ["derive", "cargo", "color", "env"]}
tokio = { version = "1.32", features = ["rt", "rt-multi-thread", "net", "macros", "io-util", "fs", "sync", "time"] }
tracing = "0.1.40"
tracing = "0.1.41"

[[bin]]
name = "jock-testing"
name = "jocktest"
path = "main.rs"

[profile.dev]
Expand Down
112 changes: 42 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,110 +1,82 @@
.DEFAULT_GOAL := help
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
export RUST_BACKTRACE := full
export RUST_LOG := info
export MINIMAL_LOG_FORMAT := true

ifneq (,$(wildcard ./.env))
include .env
export
include .env
export
endif

# Slow!
PROFILE_DEV_DEBUG = --profile dev
# Fast!
PROFILE_DEV_FAST = --profile dev-fast
# Fastest!
PROFILE_RELEASE = --profile release
.DEFAULT_GOAL := build
.PHONY: build
build:
cargo build --release

# Retrieve latest choo build.
CHOO_URL=https://github.com/zorp-corp/nockapp
CHOO_TAG=$(shell git ls-remote --tags $(CHOO_URL) | grep 'refs/tags/choo-' | grep -o 'refs/tags/.*' | sed 's/refs\/tags\///' | sort -V | tail -n1)
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

-: ## -----------------------------------------------------------
-: ## -------------- Commonly used commands below --------------
-: ## -----------------------------------------------------------
PROFILE_DEV_DEBUG = --profile dev
PROFILE_RELEASE = --profile release

.PHONY: build
build: build-dev-fast ## Build in default profile (dev-fast)
build: build-dev-debug

.PHONY: release
release: build-release

.PHONY: release-test-zero
release-test-zero:
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new test-n 0

.DEFAULT_GOAL := test

.PHONY: test

test:
@if [ $(words $(MAKECMDGOALS)) -lt 2 ]; then \
echo "Usage: make test <number>"; \
exit 1; \
fi
@RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new test $(word 2,$(MAKECMDGOALS))
$(call show_env_vars)
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new test $(word 2,$(MAKECMDGOALS))
@exit 0

.PHONY: exec
exec:
@if [ $(words $(MAKECMDGOALS)) -lt 2 ]; then \
echo "Usage: make exec <number>"; \
exit 1; \
fi
$(call show_env_vars)
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new exec $(word 2,$(MAKECMDGOALS))
@exit 0

# This wildcard rule catches all other arguments but does nothing with them
%::
@:

.PHONY: release-exec-all
release-exec-all:
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new exec-all
$(call show_env_vars)
@echo "Running release exec-all"
RUST_LOG=TRACE MINIMAL_LOG_FORMAT=true cargo run $(PROFILE_RELEASE) -- --new exec-all

.PHONY: release-test-all
release-test-all:
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new test-all

.PHONY: release-run-details
release-run-details:
RUST_LOG=TRACE cargo run $(PROFILE_RELEASE) -- --new run-details

-: ## -----------------------------------------------------------
-: ## ---------- Rest of the commands in the Makefile -----------
-: ## -----------------------------------------------------------

.PHONY: build-dev-fast
build-dev-fast: ## Slower to compile, faster to execute. Builds all projects
@set -e; \
RUST_LOG=TRACE ./choo hoon/main.hoon hoon; \
mv out.jam assets/jocktest.jam; \
cargo build $(PROFILE_DEV_FAST)

.PHONY: build-parallel
build-parallel: ## profiling profile with parallel feature enabled
@set -e; \
./choo hoon/main.hoon hoon; \
mv out.jam assets/jocktest.jam; \
cargo build $(FEATURES_PARALLEL) $(PROFILE_PROFILING)
$(call show_env_vars)
@echo "Running release test-all"
RUST_LOG=TRACE MINIMAL_LOG_FORMAT=true cargo run $(PROFILE_RELEASE) -- --new test-all

.PHONY: build
build-dev-debug: ## Fast to compile, slow to execute. Builds all projects
@set -e; \
RUST_LOG=TRACE ./choo --new --log-level trace hoon/main.hoon hoon; \
build-dev-debug:
$(call show_env_vars)
RUST_LOG=trace ./hoonc hoon/main.hoon hoon; \
mv out.jam assets/jocktest.jam; \
cargo build
cargo build $(PROFILE_DEV_DEBUG)

.PHONY: build-release
build-release: ## Slowest to compile, fastest to execute. Builds all projects
@set -e; \
RUST_LOG=TRACE ./choo hoon/main.hoon hoon; \
build-release:
$(call show_env_vars)
RUST_LOG=trace ./hoonc hoon/main.hoon hoon; \
mv out.jam assets/jocktest.jam; \
cargo build $(PROFILE_RELEASE)

.PHONY: update-choo
update-choo:
curl -L -o choo "$(CHOO_URL)/releases/download/$(CHOO_TAG)/choo"
chmod u+x choo

.PHONY: choo-version
choo-version:
@echo "Latest choo version: $(CHOO_TAG)"

.PHONY: clean
clean: ## Clean all projects
@set -e; \
rm -f assets/jocktest.jam; \
rm -rf .data.choo/ \
rm -rf .data.hoonc/ ; \
rm -rf target/ ; \
cargo clean
117 changes: 94 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,108 @@
# Jock, a friendly and practical programming language

This is a developer preview of Jock, a friendly programming language that compiles to the Nock combinator calculus.
This is a developer preview of Jock, a friendly programming language that compiles to the [Nock instruction set architecture](#nock).

- [Jock language site](https://jock.org)
- [Announcement post](https://zorp.io/blog/jock)
- [@JockNockISA on X](https://x.com/JockNockISA)

The Jock compiler is written in Hoon and runs on the NockApp architecture.
![](./img/wordmark-logo.png)

## Prerequisites
The Jock compiler is written in [Hoon](https://docs.urbit.org) and runs on the NockApp architecture, [part of Nockchain](https://github.com/zorp-corp/nockchain).

Jock requires a `choo` NockApp executable. The `Makefile` can retrieve the latest tagged `choo`. For Linux, run the following:
Jock code results in Nock which can be run on any Nock VM ([Sword](https://github.com/zorp-corp/sword), [Vere](https://github.com/urbit/vere)).

```bash
make update-choo
```
## Resources

If you would like a nightly build of `choo`, or if you are using something other than Linux, [clone this repo](https://github.com/zorp-corp/nockapp) and build.
Then copy the `choo` executable to the root folder.
### Jock

## Building
- [Jock tutorial repo](https://github.com/zorp-corp/jockapp-tutorial)
- [Jock tutorial site](https://docs.jock.org/getting-started)
- [Jock docs](https://docs.jock.org)
- [@JockNockISA on X](https://x.com/JockNockISA)

To build and run Jock with tests:
### Nock

```bash
make release
Nock serves as the instruction set architecture for [Nockchain](https://nockchain.org), [zkVM](https://zorp.io/), and [Urbit](https://urbit.org), 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.

# run all codes in /lib/tests
./target/release/jock-testing exec-all
# - or -
make release-test-all
- [Zorp, “Nock Definition”](https://zorp.io/nock/)
- [Urbit, “Nock Definition” (with discussion)](https://docs.urbit.org/language/nock/reference/definition)
- [~timluc-miptev, “Nock for Everyday Coders” (tutorial)](https://blog.timlucmiptev.space/part1.html)

# run specific code in /lib/tests
./target/release/jock-testing test-n 0
# - or -
make test 0
```
### NockApp

The NockApp framework consists of Sword (formerly Ares), a runtime VM interpreter for Nock, the Crown Rust interface, and `hoonc`, which builds Nock programs from Jock or Hoon into executable standalones.

- [NockApp in Nockchain](https://github.com/zorp-corp/nockchain)
- [Announcement post](https://zorp.io/blog/nockapp-dev-alpha)

## Setup

1. Download and build `hoonc`, a NockApp compiler which forms part of Nockchain.

- ​GitHub: [zorp-corp/nockchain](https://github.com/zorp-corp/nockchain)

```sh
make install-hoonc
```

2. In a separate location, download the Jock language repo (this repo).

- ​GitHub: [zorp-corp/jock-lang](https://github.com/zorp-corp/jock-lang)

3. Copy `hoonc` from `nockchain/target/build/release` to the root of `jock-lang`.

```sh
cp nockchain/target/build/release/hoonc jock-lang/
```

4. Compile the examples:

```sh
cd jockapp-tutorial
make release
```

5. Run one of the available demos from `/hoon/lib/tests`:

```bash
./target/release/jocktest exec 0
# - or -
make exec 0
```

The demo will output several pieces of information:

1. `%parse`, the tokenization.
2. `%jeam`, the Jock abstract syntax tree (AST).
3. `%mint`, the compiled Nock (which will be rather long).
4. `%jype`, the Jock result type.
5. `%nock`, the evaluated Nock result, as an atom.

Alternatively, run all codes:

```bash
./target/release/jocktest exec-all
# - or -
make release-exec-all
```

Run a single test:

```bash
./target/release/jocktest test 25
# - or -
make test 25
```

Or run all tests (slow):

```bash
./target/release/jocktest test-all
# - or -
make release-test-all
```

## Releases

- [0.0.0-dp, Developer Preview](https://zorp.io/blog/jock), ~2024.10.24
- 0.1.0-alpha, upcoming
Binary file modified assets/jocktest.jam
Binary file not shown.
Loading
Loading