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, Brotli-11 of the selected JavaScript, npm + Vite 8 unless noted. Open a card for the live pair, the project page, or the compare notes.

Editor · VS Code

Monaco

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

npm Brotli887,420
LilScript413,607
ide.js−53%
Selected surface

Motion

mix, wrap, stagger, spring — same equations as npm motion@13. Not the full DOM package.

npm Vite4,044
LilScript2,333
Brotli−42%
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.

Solid 2.011,180
SolidLil3,862
Brotli−65%
Exact entrypoint

gl-matrix

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

npm Vite14,330
LilScript14,116
Brotli−1.5%
Complete package

murmurhash-js

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

npm Vite902
LilScript409
Brotli−55%
Complete package

js-levenshtein

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

npm Vite825
LilScript404
Brotli−51%
Complete package

clamp + lerp

Both published roots. Types let the wrappers disappear.

npm Vite519
LilScript112
Brotli−78%
Complete package

@emotion/hash

Published root. Eligible against Vite and Closure ADVANCED.

npm Vite330
LilScript231
Brotli−30%
Complete package

robust-predicates

Geometric predicates. Large typed corpus, modest transfer cut.

npm Vite6,456
LilScript5,972
Brotli−7.5%
Exact entrypoint

Nano ID

Published browser entrypoint. Effectively even on Brotli.

npm Vite409
LilScript408
Brotli−0.2%
Exact package

MobX 7

Public API, 769 official tests. 17,159 B → 16,736 B Brotli versus Vite 8 Oxc of npm.

Vite 8 Oxc17,159
LilScript16,736
Brotli−2.5%
Application

Lastro

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

Astro2,672
Lastro2,665
Brotli−0.3%
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.

npm min27,445
LilScript30,973
Brotli+13%
Parse API

marked 18

GFM + CommonMark parse API. 660/660 HTML match, smaller than the parse-only official sources minified by Oxc, and 13% faster in Chromium. This port has no extension system.

Oxc mangle10,092
LilScript9,580
Brotli−5.1%

How to read this. Brotli-11 of the selected JavaScript, same lilscript-codec scorers. Kernels move more than public libraries. mitt and clsx are currently a few bytes larger. Subset ports (Preact, Zod, Acorn, Redux Toolkit) live on the compare page and are labeled as such.

04 · 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.

05 · 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.

06 · Models, and the 5–10%

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 ports we maintain, that cut is typically about 5% to 10%. The cards above are the measured exceptions and the near-ties — not a promise that every file will move that far.

Star the repo