Code Monkey home page Code Monkey logo

pymonkey's Introduction

PyMonkey

Description

Python version of the Monkey programming language:

alt text

NOTE: This is a personal project created for the sole purpose of learning how to build interpreters / compilers and honing my Python skills. You may borrow code under the licence.

Dependencies

  • Python 3.6+

Execution

Inside the src/monkey:

The Monkey interpreter plus macros can be run with:

python main.py

The compiler isn't complete yet but can be run with a flag --c:

python main.py --c

Ultimately, to compile a Monkey file, this command will be used instead:

python main.py [Program.mnk] [args]

Testing

Inside the test:

python [test_file].py

Progress

Interpreter

  • Interpreter
  • Built-in types and functions

Extras

  • Macros

Compiler

  • Compile expressions
  • Conditionals
  • Data structures
  • Functions
  • Closures

Possible Future extensions

  • Better error handling (stack trace)
  • More operators like postfix (e.g. ++, --) or ternary
  • Default arguments to functions
  • Macros hygiene
  • Debugging Macros
  • Continuations
  • Time travel debugging

pymonkey's People

Contributors

nischalshrestha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

irwin1985

pymonkey's Issues

Enhance repl usability

Some basics so you don't want to pull your hair out:

  • Up arrow to go through command history
  • Left/Right arrow to traverse code line

Nice to haves:

  • Block code w. indenting

Fix up packaging to resolve conflict

Trying to

import keyboard

will cause this error:

AttributeError: module 'token' has no attribute '__all__'

since it's trying to use monkey's token module instead of Python's.

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.