-
Notifications
You must be signed in to change notification settings - Fork 0
Evaluation
Joakim edited this page Dec 11, 2021
·
8 revisions
kesh is line-oriented.
- Code is evaluated line-by-line, top to bottom
- Lines are separated by either newline or comma
,
- There are two types of lines:
- Declaration lines
- Expression lines
- A block
{}
consists of lines- Declaration lines
- Expression lines
- A block's value is the value of its last evaluated expression line
- A block is itself an expression
- A collection
[]
consists of lines- Declaration lines in objects
- Expression lines in other types
- Collection is a reference type
- A tuple
()
consists of lines- Expression lines
- Tuple is a reference type, ideally it would have value semantics
- A function
->
is a callable collection - A function consists of parameters and a body
- Its parameters is the unpacking of its argument, as either a tuple or a collection
- The unpacked argument's values are available to the function body's scope
- Its body is an expression, typically a block
- Function is a reference type
Not exactly BNF:
block > line (> declaration) > expression (> …)
collection > line (> declaration) > expression (> …)
tuple > line > expression (> …)
function > expression (> …)
This programming language only exists as a design. I'm unlikely to ever get the chance to write a compiler for it.
Feel free to steal any parts of it that you like. Ideas are better stolen than forgotten. (They're not my ideas anyway.)