Minor edits.

This commit is contained in:
sforman 2023-08-21 17:58:47 -07:00
parent a107e1df6c
commit 53ad9eb5e7
1 changed files with 17 additions and 13 deletions

View File

@ -4,10 +4,10 @@ Version 0.5.0
## Grammar ## Grammar
The grammar of Thun is very simple. A Thun expression is zero or more Thun The grammar of Thun is very simple. A Thun expression is zero or more
terms separated by blanks. Terms can be integers in decimal notation, Thun terms separated by blanks. Terms can be integers in decimal
Booleans `true` and `false`, lists enclosed by square brackets `[` and `]`, notation, Booleans `true` and `false`, lists enclosed by square brackets
or symbols (names of functions.) `[` and `]`, or symbols (names of functions.)
joy ::= term* joy ::= term*
@ -105,26 +105,30 @@ expression (aka "continuation".)
## Literals, Functions, Combinators ## Literals, Functions, Combinators
Terms in Thun can be categorized into literal, simple functions that Terms in Thun can be categorized into **literals**, simple **functions**
operate on the stack only, and combinators that can prepend quoted that operate on the stack only, and **combinators** that can prepend
programs onto the pending expression ("continuation"). quoted programs onto the pending expression ("continuation").
### Literals ### Literals
Literal values (integers, Booleans, lists) are put onto the stack. Literal values (integers, Booleans, lists) are put onto the stack.
Literals can be thought of as functions that put accept a stack and
return it with the value they denote on top, if you like.
### Functions ### Functions
Functions take values from the stack and push results onto it. Functions take values from the stack and push results onto it. There are
a few kinds of functions: math, comparison, list and stack manipulation.
### Combinators ### Combinators
__Combinators__ are functions which accept quoted programs on the stack __Combinators__ are functions which accept quoted programs on the stack
and run them in various ways. These combinators reify specific and run them in various ways by prepending them (or not) to the pending
control-flow patterns (such as `ifte` which is like `if.. then.. else..` expression. These combinators reify specific control-flow patterns (such
in other languages.) Combinators receive the current expession in as `ifte` which is like `if.. then.. else..` in other languages.)
addition to the stack and return the next expression. They work by Combinators receive the current expession in addition to the stack and
changing the pending expression the interpreter is about to execute. return the next expression. They work by changing the pending expression
the interpreter is about to execute.
### Basis Functions ### Basis Functions