←back to thread

439 points david927 | 10 comments | | HN request time: 1.042s | source | bottom

What are you working on? Any new ideas which you're thinking about?
1. tamnd ◴[] No.44419212[source]
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(5): >>44420253 #>>44422333 #>>44426351 #>>44427284 #>>44445710 #
2. dahsameer ◴[] No.44420253[source]
looks super cool for some quick data filtering and manipulation
replies(1): >>44422574 #
3. bArray ◴[] No.44422333[source]
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?
replies(2): >>44422532 #>>44429804 #
4. scapbi ◴[] No.44422532[source]
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!
replies(1): >>44426414 #
5. tamnd ◴[] No.44422574[source]
It's been great for quickly filtering and transforming structured data like CSV and JSON. Optimizing the VM is fun too, though it sometimes comes at a cost, we once broke around 400 tests after adding peephole optimizations that changed how the IR handled control flow.
6. snthpy ◴[] No.44426351[source]
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.

7. Jemaclus ◴[] No.44426414{3}[source]
I'll second this. It's fantastic.
8. qafy ◴[] No.44427284[source]
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.
9. xqb64 ◴[] No.44429804[source]
The concepts that the OP talks about (liveness analysis, constant folding, dead code elimination), and similar stuff revolving around IR optimization, can be found explained in great detail in Nora Sandler's "Writing a C compiler".
10. NotAnOtter ◴[] No.44445710[source]
If one wished, could they do something like

`save adults to "adults.json" as XML`

The expected output would be a file with the name "adults.json" containing XML data. I don't see much benefit in this specific use case but I do have a 'code smell' in having the language automagically determine the output structure for me.