A modular agent-ready framework for exploring domain-specific languages (DSLs)
Project description
🧩 TinyDSL
TinyDSL is a modular, agent-ready framework for exploring and testing domain-specific languages (DSLs). It currently supports two DSLs:
- 🎨 Gli — a graphics DSL for procedural image generation
- 🗣️ Lexi — a text DSL for structured, expressive text generation and reasoning
Both are served via a unified FastAPI backend and are designed to be invoked by LLM agents or external REST clients.
⚙️ Get Started
Use uv:
uv venv
uv sync
python -m tinydsl.api.main
Open http://localhost:8008/docs.
🧠 Example Usage
Lexi (Text DSL)
set mood happy
say "Hello!"
repeat 2 { say "Have a wonderful day!" }
Lexi supports persistent memory:
remember name = "John Arthur"
recall name
Gli (Graphics DSL)
set color orange
repeat 10 {
set size 3+$i
draw circle x=cos($i*20)*$i*10 y=sin($i*20)*$i*10
}
Images save to /output as {id}_{name}_{YYYYMMDD_HHMMSS}.png (when id/name provided).
🚀 What’s New
-
Lark everywhere
lark_lexi_parserandlark_gli_parsernow power both DSLs.- Deterministic, extensible grammars; clearer errors.
-
Pillow renderer by default (Gli)
- Crisp, anti-aliased output via supersampling.
- Matplotlib still available if you want it.
-
Smarter inline math
$iloop index,pi,eavailable.- Natural expressions like
10+$i*5work. calc(...)remains for explicit math.
-
AST endpoint (Lexi)
- Get parse trees to inspect/visualize your programs.
-
Stable filenames
- Artifacts saved as
{id}_{name}_{timestamp}.pngwhenidand/ornameprovided.
- Artifacts saved as
📚 API Overview
| DSL | Endpoint | Method | Purpose |
|---|---|---|---|
| Gli | /api/gli/run |
POST | Run graphics DSL code |
| Gli | /api/gli/run_example/{id} |
GET | Execute stored example |
| Lexi | /api/lexi/run |
POST | Execute Lexi DSL code |
| Lexi | /api/lexi/task |
POST | Run a predefined benchmark task |
| Lexi | /api/lexi/eval |
POST | Evaluate multiple outputs |
| Lexi | /api/lexi/memory |
GET | View persistent memory |
| Lexi | /api/lexi/memory/clear |
POST | Clear memory |
| Lexi | /api/lexi/memory/set |
POST | Set key-value in memory |
| Lexi | /api/lexi/ast |
POST | Get AST (raw dict / pretty / DOT) |
🔧 Quick Calls
Run Lexi
curl -X POST http://localhost:8008/api/lexi/run \
-H 'Content-Type: application/json' \
-d '{"code":"set mood happy\nsay \"Hello!\""}'
Get Lexi AST
curl -X POST http://localhost:8008/api/lexi/ast \
-H 'Content-Type: application/json' \
-d '{"code":"say \"Hi\"","include_pretty":true,"include_dot":false}'
Run Gli (Pillow default)
curl -X POST http://localhost:8008/api/gli/run \
-H 'Content-Type: application/json' \
-d '{"id":"adhoc_001","name":"blue_circle","code":"set color blue\nset size 10\ndraw circle x=50 y=50","save":true}'
Run a stored Gli example
curl "http://localhost:8008/api/gli/run_example/003?save=true&engine=pillow"
🤖 Agent Integration
from tinydsl.agent_tools.tinydsl_tool import TinyDSLTool
tool = TinyDSLTool(base_url="http://localhost:8008/api")
print(tool.run_lexi('say "Hello there!"')["output"])
print(tool.run_lexi_task("005"))
print(tool.get_memory()); tool.clear_memory()
📦 Data & Files
-
Examples & grammars live under
src/tinydsl/data/gli_examples.json,gli_grammar.larklexi_tasks.json,lexi_grammar.lark
-
Outputs:
./output/(images,lexi_memory.json)
You can override data paths with env vars:
GLI_EXAMPLES_PATH, GLI_GRAMMAR_PATH, LEXI_TASKS_PATH, LEXI_GRAMMAR_PATH.
🧩 Extend
Add a new DSL by creating:
- Parser + transformer (
parser/lark_<dsl>.py) - Interpreter (
<dsl>/<dsl>.py) - API router (
api/routes_<dsl>.py) - Optional: examples + tasks JSON
Register it in api/main.py.
TinyDSL’s modular design makes it easy to study continual learning, compositional reasoning, and symbolic generalization across DSLs.
🪪 License
Licensed under the Apache License, Version 2.0.
See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinydsl-0.0.6.tar.gz.
File metadata
- Download URL: tinydsl-0.0.6.tar.gz
- Upload date:
- Size: 56.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4d14c23e324aad3f0a79cb7cf995203316542a7dc2c54766d040ca731a83585
|
|
| MD5 |
7b3c1638427681e574d991af608a4786
|
|
| BLAKE2b-256 |
a5b269ea2c25cb79e2e72306ae6c345620aa4d61d4f774a722e1f98c4b35f9bc
|
Provenance
The following attestation bundles were made for tinydsl-0.0.6.tar.gz:
Publisher:
publish.yml on deepsaia/tinydsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinydsl-0.0.6.tar.gz -
Subject digest:
f4d14c23e324aad3f0a79cb7cf995203316542a7dc2c54766d040ca731a83585 - Sigstore transparency entry: 621864837
- Sigstore integration time:
-
Permalink:
deepsaia/tinydsl@5096ec90ec119a7b56d971f9abc1fa9677531ec7 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/deepsaia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5096ec90ec119a7b56d971f9abc1fa9677531ec7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tinydsl-0.0.6-py3-none-any.whl.
File metadata
- Download URL: tinydsl-0.0.6-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926724f6a37cf47649cf971f514bebfdd86721945b507d46802c6ffffb7d3d7b
|
|
| MD5 |
6f0c64200d1e2ae404ce6df048ba52ac
|
|
| BLAKE2b-256 |
ec44763bbe92082c5bd1580246e8c7a5412ec64b23531170b4418296d3ff4ba4
|
Provenance
The following attestation bundles were made for tinydsl-0.0.6-py3-none-any.whl:
Publisher:
publish.yml on deepsaia/tinydsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinydsl-0.0.6-py3-none-any.whl -
Subject digest:
926724f6a37cf47649cf971f514bebfdd86721945b507d46802c6ffffb7d3d7b - Sigstore transparency entry: 621864840
- Sigstore integration time:
-
Permalink:
deepsaia/tinydsl@5096ec90ec119a7b56d971f9abc1fa9677531ec7 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/deepsaia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5096ec90ec119a7b56d971f9abc1fa9677531ec7 -
Trigger Event:
release
-
Statement type: