Skip to content

Duja03/monkey-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkey Interpreter in Go

This is my implementation of the Monkey programming language interpreter, written in Go.
The project is based on the books "Writing An Interpreter In Go" and "Writing A Compiler In Go" by Thorsten Ball.

It was built entirely from scratch, covering everything from lexical analysis to evaluation.
The goal was to understand how interpreters work at a fundamental level.

Features

  • Lexer (tokenizing source code)
  • Pratt Parser (generating AST)
  • Evaluator (interpreter engine)
  • First-class functions and closures
  • Lexical scope
  • Built-in types: integers, booleans, strings, arrays, hashes
  • Built-in functions: len, first, last, rest, push, etc.
  • Error handling and environment isolation
  • REPL (interactive prompt)

Getting Started

Requirements

  • Go 1.18 or higher (tested with 1.21)

Install and Run

git clone https://github.com/your-username/monkey-interpreter.git
cd monkey-interpreter
go run main.go

About

A Go interpreter (later compiler) for the Monkey language — built step-by-step while reading Thorsten Ball's awesome book.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages