Excited-ccccly / pylox

Lox language implemented in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pylox

https://travis-ci.org/Excited-ccccly/pylox.svg?branch=master https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=sqale_rating https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=coverage https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=reliability_rating https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=bugs https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=code_smells https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=sqale_index https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=security_rating https://sonarcloud.io/api/project_badges/measure?project=Excited-ccccly_pylox&metric=ncloc

Lox language implemented in Python. Inspired by Bob Nystrom's Crafting Interpreters

Features

  • booleans, numbers, strings and nil datatypes
  • dynamic typing
  • control flow. if, while, for statement
  • closures
  • recursion
  • class
  • inheritance

more at examples

Developer Guide

Make sure you have python 3.7 installed, other versions are not tested. Here I use python venv, and I highly suggest you do also:

$ git clone https://github.com/Excited-ccccly/pylox
$ cd pylox/
$ mkdir .venv
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt & pip install -r requirements.dev.txt
$ python setup.py develop

more at CONTRIBUTING

Usage

This project will register a command, pylox, in your environment(venv or system). If you use venv as I suggested, pylox will only be avaliable in venv and you have to activate venv before use pylox to interpret

Execute pylox with a script filepath argument to interpret it

$ pylox tests/data/interpreter/visitor_pattern_in_lox.lox

or without a argument to enter REPL mode

$ pylox

Know Issues

  • In REPL mode, user have to input a blank line to get code interpreted.

About

Lox language implemented in Python

License:MIT License


Languages

Language:Python 96.5%Language:Makefile 3.5%