Hacker Newsnew | past | comments | ask | show | jobs | submit | scapbi's commentslogin

Crafting Interpreters https://craftinginterpreters.com is a super friendly, step-by-step guide to building your own language and VM, looking forward to seeing what kind of language you come up with too!

I'll second this. It's fantastic.

We’ve been building Mochi, a small statically typed language for querying structured data like JSON, CSV, and in-memory lists. In the latest release (v0.10.5), you can write SQL/LINQ-style queries with from, where, join, and group by, all fully type-checked and testable inline.

What makes it different: queries compile to a register-based bytecode VM (written in Go) with compiler passes like constant folding, liveness analysis, and dead code elimination. It’s meant to feel like writing SQL inside a real language, backed by actual compiler infrastructure.

If you’re interested in how query engines, DSLs, or virtual machines work, this might be worth exploring.


This thread was the final push I needed to add logic programming to Mochi https://github.com/mochilang/mochi — a small statically typed scripting language I’m building for agents and real-time data.

I gave OpenAI Codex a single prompt with a sample like:

  fact parent("Alice", "Bob")
  rule grandparent(x, z) :- parent(x, y), parent(y, z)
  let gps = query grandparent(x, z)

And it generated a working Datalog engine in Go with:

  - fact storage + recursive rule support
  - bottom-up fixpoint evaluation
  - unification and `!=` constraints
  - FFI bindings to expose `fact`, `rule`, and `query` to scripts
Full thinking process: https://chatgpt.com/s/cd_684d3e3c59c08191b20c49ad97b66e01

Total implementation was ~250 LOC. Genuinely amazed how effective the LLM was at helping bootstrap a real logic layer in one go.

The PR is here https://github.com/mochilang/mochi/pull/616


Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: