Minor docs update.
This commit is contained in:
parent
eb591d27e0
commit
57446a1179
13
joy/joy.py
13
joy/joy.py
|
|
@ -35,12 +35,15 @@ from .utils.pretty_print import TracePrinter
|
||||||
|
|
||||||
|
|
||||||
def joy(stack, expression, dictionary, viewer=None):
|
def joy(stack, expression, dictionary, viewer=None):
|
||||||
'''Evaluate the Joy expression on the stack.
|
'''Evaluate a Joy expression on a stack.
|
||||||
|
|
||||||
The basic joy() function is quite straightforward. It iterates through a
|
This function iterates through a sequence of terms which are either
|
||||||
sequence of terms which are either literals (strings, numbers, sequences)
|
literals (strings, numbers, sequences of terms) or function symbols.
|
||||||
or functions. Literals are put onto the stack and functions are
|
Literals are put onto the stack and functions are looked up in the
|
||||||
executed.
|
disctionary and executed.
|
||||||
|
|
||||||
|
The viewer is a function that is called with the stack and expression
|
||||||
|
on every iteration, its return value is ignored.
|
||||||
|
|
||||||
:param stack stack: The stack.
|
:param stack stack: The stack.
|
||||||
:param stack expression: The expression to evaluate.
|
:param stack expression: The expression to evaluate.
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,14 @@ by the fact that they are not Symbol objects.
|
||||||
|
|
||||||
A crude grammar::
|
A crude grammar::
|
||||||
|
|
||||||
joy = term*
|
joy = term*
|
||||||
term = int | float | string | '[' joy ']' | function
|
term = int | float | string | '[' joy ']' | symbol
|
||||||
|
|
||||||
A Joy expression is a sequence of zero or more terms
|
|
||||||
|
|
||||||
|
A Joy expression is a sequence of zero or more terms. A term is a
|
||||||
|
literal value (integer, float, string, or Joy expression) or a function
|
||||||
|
symbol. Function symbols are unquoted strings and cannot contain square
|
||||||
|
brackets. Terms must be separated by blanks, which can be omitted
|
||||||
|
around square brackets.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
#TODO: explain the details of float lits and strings.
|
#TODO: explain the details of float lits and strings.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue