Abracadabra is a scratchpad for experimenting with a custom markup language. This project aims to provide a simple and intuitive way to describe page layouts and content using a domain-specific language (DSL). The current implementation allows parsing and rendering of hierarchical document structures defined using a straightforward syntax.
- Custom Markup Language: Define page layouts and content using an easy-to-read DSL.
- Chumsky Parser Integration: Utilizes the
chumsky
parser combinator library for flexible and efficient parsing. - Hierarchical Components: Supports nested structures like titles, subtitles, footers, rows, columns, and blocks.
- Pretty Printing: Nicely formatted output of parsed documents for easier debugging and inspection.
To run this project, you will need to have Rust installed on your machine. You can install Rust by following the instructions at rust-lang.org.
Clone the repository to your local machine:
git clone https://github.com/yourusername/abracadabra.git
cd abracadabra
Simply run the following command to parse and render the example input provided in the main
function:
cargo run
You should see the numbered input followed by the parsed and pretty-printed output of the example document structure.
The following example demonstrates the simple syntax of the Abracadabra DSL:
[page]
title:: My First Page
subtitle:: An Example Optional Subtitle
box::
title:: Box Title
This is a text block inside a box.
The textbox will continue to include lines for as long
as the indentation matches, joining them together.
Blank lines like the one above create a linebreak.
row::
box:: Another box in a row
column::
box:: A box in a column inside the row
- Testing: Automated tests to ensure parser accuracy and consistency.
- Additional DSL Features: Expand the DSL to support more components and layouts.
- Improved Error Handling: More descriptive error messages for easier debugging.
- Rendering Engine: Transform parsed documents into a visual format or output format like HTML or PDF.