update readme
This commit is contained in:
parent
ff9cfd9c39
commit
0c753dcc00
34
README.md
34
README.md
|
@ -1,27 +1,35 @@
|
|||
# nondescript
|
||||
|
||||
Nondescript is a nim implementation of lox (see https://craftinginterpreters.com) with large deviations.
|
||||
Nondescript started as a nim implementation of clox (see https://craftinginterpreters.com) but has acquired large deviations.
|
||||
|
||||
## Deviations from lox
|
||||
|
||||
- NOT SOURCE COMPATIBLE WITH LOX
|
||||
- closures, gc not implemented yet
|
||||
- classes will not be implemented
|
||||
|
||||
|
||||
|
||||
- Everything is an expression, except variable declarations and break statements
|
||||
- hence expressions can contain statements, so the stack is tracked inside the compiler, using compiler.stackCount
|
||||
- uses different local representation than lox inside the compiler
|
||||
- compiler.addLocal also has a delta argument - check it out if interested
|
||||
- 1 file = 1 chunk
|
||||
- function objects are just a pointer to an instruction to jump to (right now instruction index, but this will change)
|
||||
- constant indexes, local indexes have 2 bytes as arguments
|
||||
- no object orientation
|
||||
- closures are not implemented yet
|
||||
- block expressions can be labelled and break takes a label to break out of
|
||||
- set block expression results using ^, ^label
|
||||
- set the return value of functions using ^result
|
||||
- plans for the far future: defer, tables, lists
|
||||
- function objects are just a pointer to an instruction to jump to
|
||||
- constant indexes, local indexes have 2 bytes as arguments - no 256 limit on locals/constants
|
||||
- block expressions can be labelled (@label) and the break statement takes a label to break out of
|
||||
- set block expression results using :label
|
||||
- set the return value of functions using :result
|
||||
- lists (example: @[1, 4, 5])
|
||||
- tables (example: @{ "hello" = "world"})
|
||||
- length operator #
|
||||
- ampersand operator to chain binary operators to finished expressions
|
||||
|
||||
## Examples
|
||||
|
||||
benchmarks/fib.nds
|
||||
See the following folders in the source tree, look for the extension .nds:
|
||||
- benchmarks/
|
||||
- examples/
|
||||
- tests/
|
||||
|
||||
## Building
|
||||
|
||||
|
@ -33,6 +41,6 @@ The 4 steps to a REPL:
|
|||
```
|
||||
git clone https://github.com/prod2/nondescript
|
||||
cd nondescript
|
||||
./build.sh
|
||||
./nds
|
||||
nimble build
|
||||
bin/nds
|
||||
```
|
Loading…
Reference in New Issue