<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag" -->

---
title: DSLs Enable Reliable Use of LLMs | daily.dev
description: DSLs make LLM code generation more reliable and reviewable by constraining the output space and providing built-in validators. The author argues that building...
canonical: https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: DSLs Enable Reliable Use of LLMs | daily.dev
og:description: DSLs make LLM code generation more reliable and reviewable by constraining the output space and providing built-in validators. The author argues that building...
og:url: https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag
og:image: https://api.daily.dev/og/posts/TI54pqfaG.png
og:image:alt: DSLs Enable Reliable Use of LLMs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# DSLs Enable Reliable Use of LLMs

**[Martin Fowler](https://daily.dev/sources/mafo)** · 18 min read · 0 upvotes · 0 comments

## Summary

DSLs make LLM code generation more reliable and reviewable by constraining the output space and providing built-in validators. The author argues that building software with LLMs involves two phases: first using LLMs as brainstorming partners to iteratively design domain abstractions and DSLs, then using them as natural-language interfaces to those abstractions. Tickloom, a Java framework for building and testing distributed algorithms, illustrates this: its semantic model (Replica, Network, Storage, Clock) grounds LLM prompts in a fixed vocabulary, and an internal DSL built on top lets LLMs generate readable, compiler-validated test scenarios for complex distributed system behaviors like clock skew and non-linearizable reads. The key insight is that the DSL — not the prompt — becomes the durable source of truth.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://martinfowler.com/articles/llm-and-dsls.html>

## Questions this post answers

### Why do domain-specific languages make LLM code generation more reliable than general-purpose languages like Java?

DSLs constrain the space of valid syntax so heavily that a few in-context examples are enough for a model to reliably generate correct output, unlike general-purpose languages that offer many valid ways to express the same intent. DSLs also typically ship with a deterministic validator (parser, schema, type checker, compiler), letting an autonomous agent generate, validate, and repair code without human review, with errors phrased at the domain level rather than as stack traces.

_Developers weighing how to make AI-generated code trustworthy can follow this reasoning on daily.dev._

### What is Tickloom and how does its design help LLMs generate distributed systems code?

Tickloom is a small Java framework for building and testing distributed algorithms where every node runs a single-threaded tick loop, processing network, message bus, process, and storage work in a fixed deterministic order per tick. Because it supplies concrete vocabulary like Replica, quorumRequest, and countResponseIf, prompts can stay at the protocol level rather than reinventing threading, networking, or timing semantics, which shrinks the space an LLM has to hallucinate.

_Anyone exploring frameworks that constrain LLM-generated distributed systems code can dig deeper via daily.dev._

### How can an internal DSL prevent an LLM from generating invalid distributed system test scenarios?

An internal Java DSL for scenario testing uses progressive interfaces enforced by the host compiler, so a step cannot be declared before the topology or an action before selecting a client, making whole classes of malformed scenarios fail to compile. This turns a bad LLM generation into a compile error pinned to the exact illegal step rather than a runtime surprise, letting the LLM self-correct against the type system.

_Teams designing compiler-checked guardrails for AI-generated test scenarios can track approaches like this on daily.dev._

## Similar posts on daily.dev

- [What LLMs 'Know' That You Don't Know They Know: Stop Inventing Prompt DSLs and Ride 50 Years of Unix Pre-Training Gravity](https://daily.dev/posts/what-llms-know-that-you-don-t-know-they-know-stop-inventing-prompt-dsls-and-ride-50-years-of-unix-ag0gz4or8) · DEV · 4 upvotes · 1 comments
- [What Is Code?](https://daily.dev/posts/what-is-code--ehm9ofedq) · Martin Fowler · 1 upvotes · 0 comments
- [LLMs could be, but shouldn't be compilers](https://daily.dev/posts/llms-could-be-but-shouldn-t-be-compilers-cwutlxyzi) · Hacker News · 1 upvotes · 1 comments
- [From Stories to Code: Collaborative Modeling and LLMs](https://daily.dev/posts/from-stories-to-code-collaborative-modeling-and-llms-br4afbjts) · codecentric · 1 upvotes · 0 comments
- [The analogue programmer in the land of LLMs](https://daily.dev/posts/the-analogue-programmer-in-the-land-of-llms-fupyefolu) · Ruby Flow · 2 upvotes · 1 comments

---

Tags: [#java](https://daily.dev/tags/java), [#distributed-systems](https://daily.dev/tags/distributed-systems)

[View this post on daily.dev](https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"DSLs Enable Reliable Use of LLMs","url":"https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag"},"datePublished":"2026-07-14T12:51:37.454Z","dateModified":"2026-09-13T20:28:44.413Z","description":"DSLs make LLM code generation more reliable and reviewable by constraining the output space and providing built-in validators. The author argues that building...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"Martin Fowler","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Martin Fowler","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/mafo","url":"https://daily.dev/sources/mafo"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,distributed-systems","timeRequired":"PT18M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Martin Fowler","item":"https://daily.dev/sources/mafo"},{"@type":"ListItem","position":3,"name":"DSLs Enable Reliable Use of LLMs"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/dsls-enable-reliable-use-of-llms-ti54pqfag#faq","mainEntity":[{"@type":"Question","name":"Why do domain-specific languages make LLM code generation more reliable than general-purpose languages like Java?","acceptedAnswer":{"@type":"Answer","text":"DSLs constrain the space of valid syntax so heavily that a few in-context examples are enough for a model to reliably generate correct output, unlike general-purpose languages that offer many valid ways to express the same intent. DSLs also typically ship with a deterministic validator (parser, schema, type checker, compiler), letting an autonomous agent generate, validate, and repair code without human review, with errors phrased at the domain level rather than as stack traces. Developers weighing how to make AI-generated code trustworthy can follow this reasoning on daily.dev."}},{"@type":"Question","name":"What is Tickloom and how does its design help LLMs generate distributed systems code?","acceptedAnswer":{"@type":"Answer","text":"Tickloom is a small Java framework for building and testing distributed algorithms where every node runs a single-threaded tick loop, processing network, message bus, process, and storage work in a fixed deterministic order per tick. Because it supplies concrete vocabulary like Replica, quorumRequest, and countResponseIf, prompts can stay at the protocol level rather than reinventing threading, networking, or timing semantics, which shrinks the space an LLM has to hallucinate. Anyone exploring frameworks that constrain LLM-generated distributed systems code can dig deeper via daily.dev."}},{"@type":"Question","name":"How can an internal DSL prevent an LLM from generating invalid distributed system test scenarios?","acceptedAnswer":{"@type":"Answer","text":"An internal Java DSL for scenario testing uses progressive interfaces enforced by the host compiler, so a step cannot be declared before the topology or an action before selecting a client, making whole classes of malformed scenarios fail to compile. This turns a bad LLM generation into a compile error pinned to the exact illegal step rather than a runtime surprise, letting the LLM self-correct against the type system. Teams designing compiler-checked guardrails for AI-generated test scenarios can track approaches like this on daily.dev."}}]}
```

