.lmg — Grids | LMX

LMX // .LMG

.lmgGrids

Author and run a programming grid as text — cells, $refs, dependency order.

  • Runs here
  • a .lmg file
  • free to run
WHAT IT IS

Why .lmg exists.

A text syntax for a Leumas grid. A grid is layers of cells and a cell is an ACTION — code, variable, conditional, template, json, csv, regex, datetime and the rest of the pack. Cells reference each other with $A1 or $Layer.A1; the engine resolves refs concurrently, memoises, and refuses a cycle. RUN executes named cells, DUMP prints everything computed, GRAPH prints the dependency order. Code cells run in a vm sandbox with no process, require or fetch. Network cell types (endpoint, url) need LMX_ENABLE_NET=1, exactly like lmnet.

Runs here

This one runs in the browser sandbox with no account, and offline in the CLI.


A WORKED EXAMPLE

Pricing grid — variables, a code cell, a conditional and a template

The same script the engine test suite runs, so it cannot quietly stop working.

# Pricing grid — variables, a code cell, a conditional and a template
GRID "pricing"

LAYER default
  A1 variable 1200
  A2 variable 0.08
  B1 code $A1 * (1 + $A2)
  C1 conditional $B1 > 1000 ? "high" : "low"
  D1 template "tier {{ $C1 }} at {{ $B1 }}"

RUN B1, C1, D1
GRAPH
Run it

1 more example

Two-layer pricing model — cross-layer refs and a multi-line code cell
# Two-layer pricing model — cross-layer refs and a multi-line code cell
GRID "pricing model"

LAYER rates
  A1 variable 0.08
  A2 variable 0.2

LAYER default
  A1 variable 1200
  B1 code $A1 * (1 + $rates.A1)
  B2 code do
    const monthly = $A1;
    const annual = monthly * 12;
    return annual - (annual * $rates.A2);
  end
  C1 conditional $B2 > 10000 ? "enterprise" : "standard"
  D1 template "{{ $C1 }}: {{ $B2 | fixed:2 }} per year"

RUN B1, B2, C1, D1
DUMP
GRAPH

SYNTAX

The shape of it.

Straight from the interpreter catalogue — the same summary the editor shows as a placeholder.

GRID "pricing"

LAYER default
  A1 variable 1200
  A2 variable 0.08
  B1 code $A1 * (1 + $A2)
  C1 conditional $B1 > 1000 ? "high" : "low"

RUN B1, C1
GRAPH

NEXT

Where to take it.