logoalt Hacker News

tamndyesterday at 3:57 AM4 repliesview on HN

Repo: https://github.com/mochilang/mochi

I'm building Mochi, a small programming language with a custom VM and a focus on querying structured data (CSV, JSON, and eventually graph) in a unified and lightweight way.

It started as an experiment in writing LINQ-style queries over real datasets and grew into a full language with:

- declarative queries built into the language

- a register-based VM designed for analysis and optimization

- an intermediate representation with liveness analysis, constant folding, and dead code elimination

- static type inference, inline tests, and golden snapshot support

Example:

  type Person {
    name: string
    age: int
  }

  let people = load "people.yaml" as Person

  let adults = from p in people
             where p.age >= 18
             select { name: p.name, age: p.age }

  for a in adults {
    print(a.name, "is", a.age)
  }

  save adults to "adults.json"

The long-term goal is to make a small, expressive language for data pipelines, querying, and agent logic, without reaching for Python, SQL, and a half-dozen libraries.

Happy to chat if you're into VMs, query engines, or DSLs.


Replies

qafyyesterday at 8:06 PM

This is awesome. I often start to reach the limits of my patience trying to figure out how to do things in `jq` DSL. This seems way more friendly.

snthpyyesterday at 6:25 PM

Very cool!

This is exactly the kind of thing I've had in mind as one of the offshoots for PRQL for processing data beyond just generating SQL.

I'd love to chat some time.

dahsameeryesterday at 6:51 AM

looks super cool for some quick data filtering and manipulation

show 1 reply
bArrayyesterday at 12:17 PM

Interesting project. I'm quite interested in developing a small programming language myself, but am not sure where to start. What resources do you recommend?

show 2 replies