Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Implementation of a Monkey interpreter written in Go

License

Notifications You must be signed in to change notification settings

vincentlossel/monkeylang-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonkeyLang Interpreter

Build

Implementation of a Monkey interpreter, as described in Writing an Interpreter in Go.

Features

  • Integers, booleans, strings, arrays, hash maps
  • Arithmetic expressions, let statements, recursions, closures
  • First-class and higher-order functions
  • Built-in functions
  • REPL

Syntax

let people = [{"name": "Anna", "age": 24}, {"name": "Bob", "age": 99}];

let getName = fn(person) { person["name"]; };
getName(people[0]);

let fibonacci = fn(x) {
  if (x == 0) {
    0
  } else {
    if (x == 1) {
      return 1;
    } else {
      fibonacci(x - 1) + fibonacci(x - 2);
    }
  }
};

About

Implementation of a Monkey interpreter written in Go

Topics

Resources

License

Stars

Watchers

Forks

Languages