Code Monkey home page Code Monkey logo

monyet's Introduction

Monyet

Crystal implementation of the Monkey Language

Monyet has a sibling implementation for Kotlin: monkey.kt

Status

The two books (Writing An Interpreter In Go and Writing A Compiler in Go) are implemented.

Commands

Before running the command you must have crystal and shards installed on your machine

Script Description
tests.sh Run all the tests
checks.sh Run format tool and ameba checks
build.sh Release build
benchmarks.sh Run the classic monkey benchmark (fibonacci(35)), requires one command (--eval,--eval-fast,--vm,--vm-fast)
repl.sh Run the Monyet REPL

Compiling variants

There are two different implementations for the compiler/VM.

  • The default variant, based on Array(UInt8) as Bytecode and OffsetArray arrays for read operations
  • The slices variant, based purely on Slice(UInt8)

The slices variant is more idiomatic but the default variant has better performance (around 10%).

To compile with a different variant you can the flag --define=slice to your compile or test. Additionally, both build.sh and test.sh have lines that you can comment/uncomment to enable different variants

monyet's People

Contributors

jgaskins avatar marioariasc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

eliasjpr jgaskins

monyet's Issues

Unclosed If Expressions

I believe this is a caveat of the WAIIG book, not of a specific implementation.

Currently, the following code (an unclosed if expression)

if (true) { puts(2)

is parsed and evaluated as a valid expression.

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.