Code Monkey home page Code Monkey logo

pylox's Introduction

PyLox

A Tree-Walk Interpreter to the PyLox language, using the good old python for the simplest and cleanest implementation.

Prerequisites

To run this PyLox interpreter, you will need to have a version of python higher or equal to 3.5 on your system. You can check your installed python3 version, by typing at the command prompt:

$ make check

If any error, or a lower version, please consult the Python documentation to proceed to the Python setup guide.

Running Tests

To run any PyLox script in an interative prompt mode, type:

$ make repl
> ...

Or to interpret a script located at a .plox file, provide the full path to the file:

$ make run <file path>

You can try to run your own PyLox scripts, or any of the scripts located at the "tests" folder in this project.

e.g., to run a single test script, type:

$ make test

Or to consult this guide at any time, type:

$ make help

The Language

PyLox was born from the Lox language, originally designed by Bob Nystrom at the Crafting Interpreters book.

It is a high-level dynamically-typed language, that supports Object-Oriented Programming and have a C-like syntax. This dynamic type feature allows variables to store values of any type at runtime, but operations with operands of different data types are not allowed.

PyLox supports :

* 4 built-in data-types : Numbers, Booleans, Strings and nil,
* Expressions,
* Control Flow statements,
* Print statement,
* While and For Loops,
* Functions,
* Classes,
* Single Inheritance 

*please consult the PyLox Grammar file for more details

To Do

  • anonymous functions
  • break & continue statements
  • exit statement
  • delete statement
  • getters
  • allows to read input from user
  • ? allows to work with files
  • ? assignments += -= *= /=
  • ? static methods
  • ? some other built-in data-types or functions ...

Status

Finished Part II - A Tree-Walk Interpreter

pylox's People

Contributors

tonisidneimc avatar

Stargazers

 avatar  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.