Go to file
prod2 ded7fd3211 hashtable implementation and test 2022-01-28 22:00:21 +01:00
benchmarks custom string object 2022-01-28 04:17:11 +01:00
tests hashtable implementation and test 2022-01-28 22:00:21 +01:00
types hashtable implementation and test 2022-01-28 22:00:21 +01:00
.gitignore hashtable implementation and test 2022-01-28 22:00:21 +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
build.sh hashtable implementation and test 2022-01-28 22:00:21 +01:00
chunk.nim move arity checking to its own op 2022-01-27 05:56:09 +01:00
compiler.nim custom string object 2022-01-28 04:17:11 +01:00
config.nim hashtable implementation and test 2022-01-28 22:00:21 +01:00
debug.sh hashtable implementation and test 2022-01-28 22:00:21 +01:00
main.nim hashtable implementation and test 2022-01-28 22:00:21 +01:00
pointerutils.nim replaced seq with a custom stack object for performance 2022-01-27 18:54:02 +01:00
scanner.nim custom string object 2022-01-28 04:17:11 +01:00
value.nim hashtable implementation and test 2022-01-28 22:00:21 +01:00
vm.nim hashtable implementation and test 2022-01-28 22:00:21 +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