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.
- Host: GitHub
- URL: https://github.com/dwayne/whitespace-python
- Owner: dwayne
- License: mit
- Created: 2016-08-31T09:10:07.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:44:56.000Z (over 3 years ago)
- Last Synced: 2025-08-16T10:59:26.880Z (10 months ago)
- Topics: python, whitespace
- Language: Python
- Homepage: https://web.archive.org/web/20150717190859/http://compsoc.dur.ac.uk:80/whitespace/
- Size: 59.6 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
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