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

Implementation of a Monkey compiler written in Go

License

Notifications You must be signed in to change notification settings

vincentlossel/monkeylang-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonkeyLang Compiler

Build

Implementation of a Monkey compiler, as described in Writing a Compiler in Go.

Features

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

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 compiler written in Go

Topics

Resources

License

Stars

Watchers

Forks

Languages