notes-computer-programming-nock-nockTutorial

This page is a placeholder with some notes towards a future tutorial for the programming language Nock. I'll probably never actually get around to writing it.

Why Nock?

In contrast to almost all other programming languages, Nock is based on the combinatory logic model of computation. This is an unusual choice; most programming languages (such as most assembly languages, and C) are based on the imperative, Turing machine model of computation, and some (such as Haskell) are based on the lambda calculus model of computation.

In Nock, computation proceeds by reduction, that is, by matching an expression against a reduction rule pattern, and then by rewriting that expression in a simple syntactic way according to the reduction rule. It's kind of like a programming paradigm built out of macros.

In contrast to Turing-machine models, Nock has no global state.

In contrast to lambda calculus models, there is no concept of variable substitution. The reduction rules do not ever recurse into the expression and do something to all instances of a certain symbol or pattern within, nor does reduction depend upon a context that maps variables to their values; rather, reduction rules merely match a constant, finite amount of structure in a top-down manner and then rearrange this structure.

Like a large subset of Haskell, Nock is purely functional.

Nock is a very minimalistic language. It has a very short specification. It is meant to be used more like an assembly language or VM, not as a language that programmers use directly.

---

a: state

0: /(b) 1: arg(b) 2: nock(b,c) 3: ?(b) 4: +(b) 5: =(b) 6: if(b,c,d) 7: compose(b,c) 8: assign(b,c) 9: call(b,c) 10a: hint(b,c) 10b: hint(b.c,d)

---

Links


CategoryTutorial