monkey_interpreter

command module
v0.0.0-...-ec5cb73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 12 Imported by: 0

README

Monkey interpreter

Implementation of a Monkey interpreter. This project is derived work from the original language developed by Thorsten Ball.

Features

Pretty much the regular monkey language, with a few customizations:

  • Supports range expressions like 0..123.
  • Supports variable-length arguments to functions with fn(a, ...) { } syntax.
  • Supports builtin functions to turn a vararg object into an array, like fn(a, ...) { a + len(toArray(...)) }.
  • Support a contains builtin that returns a boolean indicating if a Hash object contains a key.
  • Closures capture the environment by value, not by reference, making it truly functional.
  • Implements nicer error reporting, giving contextual information of where the error happened.
  • Apart from the interpreter, it implements the bytecode VM and a transpiler to C++, which turns out to be the fastest.
  • Saves the repl history using liner.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL