Language Basics
Jock is a high-level, general-purpose, functional programming language which targets the Nock ISA. Jock supports basic programming control constructs and data types, as well as cross-compatibility with Hoon (a powerful lower-level language also targeting the Nock ISA). Jock's syntax is similar to Python, Swift, Ruby, and other scripting languages.
Every Jock expression must result in a value, and values must be composed together in a “sensical” way. As a language which is functional-as-in-Lisp-like, Jock can emit side effects, but typically is conceived of as a pure function operating on input.
The simplest possible Jock programs are, therefore, simply data literals, like 5
. We call bare values like these atoms and collections of them cells (pairs) or tuples (general n-ary).
Atoms
Jock currently supports the following data types:
A noun is the most general type, being either an atom or a cell; the type is written
*
.1.000
is a numeric atom 1000 or 1,000 (German-style delimiters); the type is written@
.0xdead.beef
is a hexadecimal atom; there is not yet a type marker.'this is å message'
is a string atom; there is not yet a type marker.true
/false
are loobeans; the type is written?
.%txt
is a text constant or symbol.
Containers
Containers are collections of other containers and/or atoms.
Cell/Tuple
The simplest container is a cell (Nock pair) or a tuple.
The next simplest container is a list (null-terminated tuple), which has its own syntax.
Jock also supports Set
s, collections of unique elements.
Expressions
Expressions in Jock may be as simple as data literals (as above), ranging up to function calls and operator expressions.
Statements
Statements involve Jock keywords and must adhere to Jock syntax.
Most statements end with a required ;
“mic” to denote the program's continuation. Only terminal expressions (expressions that result in a value to be returned out of the evaluation tree) do not end in a ;
“mic”.
Last updated