| ▲ | Show HN: MOL – A programming language where pipelines trace themselves(github.com) | ||||||||||||||||
| 27 points by MouneshK 3 days ago | 9 comments | |||||||||||||||||
Hi HN, I built MOL, a domain-specific language for AI pipelines. The main idea: the pipe operator |> automatically generates execution traces — showing timing, types, and data at each step. No logging, no print debugging. Example:
This auto-prints a trace table with each step's execution time and output type. Elixir and F# have |> but neither auto-traces.Other features: - 12 built-in domain types (Document, Chunk, Embedding, VectorStore, Thought, Memory, Node) - Guard assertions: `guard answer.confidence > 0.5 : "Too low"` - 90+ stdlib functions - Transpiles to Python and JavaScript - LALR parser using Lark The interpreter is written in Python (~3,500 lines). 68 tests passing. On PyPI: `pip install mol-lang`. Online playground (no install needed): http://135.235.138.217:8000 We're building this as part of IntraMind, a cognitive computing platform at CruxLabx. """ | |||||||||||||||||
| ▲ | nivertech 3 days ago | parent | next [-] | ||||||||||||||||
> Elixir and F# have |> but neither auto-traces. Using dbg/2 [1]:
This code prints:
---1. Debugging - dbg/2 | |||||||||||||||||
| |||||||||||||||||
| ▲ | wavemode 4 hours ago | parent | prev | next [-] | ||||||||||||||||
> The Killer Feature: |> with Auto-Tracing. No other language has this combination Of the languages listed, Elixir, Python and Rust can all achieve this combination. Elixir has a pipe operator built-in, and Python and Rust have operator overloading, so you could overload the bitwise | operator (or any other operator you want) to act as a pipeline operator. And Rust and Elixir have macros, and Python has decorators, which can be used to automatically add logging/tracing to functions. It's not automatic for all functions, though having to be explicit/selective about what is logged/traced is generally considered a good thing. It's rare that real-world software wants to log/trace literally everything, since it's not only costly (and slow) but also a PII risk. | |||||||||||||||||
| |||||||||||||||||
| ▲ | bb88 4 hours ago | parent | prev | next [-] | ||||||||||||||||
This strikes me as cool to see someone build another language with python using lark, it's also possible to override the ">>" or "|" characters in python to achieve the same thing, and also you don't have to worry about the "lark" grammar. I had a custom lark grammar I thought was cool to do something similar, but after a while I just discarded it and went back to straight python, and found it was faster my an order of magnitude. | |||||||||||||||||
| ▲ | nnnnico 3 hours ago | parent | prev | next [-] | ||||||||||||||||
Cool project. Could You expand on what is the use case for something like it compares to e.g. a python library? Maybe an example of more complex workflows or open ended loops/agents that can showcase the pros of using such a language compared to other solutions. Are these pipelines durable for example or how do they execute? | |||||||||||||||||
| ▲ | qrios 5 hours ago | parent | prev | next [-] | ||||||||||||||||
Very interesting! I'll definitely give it a try. However, the documentation link[1] isn't working at the moment (404). | |||||||||||||||||
| ▲ | desireco42 2 hours ago | parent | prev [-] | ||||||||||||||||
Kind of like Ruby... with pipes. Elixir has them, but this reminds me more like Ruby. | |||||||||||||||||