GithubHelp home page GithubHelp logo

dwayne / whitespace-python Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 0.0 61 KB

A Whitespace interpreter written in Python.

Home Page: https://web.archive.org/web/20150717190859/http://compsoc.dur.ac.uk:80/whitespace/

License: MIT License

Python 100.00%
python whitespace

whitespace-python's Introduction

Whitespace

An interpreter written in Python for the imperative, stack-based language called Whitespace.

Installation

To install, simply use pip (or pipenv):

$ pip install whitespace

Usage

Let program.ws be any Whitespace program. To execute it, type:

$ whitespace program.ws

You can find example Whitespace programs at tests/fixtures.

For example, here's the factorial program:

$ whitespace fact.ws
Enter a number: 40
40! = 815915283247897734345611269596115894272000000000

Development

Recommended tools:

Clone the repository and install the dependencies:

$ git clone [email protected]:dwayne/whitespace-python.git
$ cd whitespace-python
$ pipenv shell
$ pipenv install --dev

You're now all set to begin development.

Testing

Tests are written using the built-in unit testing framework, unittest.

Run all tests.

$ python -m unittest

Run a specific test module.

$ python -m unittest tests.test_parser

Run a specific test case.

$ python -m unittest tests.test_parser.ParserTestCase.test_it_parses_push

References

Credits

Thanks to Edwin Brady and Chris Morris for designing/developing this programming language; they are also developers of the Idris programming language.

whitespace-python's People

Contributors

dwayne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

whitespace-python's Issues

Add disassemble option

Displays the instructions in a human readable format.

$ whitespace --disassemble count.ws
# or
$ whitespace -d count.ws
push 1
label " "
dup
putn
...

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.