An open API service indexing awesome lists of open source software.

https://github.com/dwayne/whitespace-python

A Whitespace interpreter written in Python.
https://github.com/dwayne/whitespace-python

python whitespace

Last synced: 10 months ago
JSON representation

A Whitespace interpreter written in Python.

Awesome Lists containing this project

README

          

Whitespace
==========

.. image:: https://img.shields.io/pypi/v/whitespace.svg
:target: https://pypi.org/project/whitespace/

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

Installation
------------

To install, simply use pip (or `pipenv`_):

.. code-block:: bash

$ pip install whitespace

Usage
-----

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

.. code-block:: bash

$ whitespace program.ws

You can find example `Whitespace`_ programs at `tests/fixtures `_.

For example, here's the `factorial program `_:

.. code-block:: bash

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

Development
-----------

Recommended tools:

- `pyenv `_
- `pipenv`_

Clone the repository and install the dependencies:

.. code-block:: bash

$ git clone git@github.com: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.

.. code-block:: bash

$ python -m unittest

Run a specific test module.

.. code-block:: bash

$ python -m unittest tests.test_parser

Run a specific test case.

.. code-block:: bash

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

References
----------

- `Whitespace tutorial `_

Credits
-------

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

.. _Whitespace: https://en.wikipedia.org/wiki/Whitespace_(programming_language)
.. _pipenv: https://github.com/pypa/pipenv