Skip to main content

What is "Stack Lang Engine"

SLE (Stack Lang Engine) is a zero-dependency, highly extensible engine for building stack-oriented DSLs and mini-languages. It was designed to be a lightweight module while offering a useful set of built-in functions.

Quick Example

import package.stack_lang_engine as sle

eng = sle.StackEngine()

@eng.reg_word("+")
def add():
    b = eng.pop()
    a = eng.pop()
    eng.push(a + b)

eng.exec("10 20 +")
print(eng.latest())

Documentation

Import Module

Of course we need to import a module, and create object with type "StackEngine"

import stack_lang_engine as sle

eng = sle.StackEngine()

Definition of words:

# Define new word
@eng.reg_word("print")
def print_pop():
    print(eng.pop())

# or
# eng.add_word("print", lambda: print(eng.pop()))

# Delete word
eng.del_word("print")

How to execute code (given as string)

# If you use the default regex pattern, 
# it automatically recognizes whether it is a string or a number.
eng.exec('10 20 30 "40"')

How to create stack and APIs for it

# Create new stack, we can use "create_api" option
# to create eng.{name}_push, eng.{name}_pop() methods
# for object

eng.new_stack("stacky", create_api=True)
# now we have eng.stacky_push and eng.stacky_pop

eng.stacky_push(10)
print(eng.stacky)
eng.stacky_pop()

Recognizers

# We can create a new regex pattern, 
# and both the parser and the interpreter must handle it.

eng.add_recognizer(
    name="Test", # Name of recognizer
    pattern=r'Test', # Regex pattern
    on_regex=lambda val: val, # What parser should get (or do) when it parses it
    on_interpret=lambda val: print("Hello, Test!?"), # What interpreter should do when it gets it
)

# and if then we execute it will output
# "Hello, Test!?" when it interprets word
# with "Test" kind

eng.exec("Test 10 20")
print(eng.stack) # It will print [10, 20]

Usefull APIs

# Instead of writing "eng.stack.pop" or more we can use builtin
# methods like eng.(push, pop, clear, latest)

eng.push(10) # For example

Thanks for reading the documentation!

License

SLE is licensed under GPLv3 License

Metadata

Release files for stack-lang-engine 0.0.5

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

Source distribution (sdist)

Source distribution for stack-lang-engine 0.0.5
File Size Uploaded Provenance Actions
stack_lang_engine-0.0.5.tar.gz 15.3 kB With provenance Details for stack_lang_engine-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stack-lang-engine 0.0.5
File Interpreter ABI Platform Actions
stack_lang_engine-0.0.5-py3-none-any.whl Python 3 none any Details for stack_lang_engine-0.0.5-py3-none-any.whl

Total release size: 31.2 kB

Release files / stack_lang_engine-0.0.5.tar.gz

Download URL stack_lang_engine-0.0.5.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
301db2c96f15bb4bc32b53cd02b27a7ee25da86aee629ffd8c39843591e66114
BLAKE2b-256 checksum
How to use checksums
a687d00fbb14ef02af5a5472aef6e46caa41e6f125d4a752559741eefb98add9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / stack_lang_engine-0.0.5-py3-none-any.whl

Download URL stack_lang_engine-0.0.5-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e3e71a863e21250a2c70f4c9f592f57cf62bddbe954b2dae181fd0ff2e314a3
BLAKE2b-256 checksum
How to use checksums
8daf7af2af5154d4ef8558d5c156a276258a62af6d08d5a5c32585104ecfa1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Security for stack-lang-engine 0.0.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stack_lang_engine-0.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

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.

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