Go to file
prod2 05887323c0 new test, bugfix 2022-02-05 03:24:30 +01:00
benchmarks create an nds testing tool 2022-02-05 02:45:29 +01:00
bin new test, bugfix 2022-02-05 03:24:30 +01:00
examples create an nds testing tool 2022-02-05 02:45:29 +01:00
src new test, bugfix 2022-02-05 03:24:30 +01:00
tests new test, bugfix 2022-02-05 03:24:30 +01:00
.gitignore don't add other lang examples that may be there locally 2022-02-03 23:28:45 +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 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 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