Show HN: Lemma – A declarative language for business rules
1–2 of 2 posts
Re: Show HN: Lemma – A declarative language for business rules
#2To build and maintain reliable systems, we need to separate rules, agreements, and law from application logic. Traditional BREs don't cut it because they are heavy, visual/drag and drop, or just limited to some feature set. We need something lightweight that runs anywhere. And FOSS, of course.
I built Lemma as a domain specific language, to write down complex rules in a way that remains readable to non-technical stakeholders.
Key design choices:
- Syntax mirrors policies and law: "X applies, unless Y, then Z applies." This is the only logical construct. There are no if/else or match statements.
- Strictly typed, full type inference, native support for units of measure. For example: 20 eur/hour * 3 hours resolves to 60 eur.
- Temporal versioning allows rules for past, present, and future to sit side by side on a timeline. - Comptime algebraic simplification, runtime arithmetic with fractions internally for linear math to remain precise.
- Explanations show exactly which rules applied and how they were evaluated. Not a stack trace: a semantic trace.
I also recently added an MCP server so LLM agents can use Lemma to lock rules and follow them deterministically.
I'm here for feedback, critique, the love, the hate and the GitHub stars. Looking forward to hearing your thoughts or questions.
Repo: https://github.com/lemma/lemma
cheers, Ben