Skip to main content

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

Project description

Makefile CI PyPI version Python versions Python wheel

An interpreter written in Python for the imperative, stack-based language called Whitespace. This is a fork of https://github.com/dwayne/whitespace-python.

Installation

To install, simply use pip (or pipenv):

$ pip install whitespace2

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 git@github.com:rzuckerm/whitespace-python.git
$ cd whitespace-python
$ poetry env '<python-version>'
$ poetry install

where <python-version> is the version of python that you have installed. This must be at least python 3.8. Example for python 3.10:

$ poetry env 3.10

You’re now all set to begin development.

Formatting

The code is formatted using black.

Run the formatter:

$ make format

Linting

The code is linted using black and pylint.

Run the linters:

$ make lint

Testing

Tests are written using pytest.

Run all tests.

$ make test

Run a specific test module.

$ make test PYTEST_ARGS="-vvl -m test.<my-module>"

Run a specific test case.

$ make test PYTEST_ARGS="-vvl -k test.test_parser.ParserTestCase.test_it_parses_push"

Help

To get a list of make targets, run this:

$ make help

References

Credits

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whitespace2-1.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

whitespace2-1.0.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file whitespace2-1.0.0.tar.gz.

File metadata

  • Download URL: whitespace2-1.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.8.0-1015-azure

File hashes

Hashes for whitespace2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5579421dab24bea99ea468970807c550dc5b32ee5c47d4d0dedac874eeb5eb38
MD5 f811680cbc2378fac46f8467d5bb18c7
BLAKE2b-256 0ec3db9ec72437868cdc30124a719773de6ad3a9b5bbcade8ed6437eeadfaed0

See more details on using hashes here.

File details

Details for the file whitespace2-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: whitespace2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.8.0-1015-azure

File hashes

Hashes for whitespace2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed7da8d26703acd46c0f9b3b8444faa1313fb9ae443cb3c93200d0eccda65a64
MD5 6d4f2fd757145e7bc73f6eb4d51cb4b0
BLAKE2b-256 9ee5b7aa127ed8ea208d633dd05e21aa7fd81cca6211e3257fc4adf99f576493

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page