Interactive Text-based Object Management System - A DSL processor for executing programs with visual output.
Install dependencies and browsers:
pip install -r requirements.txt
playwright install
brew install marp-cliTo add a new program to the local program directory:
python src/cmdline.py -add <program_name> -source <source_file>Example:
python src/cmdline.py -add bubbleSort -source tests/bubbleSort.itomTo run a program by name with specified output format and file:
python src/cmdline.py -run <program_name> -output <output_file> -format <format>Example:
python src/cmdline.py -run bubbleSort -output bubbleSort.png -format pngSupported formats: png, html
Keep in mind you will have to add all included programs in order to execute a top-level program successfully
To see all available programs:
python src/cmdline.py -statusIt is possible to get all the included itoms (hierarchly) of a program by invoking cmdline with -i or --includes:
python src/cmdline.py -i programnameThe execution trace can be displayed by using -t or --trace with --run
It is possible to modify the inputs on an itom and produce a derivative itom with those inputs pre-set
To check which inputs you can set, you can run:
python src/cmdline.py -curry cvllmThis will indicate what inputs cvllm has.
To modify these, you can do:
python src/cmdline.py -curry cvllm -inputs filename=cv9.pdf -output cv9llmOutput is an optional new program name. If it is not provided, a derivative name will be produced (cvllm_XXXX based on the hash of the input).
Multiple inputs can be provided separated by a space. Quoting is needed for more sophisticated types:
python src/cmdline.py -curry programName -inputs 'a=["a","b","c"]' c="d" 'x={"a":"b"}' -output newProgramIf the input has a nested structure, e.g.,
#@ inputs:
#@ input1:
#@ default: ...
#@ type: string
currying will modify (or add) the key "default" (leaving the rest as is).
ITOMS supports three different DSL processors for different types of programs:
File: basicDslProcessor.py
Description: Processes markdown documents with embedded variables and includes for creating interactive documentation.
Example (tests/bubbleSort.itom):
# Welcome to Bubble Sort
We have a list of numbers:
{{numbers = [5, 3, 8, 4, 2]}}
Current list: {{numbers}}
After sorting: {{include("bubbleSortAlgorithm", numbers)}}
Usage:
python src/cmdline.py -add bubbleSort -source tests/bubbleSort.itom
python src/cmdline.py -run bubbleSort -output bubbleSort.png -format pngFile: aiImageDslProcessor.py
Description: Generates images using OpenAI's DALL-E API based on text prompts with variable substitution.
Example (tests/aiImagePrompt.itom):
{{subject = "a futuristic city"}}
{{style = "cyberpunk"}}
{{size = "large"}}
A beautiful {{subject}} in {{style}} style with neon lights and flying cars
Usage:
# Requires OPENAI_API_KEY environment variable
export OPENAI_API_KEY="your-api-key-here"
python src/cmdline.py -add aiImage -source tests/aiImagePrompt.itom
python src/cmdline.py -run aiImage -output aiImage.png -format pngFile: spreadsheetDslProcessor.py
Description: Creates interactive spreadsheets with cells, formulas, and basic functions.
Example (tests/testSpreadsheet.itom):
# Sample budget spreadsheet
A1: Income
A2: 5000
A3: 3000
A4: 2000
B1: Expenses
B2: 1500
B3: 800
B4: 600
C1: Total Income
C2: =SUM(A2:A4)
C3: Total Expenses
C4: =SUM(B2:B4)
C5: Net
C6: =C2-C4
Usage:
python src/cmdline.py -add spreadsheet -source tests/testSpreadsheet.itom
python src/cmdline.py -run spreadsheet -output spreadsheet.html -format htmlSupported Functions:
SUM(range)- Sum values in a rangeAVERAGE(range)- Average values in a rangeMAX(range)- Maximum value in a rangeMIN(range)- Minimum value in a range- Basic arithmetic with cell references
Use the markdown format as described in Marp
Slides are split using ---, e.g.:
{% set name = 'Bob' %}
# slide 1
- Hi {{name}}
<!-- speaker notes will be converted to voice. Isn't that cool {{name}}? -->
----
# slide 2
Usage
python src/cmdline.py -add tests/VideoSlideTest.itom
python src/cmdline.py -run VideoSlideTest -output temp.mp4 -format mp4Similar to above, this will just generate an HTML slide deck
Usage
python src/cmdline.py -add tests/SlideTest.itom
python src/cmdline.py -run SlideTest -output slides.html -format htmltests/bubbleSort.itom- Interactive bubble sort documentation (Basic DSL)tests/aiImagePrompt.itom- AI image generation example (AI Image DSL)tests/testSpreadsheet.itom- Budget spreadsheet example (Spreadsheet DSL)
Programs are stored in the .programs directory as individual folders containing:
program.json- Program metadata and version historycode.itom- Latest program source code