Git Product home page Git Product logo

javamonkeyinterpreter's Introduction

Java Monkey Interpreter

A tree-walking interpreter for the Monkey programming language, written in Java.

As of July 3rd, 2024, the interpreter is fully functional, supporting "mathematical expressions, variable bindings, functions and the application of those functions, conditionals, [both explicit and implicit] return statements, and advanced concepts like higher-order functions and closures" (Ball 197) as well as 5 data types: integers, booleans, strings, arrays, and hashes.

Features

  • Read-Eval-Print-Loop (REPL) environment for typing in code
  • Lexer for tokenization
  • Pratt/Recursive descent parser for syntactic analysis.
  • Abstract syntax tree (AST) for code representation and evaluation.

All of the interpreter's features were created from scratch, without the use of any outside libraries or frameworks.

Installation & Usage

First, verify that you have both java and maven installed on your machine.

java --version
mvn --version

After that, installation can be completed by simply cloning the repository on to your local machine:

git clone https://github.com/IcePanorama/JavaMonkeyInterpreter

You can then run the interpreter using the following commands:

cd JavaMonkeyInterpreter/
mvn package
java -cp target/classes com.monkeyinterpreter.Main

To quit the interpreter, type .quit.

To do

  • Refactor entire codebase.
  • Create better documentation for codebase.
  • Implement float datatype.
  • Implement quality-of-life improvements for REPL.

Acknowledgements

This project was developed using the book, "Writing An Interpreter In Go" by Thorsten Ball. As the name implies, Ball's original project was written entirely in Go and I converted everything to Java.

As of July 3rd, 2024, I'm finished with the book, although I still plan on cleaning the project up some before I'll truly consider it "complete". After that, I'll likely add some more features to the language on my own before moving onto the Thorsten Ball's next book, "Writing An Interpreter In Go: The Lost Chapter - A Macro System For Monkey".

javamonkeyinterpreter's People

Contributors

icepanorama avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.