Meadows – a small language for stock-and-flow diagrams that run

jjsalamon 29 points 3 comments October 09, 2026
lorezzed.github.io · View on Hacker News

Discussion Highlights (2 comments)

jjsalamon

I was reading Donella Meadows' "Thinking in Systems" and wanted to play with its diagrams instead of just looking at them, so I wrote a small language for them. You type a model: | =>inflow [water in tub: 50] =>outflow: 5 | and get the stock-and-flow diagram, a chart of each stock over time, and an animation of the run on the diagram itself: stocks, and feedback loops pulse. Each example has notes in its source explaining what it shows. You can also build by clicking. It runs entirely in the browser, with no account and no backend. The whole model lives in the URL, so any diagram can be shared as a link. The compiler is PureScript (lexer, parser evaluator) and emits a graph as JSON; the front end is TypeScript and d3, with a force layout and a fixed-step Euler simulator. It's deliberately small: numbers are plain numbers with no units, and the simulator takes simple fixed steps. It's for learning and sketching, not a replacement for Vensim or Stella. Source (MIT): https://github.com/lorezzed/meadows I'd welcome feedback on the language itself

jamessb

The "Behaviour over time" graphs don't seem to render for the hunger/chicken & egg/burnout/predator & prey examples.

Semantic search powered by Rivestack pgvector
8,999 stories · 84,560 chunks indexed