Go to file
prod2 f79f4e47ba rename funct to proc 2022-02-09 06:58:51 +01:00
benchmarks rename funct to proc 2022-02-09 06:58:51 +01:00
bin new test, bugfix 2022-02-05 03:24:30 +01:00
examples rename funct to proc 2022-02-09 06:58:51 +01:00
src rename funct to proc 2022-02-09 06:58:51 +01:00
tests rename funct to proc 2022-02-09 06:58:51 +01:00
.gitignore WIP on closures: single layer closures work, nested closures still broken 2022-02-06 07:35:00 +01:00
LICENSE Update LICENSE 2022-01-20 21:23:53 +00:00
README.md update readme 2022-02-03 05:13:02 +01:00
nds.nimble mark compiler modules as used, make nimble test rebuild in release mode, make release mode enable all assertions and bounds checks 2022-02-08 06:04:39 +01:00
nim.cfg change project structure 2022-01-29 22:33:34 +01:00
perf.sh WIP on closures: single layer closures work, nested closures still broken 2022-02-06 07:35:00 +01:00

README.md

nondescript

Nondescript started as a nim implementation of clox (see https://craftinginterpreters.com) but has acquired large deviations.

Deviations from 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
  • 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

See the following folders in the source tree, look for the extension .nds:

  • benchmarks/
  • examples/
  • tests/

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
nimble build
bin/nds