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.
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.
- Arithmetic Operations: Support for basic arithmetic operations, including
+,-,*,/,<,>,==, and!=. - Variable Bindings: Bind values to variables using the
letkeyword. - Function Declarations: Define functions using the
fnkeyword. - Conditional Statements: Execute conditional logic with
ifandelsestatements. - Return Statements: Return values from functions using the
returnkeyword.
let x = 5;
let y = 10;
let result = x + y;
return result;
Clone the Repository:
git clone https://github.com/EmanuelFar/MonkeyInterpreter.git
cd MonkeyInterpreter- ** No special dependencies are needed **.