Using DSLs with LLMs: From Prompt to Structured Output
Suppose you want an LLM to extract structured information from messy text — but you don’t want to hand-write JSON schemas or fragile parsing logic.
Input:
Jane booked a table for 4 at 7:30pm tomorrow at Bistro Verde
Desired output:
{
"name": "Jane",
"party_size": 4,
"time": "7:30 PM",
"restaurant": "Bistro Verde",
"date": "tomorrow"
}
Slangify lets you define that structure with a DSL, then use an LLM to populate it reliably. This tutorial walks through everything from a first schema to a real-world pipeline.
Understand what Slangify does
Define a simple DSL schema using a Raku Grammar
Connect it to an LLM via LLM::Functions
Generate structured outputs from prompts
Validate and post-process results
See how this fits into a real workflow
Naturally, the example DSL code shown in this tutorial was itself generated by an LLM Agent (Claude Code). See LINK HERE for the prompts and tweaks we used to get a clean solution - adapt those for your own project.
Visit https://slangify.org for more information, examples and guidance.
Please ping the https://raku.org/community