Skip to main content

Staxlang

A ZISC inspired stack based language / interpreter written in python, providing simple instruction sets for executing programs

Features

  • Stack based: Uses variable number of Stacks to store items of varying data types in memory.
  • Postfix notation: Use PUSH, POP, PRINT, and arithmetic keywords to perform instructions on the stack using postfix notation.

Installation

  • Install python and pip using your OS package manager

  • Run

    $ pip install staxlang

Usage

  • Create a test file test.stax
stack;
PUSH "Hello World" stack;
PRINT stack;

Execute the program by running

stax test.stax

output:

Hello World
  • You can also run the stax program just by itself. This will open in repl mode and you can run arbitrary commands in the interpreter.
>>> stack;
>>> PUSH "Hello World!" stack;
>>> PRINT stack;
Hello World
>>>

Examples

Hello world

Code:

stack;                       # Creating a stack of name "stack"
PUSH "Hello World" stack     # Pushing "Hello World" to the stack
PRINT stack;                 # Printing the topmost variable in the stack

output:

Hello World!

Calculation

Code:

stack;                       # Creating a stack of name "stack"
PUSH 1 stack;                # Pushing 1 to the stack 
PUSH 2 stack;                # Pushing 2 to the stack
ADD stack;                   # Removing the top 2 elements in the stack and pushing its sum to the stack
PRINT stack;                 # Printing the topmost variable in the stack

output:

3

Keywords

Here are a list of keywords in the language

Keyword Description Syntax
PUSH Push a value onto the stack PUSH VAL ST_NAME;
POP Pop the topmost value from the stack POP ST_NAME;
PRINT Print the top most element in the stack PRINT ST_NAME;
ADD Pop the top two elements in the stack and push the sum ADD ST_NAME;
SUBT Pop the top two elements in the stack and push the difference SUBT ST_NAME;
MULT Pop the top two elements in the stack and push the product MULT ST_NAME;
DIV Pop the top two elements in the stack and push the quotient DIV ST_NAME;
MOD Pop the top two elements in the stack and push the modulus MOD ST_NAME;
EXIT Exit the program EXIT;

Any other keyword used is considered as the name of a new stack

Legend:

KEY VALUE
VAL Any value
ST_NAME Name of an already defined Stack

Metadata

Release files for staxlang 0.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 staxlang 0.0.1
File Size Uploaded Provenance
staxlang-0.0.1.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for staxlang 0.0.1
File Interpreter ABI Platform
staxlang-0.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.9 kB

Release files / staxlang-0.0.1.tar.gz

Download URL staxlang-0.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c41c8a8ebf57568020c5aaf2da51337e8a1a0a6c9ecc9b566f1d16b446bb8a3f
BLAKE2b-256 checksum
How to use checksums
29758fd0b88752afbf50524c790e9bbe51ae202613269d66200ec4e7df81af0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / staxlang-0.0.1-py2.py3-none-any.whl

Download URL staxlang-0.0.1-py2.py3-none-any.whl
Size 11.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0024220891aee672d216257c098356920b35f7ea89f2fc66d039c1bc2ad4e8ac
BLAKE2b-256 checksum
How to use checksums
d83dbda42c2a1a3e6303c0da8016fa4b0bebf0abb52d65da890ba42ca0db001e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for staxlang 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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