Comment by scapbi

Comment by scapbi 3 days ago

0 replies

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