LLM-Augmented Declarative Execution
npm install dirac-langDirac is a declarative execution language specifically designed for the AI era, where large language models (LLMs) are not just tools, but active participants in code execution. It's named after physicist Paul Dirac and his bra-ket notation, reflecting its dual nature: bridging human-readable declarations with machine execution.
Traditional programming languages separate code from AI. You write code, then separately call an LLM API. Dirac eliminates this boundary:
``xml`
Create a Dirac program that lists all .txt files,
reads the first one, and summarizes it.
The LLM doesn't just respond—it generates Dirac code that immediately executes. The generated code can itself call LLMs, creating a recursive chain where AI and execution seamlessly interweave.
Dirac treats LLMs as autonomous agents that can:
- Generate executable code on-the-fly
- Make decisions based on runtime data
- Invoke system commands and process their output
- Call themselves recursively to break down complex tasks
- Import and compose libraries for modular problem-solving
Example of an agentic workflow:
`xml
Analyze these files and create Dirac code to process them.
`
Dirac is not just agentic—it’s also a natural fit for neural-symbolic AI. Its bra/ket-inspired knowledge representation allows you to express and connect symbolic logic and neural computation in a unified language.
Example: Aristotle’s Syllogism
- All humans are mortal.
- Socrates is a human.
- Therefore, Socrates is mortal.
In Dirac’s bra/ket notation, this can be represented as:
- |mortal⟩⟨human| (all humans are mortal)|human⟩⟨Socrates|
- (Socrates is a human)
When you ask |Socrates⟩, chaining these together yields |mortal⟩.
From a neural network perspective, these bra/ket pairs are like matrices (or tensors), and the input |Socrates⟩ is a vector. The network applies transformations—possibly nonlinear—to produce an output.
From a symbolic AI perspective, these are like Dirac subroutines:
`xml`
`
Or, in Dirac’s shorthand:`
Dirac bridges these worlds:
- As a symbolic language, it lets you define and chain logical relationships explicitly.
- As a bridge to neural networks, it enables LLMs and other neural models to participate in these chains, providing generative, nonlinear reasoning when needed.
Dirac is the missing link for building systems where symbolic structure and neural intelligence work together—making it ideal for the next generation of explainable, powerful AI.
The LLM sees real system state, generates appropriate code, and that code executes—all in one flow.
xml
What is 2+2?
Calculate 2+2
Write a loop
`$3
Express what you want, not how to do it:
`xml
df -h
Summarize the disk usage above
`$3
Programs can generate programs:
`xml
Generate code to analyze
`$3
Inspired by quantum mechanics, our .bk format reduces verbosity:XML (.di):
`xml
`Bra-Ket (.bk):
`
|parameters select=@name>
|output>Hello, |variable name=name>!|greet name=World>
`$3
Import and compose functionality with namespace-safe prefixes:
`xml
SELECT * FROM users
`Real-World Use Cases
$3
`xml
docker ps
Analyze these containers and create Dirac code to
restart any that are unhealthy.
`$3
`xml
cat data.csv | head -20
What patterns do you see? Generate Dirac code to process the full file.
`$3
`xml
I need to backup all .js files modified today to ~/backup.
Write Dirac code to do this.
`$3
`xml
Task: Analyze logs in /var/log. Generate code for this step.
Previous step output:
Now generate code to summarize findings and email the report.
`Why "Recursive" Matters
In traditional programming, recursion means a function calling itself. In Dirac, the entire execution model is recursive:
1. Code generates code: LLMs output Dirac programs
2. Programs invoke LLMs: Those programs can ask LLMs for more code
3. Infinite depth: This can continue to arbitrary depths (with safety limits)
4. Context flows: Each layer has access to results from previous layers
This creates a self-extending execution environment where the boundary between "prompt" and "program" dissolves.
Installation
`bash
npm install -g dirac-lang
`Quick Start
hello.di:
`xml
`Run it:
`bash
dirac hello.di
`With LLM (requires API key):
`bash
export ANTHROPIC_API_KEY=your-key
echo 'Write a haiku about code ' | dirac -
`Philosophy
Dirac embraces three principles:
1. LLMs are co-pilots, not tools: They execute alongside your code, not as external services
2. Declarative over imperative: Say what you want, let AI figure out how
3. Composable intelligence: Small, reusable pieces combine into powerful workflows
Future Vision
We're building toward a world where:
- Natural language prompts compile to executable Dirac
- AI-generated libraries extend functionality on-demand
- Self-improving programs refactor themselves based on execution patterns
- Multi-model orchestration lets different LLMs collaborate on subtasks
Community
- GitHub: diraclang/dirac
- npm: dirac-lang
- License: MIT
- Status: Active development (v0.1.0)
Join the Movement
Dirac is more than a language—it's a paradigm shift in how we think about code and AI. If you believe that:
- Programming should be more declarative
- LLMs should be execution partners, not API endpoints
- Code should generate code dynamically
- The future is agentic and recursive
...then Dirac is for you.
Start building the future today.
`bash
npm install -g dirac-lang
``---
"In the quantum realm, a bra meets a ket to produce reality. In Dirac, a declaration meets an LLM to produce execution."