YAAL Parser Implementation
This project contains both Python (Lark) and C++ (PEGTL) implementations of parsers for the YAAL (Yet Another Abstract Language) specification.
YAAL Language Features
YAAL is a flexible, statement-based language that supports:
- Dual nature: Same syntax for data structures and executable programs
- Statement model: Simple statements (no colons) and compound statements (key:value)
- First colon rule: Everything before first colon = key, everything after = value
- Shebang support: Context switching with
#!pipeline,#!hibrid-code, etc. - Brace blocks: Raw content containers with balanced brace matching
- Triple-quoted strings: Multiline string support
- Flexible keys: Keys can contain spaces and special characters
- Indentation-based nesting: Spaces-only (no tabs)
Parser Implementations
C++ Parser (PEGTL)
Location: src/cpp/
Features:
- Complete YAAL specification compliance
- Fast parsing with PEGTL library
- Detailed AST visitor pattern
- Comprehensive error handling
Building:
cmake -B build -S src/cpp
cmake --build build
Usage:
./build/yaal <filename.yaal>
Python Parser (Lark)
Location: src/py/yaal/
Features:
- YAAL grammar in Lark format
- Python indentation handling
- Command-line interface
- Graceful dependency handling
Dependencies:
pip install lark
Usage:
python3 src/py/yaal/yaal.py <filename.yaal>
Example YAAL Files
Basic Example (test_input.yaal)
#!pipeline
name: John
api endpoint: https://api.example.com:8080/v1
production
config:
debug: false
timeout: 30
script: { echo hello; exit 0 }
Comprehensive Example (comprehensive_test.yaal)
Demonstrates all YAAL features including:
- Shebang lines
- Simple and compound statements
- Keys with spaces
- Triple-quoted strings
- Brace blocks
- Nested structures
- Polymorphic lists
Grammar Highlights
Lark Grammar (src/py/yaal/yaal.lark)
start: [shebang_line] file_input
shebang_line: \"#!\" IDENTIFIER _NEWLINE
?stmt: simple_stmt | compound_stmt
simple_stmt: line_content _NEWLINE
compound_stmt: key_part \":\" value_part _NEWLINE?
brace_block: \"{\" brace_content \"}\"
quoted_string: ESCAPED_STRING | TRIPLE_QUOTED_STRING
PEGTL Grammar (src/cpp/yaal.cpp)
struct shebang_line : pegtl::seq<pegtl::string<'#', '!'>, identifier, pegtl::eol> {};
struct simple_stmt : pegtl::seq<line_content, _NEWLINE> {};
struct compound_stmt : pegtl::seq<key_part, pegtl::one<':'>, /* ... */> {};
struct brace_block : pegtl::seq<pegtl::one<'{'>, brace_content, pegtl::one<'}'>> {};
Testing
Both parsers have been tested with:
- Basic YAAL syntax
- Complex nested structures
- All string types (unquoted, quoted, triple-quoted)
- Brace blocks with nested content
- Real-world examples from the YAAL specification
Compliance
✅ Complete YAAL specification compliance
✅ All examples from https://github.com/zokrezyl/yaal-lang parse successfully
✅ Proper error handling and reporting
✅ Extensible architecture for semantic analysis
Next Steps
- Semantic Analysis: Add interpretation and execution capabilities
- Context Handlers: Implement shebang-based context switching
- Integration: Connect to YAAL execution engines
- Tooling: Add syntax highlighting, LSP support, etc.
Both parsers provide a solid foundation for building YAAL-based tools and applications.
Metadata
Release files for yaal 0.1.0
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 |
|---|---|---|---|---|
| yaal-0.1.0.tar.gz | 191.9 kB | Without provenance | Details for yaal-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yaal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for yaal-0.1.0-py3-none-any.whl |
Total release size: 200.4 kB
Release files / yaal-0.1.0.tar.gz
| Download URL | yaal-0.1.0.tar.gz |
|---|---|
| Size | 191.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a285225090d3208fbaef451d2b8c6e26281fbd90bb0fb2996bfd240fb7173651
|
|
BLAKE2b-256 checksum How to use checksums |
56e7470aefabc07254f6149a063b0229166efbc43b98759e7d13b956dff64f08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / yaal-0.1.0-py3-none-any.whl
| Download URL | yaal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb56fa457b85e17ea946a90f063aad005a500ba28d66e15a8954575a2ca35032
|
|
BLAKE2b-256 checksum How to use checksums |
8836d88d712199cec1ffac7a7e791521caeb0ce5a0801465d2e735787a38671c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for yaal 0.1.0
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.