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 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 GPL-3.0 License
Metadata
Release files for stack-lang-engine 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stack_lang_engine-0.0.6.tar.gz | 15.4 kB | With provenance | Details for stack_lang_engine-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stack_lang_engine-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for stack_lang_engine-0.0.6-py3-none-any.whl |
Total release size: 31.5 kB
Release files / stack_lang_engine-0.0.6.tar.gz
| Download URL | stack_lang_engine-0.0.6.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
affc1580ff5bafac9fd56001f7e59ef4e486780a51f006044f3e1902717181e7
|
|
BLAKE2b-256 checksum How to use checksums |
8644a34b227f5be4eefe14699a5b2c629e84fdb9db5341fa28301189bee236a3
|
| 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 26, 2026.
Transparency logRelease files / stack_lang_engine-0.0.6-py3-none-any.whl
| Download URL | stack_lang_engine-0.0.6-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45a85f062439f9fc85f2482013c1dda1bf9aa3f9e21089416f2961c50914ea84
|
|
BLAKE2b-256 checksum How to use checksums |
996d20113af52f9499ec3d4f23b58ec0fc8de063fb772e067fd4fb02a776748e
|
| 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 26, 2026.
Transparency logSecurity for stack-lang-engine 0.0.6
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.
Attestation for stack_lang_engine-0.0.6.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 26, 2026.
Transparency logA 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.