Go to file
prod2 2aa3a094bb update tests to match codebase 2022-02-03 05:00:09 +01:00
benchmarks change ^ to :, remove automatic ^ 2022-01-29 22:47:23 +01:00
src unite stringutils and ndstring 2022-02-03 04:58:34 +01:00
tests update tests to match codebase 2022-02-03 05:00:09 +01:00
.gitignore change project structure 2022-01-29 22:33:34 +01:00
LICENSE Update LICENSE 2022-01-20 21:23:53 +00:00
README.md hashtable implementation and test 2022-01-28 22:00:21 +01:00
nds.nimble change project structure 2022-01-29 22:33:34 +01:00
nim.cfg change project structure 2022-01-29 22:33:34 +01:00

README.md

nondescript

Nondescript is a nim implementation of lox (see https://craftinginterpreters.com) with large deviations.

Deviations from lox

  • NOT SOURCE COMPATIBLE WITH LOX
  • 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

Examples

benchmarks/fib.nds

Building

Requirements:

  • nim (1.6.2 tested)
  • c compiler (gcc, glibc tested)

The 4 steps to a REPL:

git clone https://github.com/prod2/nondescript
cd nondescript
./build.sh
./nds