Skip to main content

Makefile CI PyPI version Python versions Python wheel

whitespace-asm

Assembler for the Whitespace Programming Language. It generates a Whitespace program based on a file containing a set of keywords instead of having to type in whitespace characters.

See the Whitespace Tutorial for details on the Whitespace language.

Keywords

Keywords are case-insensitive.

Stack Manipulation

Keyword Parameter Description
push <value> Push the value onto the stack
dup Duplicate the top item on the stack
copy <number> Copy the nth item on the stack (given by the argument) onto the top of the stack
swap Swap the top two items on the stack
pop Discard the top item on the stack
slide <number> Slide n items off the stack, keeping the top item

Arithmetic

Keyword Parameter Description
add Addition
sub Subtraction
mult Multiplication
div Integer Division
mod Modulo

Heap Access

Keyword Parameter Description
store Store
retr Retreive

Flow Control

Keyword Parameter Description
label <label> Mark a location in the program
call <label> Call a subroutine
jump <label> Jump unconditionally to a label
jumpz <label> Jump to a label if the top of the stack is zero
jumpn <label> Jump to a label if the top of the stack is negative
ret End a subroutine and transfer control back to the caller
end End the program

I/O

Keyword Parameter Description
outc Output the character at the top of the stack
outn Output the number at the top of the stack
inc Read a character and place it in the location given by the top of the stack
inn Read a number and place it in the location given by the top of the stack

Comments

Comments may be on a separate line or may be inline. Comments start with ;. Example:

;This a comment
push 'H' ;Stack = 'H'
outc     ;Output 'H'

Parameters

<number>

<number> is just an integer value. It may be positive or negative. Examples:

  • 42
  • -33

<value>

<value> may either be a <number> or a character. A character is enclosed in single quotes. Backslash may be used for characters like newline ('\n'). Examples of characters:

  • ' '
  • 'H'
  • ';'
  • '\n' - Newline
  • '\'' - Single quote
  • '\\' - Backslash

<label>

<label> is a number that consists of just zeros and one. Examples:

  • 011
  • 10101

CLI

Assemble

Assemble a Whitespace program:

whitespace-asm <input> [-o/--output <output>] [-f/--format <format>]

where:

  • <input> is the path to the input Whitespace Assembly file
  • <output> is the optional path to output Whitespace file. If not specified, change the extension of <input> to .ws
  • <format> is the optional output format type:
    • raw: just whitespace
    • mark (default): whitespace is preceeded by S (space), T (tab), and L (newline)

Example:

whitespace-asm hello-world.wsasm --output hello-world.ws

Release files for whitespace-asm 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whitespace-asm 1.0.1
File Size Uploaded
whitespace_asm-1.0.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whitespace-asm 1.0.1
File Interpreter ABI Platform
whitespace_asm-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / whitespace_asm-1.0.1.tar.gz

Download URL whitespace_asm-1.0.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
77ec813f7cfdc1368ea96ae073f844fe36158ae2792ee7bd34a576c08e9203af
BLAKE2b-256 checksum
How to use checksums
08d8f4c8b02ff67bf9da5620eeca20e7b8a6449ad24c9879a363ca139716a0b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.15 Linux/6.8.0-1015-azure

Release files / whitespace_asm-1.0.1-py3-none-any.whl

Download URL whitespace_asm-1.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
077e91136095b94bc11b8841900426f1ad1aa1347a66eebe432c6d6de1f03c9f
BLAKE2b-256 checksum
How to use checksums
eb05f63ab77fcee2928a6a7570730acc1692898952fad2ce8ac5780ce4ea94df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.15 Linux/6.8.0-1015-azure

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page