# A few peeks of Lingling/MLgate (30/11)

**URL:** <https://d.strumenta.community/t/a-few-peeks-of-lingling-mlgate-30-11/1938>\
**Category:** Misc\
**Created:** [November 30, 2026, 10:44am UTC](https://d.strumenta.community/t/a-few-peeks-of-lingling-mlgate-30-11/1938 "2026-11-30T10:44:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mryun](https://d.strumenta.community/user_avatar/d.strumenta.community/mryun/32/1229_2.png) [@mryun](https://d.strumenta.community/u/mryun)\
**Post date:** [November 30, 2026, 10:44am UTC](https://d.strumenta.community/t/a-few-peeks-of-lingling-mlgate-30-11/1938/1 "2026-11-30T10:44:17Z")

</div>

Lingling is a technology I am building to facilitate compiler + spec creation. It describes its own 【DSL】 called “MLgate”.

# Algebraic Typing

Users trivially type fixtures w.o. _hints_ in response to phase re-evaluation (based on dirty triggers and `Defer` exceptions).

 ![image](https://d.strumenta.community/uploads/default/original/2X/d/df660e6aec783e5c681ae9e86fc84224a208feec.png)

MLgate presents convenient wrappers over the `verify` specification.

uh, better meant “footprint” instead of “variable” as to `augmentLookup` :s

 ![image](https://d.strumenta.community/uploads/default/original/2X/6/641a632610fba0003b6359473d282dfa94e84819.png)

Language components do have to set up some configuration for linking adequate messages and specific-behavior; for instance,

**lingling.fig**

```yml
# $schema=http://www.ryujinx.com/lingling/1.0
ID: org.atelier.luml:1.0.0

ml:
  module: org.atelier.luml

language:
  enable: true
  ID: luml
  name: Luml
  uri: https://www.atelier.org/luml/1.0/lang
  extensions: ["ml", "luml"]

  cast-invoke:
    enable = true
    optional = false

  internal-aliases:
    msg: org.atelier.luml.msg

  message-reports:
    # msg::WrongNumberOfArguments { expected : int, got : int }
    wrong-number-of-arguments: msg::WrongNumberOfArguments

    # msg::NotInvokable { type : Type }
    not-invokable: msg::NotInvokable

```

# Tree traversal

MLgate implicitly enters frames.

```plaintext
(* n : Tree *)

(* master sample *)
fun f () = List.app (fn n' => ...) (n->children())

val _ = List.filter (fn n' => yesno) (n->children())
val _ = List.exists (fn n' => yesno) (n->children())
val _ = List.all (fn n' => yesno) (n->children())

val _ = with n' do ... end

```

# Pay-As-You-Go-style

Incremental parsing, analysis and evaluation ---- all that relies on the fact that anything in MLgate can be queried for a copy, hash code, `ord` and read-from/written-to file system (in form of binary cache).

In terms of cache, Lingling is being formulated to specify build tooling (like Cargo, Deno, CMake, Maven, PIP, Golang…) easily, where we’d be more like Golang, hiding build artifacts into smth like `/var/share/<Set-ID>/shadows/home/inexistent/Documents/katanacraft` plus subshadows for a specific shadow.

# Parsing

Wanna see a bit of how parsing rulesets are formulated?

Some snippets.

```plaintext
ruleset Form = b:[between ( (), mode=MODE, reinterpret as Form' )] ;

ruleset || Form' =
  | exp ( Exp )
  | stat ( Stat )
  ;

```

Another one.

```plaintext
ruleset ArrayInitialiser =
	"[" elements:Expression(minPrecedence=Assignment)*{split=","}{trail}{elision=Elision} "]" (":" type:TypeExpression)?
	;

ruleset Elision = "," ;

```

`ruleset` definitions are used instead of ANTLR-style ones since they can specify class blocks and MLgate doesn’t limit itself to only few kinds of syntactic variations. Either way, I’m not planning to transpile MLgate to another language, but rather compile it down to some bytecode.

Well, the reference I built so far is extensive and there’s a lot I can show, but I’m leaving it closed-source for the meanwhile. I’m implementing the bootstrap tooling for this technology using Deno.

---

<div class="post-metadata">

**Author:** ![ndifonadebenjohnson](https://d.strumenta.community/letter_avatar_proxy/v4/letter/n/22d042/32.png) [@ndifonadebenjohnson](https://d.strumenta.community/u/ndifonadebenjohnson)\
**Post date:** [December 1, 2026, 8:01pm UTC](https://d.strumenta.community/t/a-few-peeks-of-lingling-mlgate-30-11/1938/2 "2026-12-01T20:01:45Z")

</div>

* * *

Hi @mryun, thanks for sharing these peeks. Lingling/MLgate looks like an ambitious project.

A few things stood out to me:

- **Algebraic typing with phase re-evaluation:** Typing fixtures without hints, driven by dirty triggers and `Defer` exceptions, is an interesting approach. How do you guarantee termination, or detect cycles, when a deferred type depends on something that is itself re-evaluated?
- **Pay-as-you-go caching:** Requiring every value to support copy, hash, `ord` and binary serialization is a clean uniform contract. How do you handle cache invalidation when a language component’s configuration changes, for example in `lingling.fig`?
- **`ruleset` vs. ANTLR-style grammars:** I like that rulesets can carry class blocks. How do you handle operator precedence and error recovery? I notice `minPrecedence=Assignment` in the array initialiser, so I assume precedence is a first-class parameter.
- **Compiling to bytecode:** Is the bytecode format meant to be stable and shared across languages defined in Lingling, or specific to each one?

One small note: in the `cast-invoke` block of the YAML snippet, `enable = true` and `optional = false` use `=` rather than `:`. If that’s not intentional, it would be invalid YAML.

I understand keeping the reference closed-source for now, but I’d love to see more as it matures, especially the Deno-based bootstrap tooling.
