New features in Jargon v0.0.12

If you are not familiar with Jargon, start at the introductory article and Github.

Jargon is now specified as a Jargon procedure

As of Jargon 0.0.10, the Jargon language is specified self-referentially as a Jargon procedure with Jargon axioms, which goes on to define Jargon procedures and Jargon axioms and the other language constructs.

Jargon explicitly supports type expressions

A type expression is a natural language description of a class of data. For example:

[an even number]

Type expressions can then be used in fuzzy comparisons:

2 == [an even number]      # TRUE
🎳 == [an emoji]           # TRUE

Jargon now passes through errors

The following Jargon procedure might trigger GPT-4’s ethics filter.

+++ insult-me
-- Insult me

Now, in this case the Jargon interpreter returns:


Jargon supports unit tests

As of Jargon v0.0.11, Jargon has a new procedure that specifies how unit tests work. A basic unit test looks like this:

+++ test-double($n)
- Output twice $n
? This test just doubles its parameter.
% /test-double(2)
! 4

A unit test is just a Jargon procedure whose name starts with test- and which is followed by a few pieces of metadata. Metadata with lines that start with ? is just a description of what the test does, which is helpful for both the humans and the LLM reading the test case.

The line starting with ! is the expected output of the test. This is the output that the unit test runner will compare with the actual output of the procedure’s execution.

In our test above, we also need to specify a parameter, so we use a % line to specify how we run the test.

We can also do this multiple times if we want:

% /test-double(2)
! 4
% /test-double(3)
! 6
% /test-double(12)
! 24

If the test doesn’t require a paramter, we can just omit the %:

+++ test-woof
-- Return 🐶
? Just returns a doggie.
! 🐶

If your test returns multiple lines out output, then we can show that as follows:

+++ test-multiline
- Return three dollar signs on separate lines
! $

Using type expressions is useful for tests that have some uncertainties about the output:

+++ test-emoji
-- Output a random emoji
? Outputs a random emoji.
! [an emoji]

Run unit tests on Jargon itself

As of v0.0.12, Jargon comes with its own unit test suite within tests.txt. You can run these tests in the Jargon interpreter, and they should improve performance of the interpreter overall.

Subscribe to Jake Brukhman
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
This entry has been permanently stored onchain and signed by its creator.