Skip to content

tonisidneimc/PyLox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published