Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkey Language Interpreter in Go

This repository contains an implementation of the Monkey programming language interpreter written in Go. The interpreter is based on the book Writing an Interpreter in Go and follows the concepts and structure presented in the book.

Overview

The Monkey interpreter is built using a combination of lexical analysis, parsing, and evaluation. The main components include:

  • Lexer: Responsible for tokenizing the input source code.
  • Parser: Builds an Abstract Syntax Tree (AST) from the tokens generated by the lexer.
  • AST: Represents the structure of the program.
  • Evaluation: Executes the AST to produce the desired output.

Features

  • Arithmetic Operations: Support for basic arithmetic operations, including +, -, *, /, <, >, ==, and !=.
  • Variable Bindings: Bind values to variables using the let keyword.
  • Function Declarations: Define functions using the fn keyword.
  • Conditional Statements: Execute conditional logic with if and else statements.
  • Return Statements: Return values from functions using the return keyword.

Example

let x = 5;
let y = 10;
let result = x + y;
return result;

How to Run

Clone the Repository:

git clone https://github.com/EmanuelFar/MonkeyInterpreter.git
cd MonkeyInterpreter
  • ** No special dependencies are needed **.

About

Monkey Programming language interpreter, inspired by Thorsten Ball.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages