Language · compiler · Lilpack

Write LilScript. Ship less JavaScript.

LilScript is a typed, compression-first language. The compiler mangles, reshapes, and scores a complete JavaScript artifact against the codec you pick — gzip, Brotli, or raw size. Lilpack is the Vite-based delivery path: fast reloads, a language server, the usual editor tools.

LilScripttypes stay until codegen
class Vector {
  float x;
  float y;

  init(float x, float y) {
    this.x = x;
    this.y = y;
  }

  float lengthSquared() {
    return this.x * this.x + this.y * this.y;
  }
}

int[] values = [1, 2, 3, 4];
auto doubled = values.map((int value) => value * 2);
int sum = 0;
for (int i = 0; i < doubled.length; i++) {
  sum += doubled[i];
}
Vector vector = new Vector(3.0, 4.0);
if (vector.lengthSquared() == 25.0) {
  print(`sum=${sum}`);
}
Emitted JavaScript111 B in the full sample
var b=[1,2,3,4].map(a=>a*2|0);
var a=0,c=0;
while(a<b.length){
  c=c+b[a]|0;
  a=a+1|0;
}
console.log(`sum=${c}`)

01 · How it gets smaller

The compiler is allowed to change the shape of the program.

Minifiers rename locals after the objects already exist. LilScript proves what can disappear before JavaScript is spelled — then measures the finished file under the codec you chose.

Mangling

Properties, including methods

Owned fields and class methods can be renamed. Host names stay exact. That includes the names that would otherwise sit on a JavaScript prototype — when the type system owns them, they are safe to mangle.

Layout

Objects become arrays, or vanish

struct and class are not glue. Non-escaping values scalar-replace into var / let. Values that stay become compact arrays. That helps transfer size, memory, and access cost.

Objective

Gzip, Brotli, or raw

javascript.cost_model is the score the search actually uses. A shorter raw spelling can lose under Brotli. Performance is a separate knob: size-first is the default; performance-first keeps hotter shapes.

02 · Monaco · the VS Code editor

The editor that ships in VS Code, rewritten and compiled.

Two production pages. One is npm monaco-editor@0.56. The other is the LilScript editor compiled from entry.lil plus the monaco-editor-core catalog — not monaco with a few files swapped. Microsoft’s TypeScript language service is still on both sides.

npm ide.js · Brotli 887,420 B
LilScript ide.js · Brotli 413,607 B
JS editor + workers, no tsc 1,416,410 B
Lil editor + workers, no tsc 415,045 B

03 · Libraries we actually port

A grid of measured rewrites, not a slogan.

Each card is a scoped contract: same behavior and the selected JavaScript measured independently with gzip-9 and Brotli-11, npm + Vite 8 unless noted. The arrow is baseline → LilScript. Open a card for the live pair, project page, or compare notes.

Editor · VS Code

Monaco

Compiled Lil editor + catalog versus npm monaco-editor. TypeScript ts.worker is still Microsoft’s.

gzip-9−54.2%1,148,595 → 526,268 B
Brotli-11−53.4%887,420 → 413,607 B
Full DOM runtime · 16 paired demos

Motion

Every runtime export from Motion 13’s DOM entrypoint. All 16 behavior-matched browser demos ship smaller under Brotli.

gzip-9 total−10.2%314,064 → 282,059 B
Brotli-11 total−12.4%287,404 → 251,703 B
Framework · Solid 2.0

SolidLil

Official js-framework-benchmark keyed table. Solid 2.0 versus the LilScript compile. Live pairs are on the SolidLil lab.

gzip-9−64.7%12,318 → 4,343 B
Brotli-11−65.5%11,180 → 3,862 B
Exact entrypoint

gl-matrix

Complete ESM root namespace, aliases, and live array type.

gzip-9−3.0%17,646 → 17,110 B
Brotli-11−1.5%14,330 → 14,116 B
Complete package

murmurhash-js

MurmurHash 2 and 3, reusable root API, same checksums.

gzip-9−56.7%1,029 → 446 B
Brotli-11−54.7%902 → 409 B
Complete package

js-levenshtein

Full root entrypoint. Eligible on size and the 1.05× runtime gate.

gzip-9−52.1%914 → 438 B
Brotli-11−51.0%825 → 404 B
Complete package

clamp + lerp

Both published roots. Types let the wrappers disappear.

gzip-9−75.4%577 → 142 B
Brotli-11−78.4%519 → 112 B
Complete package

@emotion/hash

Published root. Eligible against Vite and Closure ADVANCED.

gzip-9−23.9%348 → 265 B
Brotli-11−30.0%330 → 231 B
Complete package

robust-predicates

Geometric predicates. Large typed corpus, modest transfer cut.

gzip-9−7.7%8,329 → 7,691 B
Brotli-11−7.5%6,456 → 5,972 B
Exact entrypoint

Nano ID

Published browser entrypoint. Effectively even on Brotli.

gzip-9+0.7%456 → 459 B
Brotli-11−0.2%409 → 408 B
Exact package

MobX 7

Public API, 769 official tests. Compared with Vite 8 Oxc of the official ESM; the smaller DEV-stripped official build is a separate lane.

gzip-9−0.9%19,282 → 19,104 B
Brotli-11+0.4%17,159 → 17,223 B
Application

Lastro

Parcel Market next to the Astro control. Same CSS and behavior.

gzip-90.0%3,132 → 3,132 B
Brotli-11−0.3%2,672 → 2,665 B
Published · not smaller

jQuery 3.7.1

Drop-in public API. Official jquery.min.js is still the Brotli lane to beat. Public names stay a config choice.

gzip-9+13.4%30,336 → 34,392 B
Brotli-11+12.0%27,445 → 30,741 B
18.0.13 package · 18.0.10 parse API

marked 18

GFM + CommonMark parse API with live option methods. 660/660 HTML match, smaller than the same parse-only sources through Oxc, and 13% faster in Chromium. No extension system.

gzip-9−2.0%10,930 → 10,714 B
Brotli-11−5.7%10,092 → 9,515 B
Classic-compatible API · audit open

Zod 4

The port passes 1,353 adapted official tests, but the old size row counted only zod.core.js. The linked package is 62,763 B gzip / 52,583 B Brotli and exposes 192 ESM names versus the official entry's 240, so the size claim is withdrawn until those surfaces match.

Official exports240
Port exports192
Size claimWithdrawn
Kernel + 5 independent packs

posthog-js

UUID, flags, cookies, routing, rate limits, queue, bot detection, and portable helpers from posthog-js@1.418.10, plus five tabbed pack lanes: autocapture utilities, replay core, surveys, error tracking, and OTLP. Autocapture is 24.4% smaller and replay core is 18.6% smaller on Brotli versus Oxc. The kernel is larger than Oxc on this compiler; this is not the published IIFE.

gzip-9+9.9%6,194 → 6,807 B
Brotli-11+6.5%5,622 → 5,985 B

How to read this. Each percentage is recalculated as (candidate / baseline − 1) × 100 from the byte pair beside it. gzip-9 and Brotli-11 are independent codec measurements; they can disagree, as Nano ID and posthog-js do. The 7.7% / 7.5% headline is the median of the 15 currently comparable project rows, not a byte-weighted blend. Zod stays visible but has no vote while its package-surface mismatch is open. Subset ports (Preact, the in-repo Zod 3 surface, Acorn, Redux Toolkit) live on the compare page and are labeled as such. The published Zod 4 port is zodlil.

04 · Latest · updated 24 August 2026

What changed across LilScript and its ports.

A dated changelog for the work that used to disappear into the comparison grid. Each item links to the repository or lab carrying the evidence.

Global compression search

JavaScript spelling search now optimizes names, literals, declarations, and layout as one codec-scored artifact.

Read the compiler change

posthog-js adds two browser packs

Autocapture utilities and session-replay core join surveys, error tracking, and OTLP in a tabbed, behavior-checked benchmark lab; the new Brotli cuts are 27.3% and 19.4% versus Oxc.

Open posthoglil

Zod size claim withdrawn after surface audit

The port still passes 1,353 adapted official tests. Its old size row omitted the compatibility facade, though, and 192 exported names do not equal the official entry's 240. It is no longer in the aggregate until the package boundary is exact.

Open zodlil

marked 18.0.13 refresh

Live option methods and matched raw, gzip, and Brotli compiles are now published for the 18.0.10-compatible parse surface.

Open markedlil

05 · Published ports

The github.io labs, one per library.

Each port has its own site: install the package, open the paired demos, read the receipts. The in-repo stage is still here for the rest of the corpus.

06 · Tooling

The language has to feel like a web toolchain.

Closure’s Advanced mode is the closest ancestor. The Java stack around it is slow and awkward for everyday web work. LilScript is being built so reload, analysis, and editor support sit on par with the rest of the ecosystem.

Lilpack

Vite-speed reloads

lilpack dev turns candidate search off and keeps HMR honest. Production uses the project lilscript.toml.

Editor

VS Code + LSP

lilscript-lsp and the repo extension: highlight, diagnostics, completion, hover, rename, format.

Config

A lot of knobs

Codec, priority, mangling, inlining, layouts, chunks. The language page walks the ones that change behavior.

07 · Models, and the measured median

Current models write LilScript without much invention.

That was not the plan; it is just what we keep seeing. A library rewrite is often close to one-shot, and the compiled file is usually smaller once gzip or Brotli is applied. Across the 15 currently comparable rows, the median project result is 7.7% smaller under gzip-9 and 7.5% smaller under Brotli-11. Zod remains visible but is excluded until its package surface matches. This is a snapshot with one vote per project, including losses and near-ties — not a promise that every file will move that far.

Star the repo