Skip to content

A interpreter for the monkey language, written in Rust

Notifications You must be signed in to change notification settings

jdlambert/monkey-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An interpreter for the Monkey programming language, from the book Writing an Interpeter in Go.

Usage

cargo run to start the REPL. Try something like defining map:

>> let map = fn(arr, f) {
     let iter = fn(arr, accumulated) {
       if (len(arr) == 0) {
         accumulated
       } else {
         iter(rest(arr), push(accumulated, f(first(arr))));
       }
     };
     iter(arr, []);
   };
>> let a = [1, 2, 3, 4];
>> let double = fn(x) { x * 2 };
>> map(a, double)
[2, 4, 6, 8]

About

A interpreter for the monkey language, written in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages