Any web app could get 5-25% smaller
Let’s start by accepting a fact: the web was designed as an afterthought, optimized for ease of use.
Not only that, but our standards as web developers have also been focused on “saving the day”: faster development, ease of use, and so on.
With the advancement of LLMs, that tradeoff changes completely. You no longer have to settle for mediocre standards (as long as your business benefits from it, I guess).
In 2026, LilScript solves some of web development’s mediocrity.
It makes bundles smaller. It makes web development type safe, and not as an afterthought.
99.999% of the web apps and JS libraries in production ship JS that is readable and not fully mangled.
Visit any web app you like, and you will spot plenty of readable variable names, property names, and so on.
That is completely okay. But they could get 5-25% smaller on average if they were rewritten in LilScript. Same algorithms, same behaviour, same developer API.
Below are some examples. More on lilscript.eddocu.com.
On the left is the original: Rolldown + Oxc (Vite 8), Terser, esbuild. On the right is the minified LilScript version.
exit:{atxHeading:a(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}},autolink:a(),autolinkEmail:function(e){p.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){p.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:a(),characterEscapeValue:p,characterReferenceMarkerHexadecimal:d,characterReferenceMarkerNumeric:d,characterReferenceValue:function(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=Ve(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=Me(t),this.stack[this.stack.length-1].value+=r},characterReference:function(e){this.stack.pop().position.end=En(e.end)},codeFenced:a(function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:p,codeIndented:a(function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:a(function(){const e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:p,data:p,definition:a(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=He(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:a(),hardBreakEscape:a(f),hardBreakTrailing:a(f),htmlFlow:a(function(){const e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:p,htmlText:a(function(){const e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:p,image:a(function(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t},labelText:function(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(xn,kn)}(t),n.identifier=He(t).toLowerCase()},function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=xt(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function h(){this.data.expectingFirstListItemValue=!0}function f(d){if(this.data.expectingFirstListItemValue){const k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(d),10),this.data.expectingFirstListItemValue=void 0}}function c(){const d=this.resume(),k=this.stack[this.stack.length-1];k.lang=d}function b(){const d=this.resume(),k=this.stack[this.stack.length-1];k.meta=d}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function I(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const d=this.resume(),k=this.stack[this.stack.length-1];k.value=d.replace(/(\r?\n|\r)$/g,"")}function D(d){const k=this.resume(),T=this.stack[this.stack.length-1];T.label=k,T.identifier=ve(this.sliceSerialize(d)).toLowerCase()}function w(){const d=this.resume(),k=this.stack[this.stack.length-1];k.title=d}function N(){const d=this.resume(),k=this.stack[this.stack.length-1];k.url=d}function R(d){const k=this.stack[this.stack.length-1];if(!k.depth){const T=this.sliceSerialize(d).length;k.depth=T}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function U(d){const k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(d).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}exit:{atxHeading:q(void 0),atxHeadingSequence:function(a){let b=g[g.length-1];if(!b.depth)b.depth=$e(this,a).length},autolink:q(void 0),autolinkEmail:J("mailto:"),autolinkProtocol:J(""),blockQuote:q(void 0),characterEscapeValue:A,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:function(a){let b=$e(this,a),e=Y.characterReferenceType,c;if(e){c=Re(b,e==Xa?10:16);Y.characterReferenceType=void 0}else c=nd(b);let d=g[g.length-1];d.value=d.value+c},characterReference:a=>{g.pop().position.end=Ze(a.end)},codeFenced:q(()=>{let a=m();g[g.length-1].value=a.replace(af,"");Y.flowCodeInside=void 0}),codeFencedFence:()=>{if(!Y.flowCodeInside){g.push({type:"fragment",children:[]});Y.flowCodeInside=!0}},codeFencedFenceInfo:r("lang"),codeFencedFenceMeta:r("meta"),codeFlowValue:A,codeIndented:q(()=>{let a=m();g[g.length-1].value=a.replace(bf,"")}),codeText:q(r("value")),codeTextData:A,data:A,definition:q(void 0),definitionDestinationString:r("url"),definitionLabelString:w,definitionTitleString:r("title"),emphasis:q(void 0),hardBreakEscape:q(B),hardBreakTrailing:q(B),htmlFlow:q(r("value")),htmlFlowData:A,htmlText:q(r("value")),htmlTextData:A,image:q(C),label:()=>{let a=g[g.length-1],b=m(),c=g[g.length-1];Y.inReference=!0;if(c.type=="link")c.children=a.children;else c.alt=b},labelText:function(a){let b=$e(this,a),c=g[g.length-2];c.label=Se(b);c.identifier=Id(b).toLowerCase()},Byte counts are the whole file, gzip -9. The code is an excerpt cut at matching boundaries from the gzip-targeted LilScript build. Terser and LilScript keep these handlers inline in the exit table; Oxc and esbuild hoist them into named functions, so those tabs show a run of the hoisted handlers. Full artifacts and build receipts.
blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
`+r+`</`+i+`>
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}
…
parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+s+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let s=e.rows[t];n="";for(let e=0;e<s.length;e++)n+=this.tablecell(s[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}
…
parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==n||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(e.type)){t+=n||"";continue}}let s=r;switch(s.type){case"space":t+=this.renderer.space(s);break;case"hr":t+=this.renderer.hr(s);break;case"heading":t+=this.renderer.heading(s);break;case"code":t+=this.renderer.code(s);break;case"table":t+=this.renderer.table(s);break;case"blockquote":t+=this.renderer.blockquote(s);break;case"list":t+=this.renderer.list(s);break;case"checkbox":t+=this.renderer.checkbox(s);break;case"html":t+=this.renderer.html(s);break;case"def":t+=this.renderer.def(s);break;case"paragraph":t+=this.renderer.paragraph(s);break;case"text":t+=this.renderer.text(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}blockquote({tokens:r}){return`<blockquote>
${this.parser.parse(r)}</blockquote>
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
`}hr(r){return`<hr>
`}list(r){let e=r.ordered,t=r.start,s="";for(let a=0;a<r.items.length;a++){let l=r.items[a];s+=this.listitem(l)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
`+s+"</"+n+`>
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+s+`</table>
`}tablerow({text:r}){return`<tr>
${r}</tr>
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
`}
…
parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){t+=l||"";continue}}let i=n;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}Kc=a=>{let b=Hc(a.r,!1),c="td";if(a.o)c="th";let f=a.j,d=f==1?"left":f==2?"center":f==3?"right":"",e="<"+c+">";if(d.length>0)e="<"+c+" align=\""+d+"\">";return e+b+"</"+c+">\n"},Lc=a=>{let b=a.t??[],c=a.u??[],d="",e=0;while(e<b.length){d=d+Kc(b[e]);++e}let f="<tr>\n"+d+"</tr>\n",g="",h=0;while(h<c.length){let b=c[h];d="";let a=0;while(a<b.length){d=d+Kc(b[a]);++a}g=g+"<tr>\n"+d+"</tr>\n";++h}if(g.length>0)g="<tbody>"+g+"</tbody>";return"<table>\n<thead>\n"+f+"</thead>\n"+g+"</table>\n"},Mc=a=>{if(!a)return"";let b="",c=0;while(c<a.length){let d=a[c];if(d.a==0){}else if(d.a==1)b=b+"<hr>\n";else if(d.a==2)b=b+Ec(d.h.toString(),Hc(d.r,!1));else if(d.a==3)b=b+Jc(d);else if(d.a==4)b=b+Lc(d);else if(d.a==6)b=b+"<blockquote>\n"+Mc(d.r)+"</blockquote>\n";else if(d.a==7){let a=d.s??[],c="",e=0;while(e<a.length){c=c+Ic(a[e]);++e}let f="ul";if(d.k)f="ol";let g="";if(d.k&&d.i!=1)g=" start=\""+d.i.toString()+"\"";b=b+"<"+f+g+">\n"+c+"</"+f+">\n"}else if(d.a==9)b=b+(d.n?"<input checked=\"\" disabled=\"\" type=\"checkbox\"> ":"<input disabled=\"\" type=\"checkbox\"> ");else if(d.a==10)b=b+d.c;else if(d.a==11){}else if(d.a==12)b=b+("<p>"+Hc(d.r,!1)+"</p>\n");else if(d.a==13)b=b+Fc(d,!1);++c}return b}Byte counts are the whole file, gzip -9. The code is an excerpt cut at matching boundaries from the gzip-targeted LilScript build. Full artifacts and build receipts.
switch(this.state){case z.DATA:this._stateData(e);break;case z.RCDATA:this._stateRcdata(e);break;case z.RAWTEXT:this._stateRawtext(e);break;case z.SCRIPT_DATA:this._stateScriptData(e);break;
…
_stateData(e){switch(e){case T.LESS_THAN_SIGN:this.state=z.TAG_OPEN;break;case T.AMPERSAND:this._startCharacterReference();break;case T.NULL:this._err(D.unexpectedNullCharacter),this._emitCodePoint(e);break;case T.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case T.AMPERSAND:this._startCharacterReference();break;case T.LESS_THAN_SIGN:this.state=z.RCDATA_LESS_THAN_SIGN;break;case T.NULL:this._err(D.unexpectedNullCharacter),this._emitChars(w);break;case T.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case T.LESS_THAN_SIGN:this.state=z.RAWTEXT_LESS_THAN_SIGN;break;case T.NULL:this._err(D.unexpectedNullCharacter),this._emitChars(w);break;case T.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case T.LESS_THAN_SIGN:this.state=z.SCRIPT_DATA_LESS_THAN_SIGN;break;case T.NULL:this._err(D.unexpectedNullCharacter),this._emitChars(w);break;case T.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}switch(this.state){case ze.DATA:this._stateData(e);break;case ze.RCDATA:this._stateRcdata(e);break;case ze.RAWTEXT:this._stateRawtext(e);break;case ze.SCRIPT_DATA:this._stateScriptData(e);break;
…
_stateData(e){switch(e){case ce.LESS_THAN_SIGN:this.state=ze.TAG_OPEN;break;case ce.AMPERSAND:this._startCharacterReference();break;case ce.NULL:this._err(ue.unexpectedNullCharacter),this._emitCodePoint(e);break;case ce.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case ce.AMPERSAND:this._startCharacterReference();break;case ce.LESS_THAN_SIGN:this.state=ze.RCDATA_LESS_THAN_SIGN;break;case ce.NULL:this._err(ue.unexpectedNullCharacter),this._emitChars(Ee);break;case ce.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case ce.LESS_THAN_SIGN:this.state=ze.RAWTEXT_LESS_THAN_SIGN;break;case ce.NULL:this._err(ue.unexpectedNullCharacter),this._emitChars(Ee);break;case ce.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case ce.LESS_THAN_SIGN:this.state=ze.SCRIPT_DATA_LESS_THAN_SIGN;break;case ce.NULL:this._err(ue.unexpectedNullCharacter),this._emitChars(Ee);break;case ce.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}switch(this.state){case i.DATA:{this._stateData(e);break}case i.RCDATA:{this._stateRcdata(e);break}case i.RAWTEXT:{this._stateRawtext(e);break}case i.SCRIPT_DATA:{this._stateScriptData(e);break}
…
_stateData(e){switch(e){case a.LESS_THAN_SIGN:{this.state=i.TAG_OPEN;break}case a.AMPERSAND:{this._startCharacterReference();break}case a.NULL:{this._err(h.unexpectedNullCharacter),this._emitCodePoint(e);break}case a.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case a.AMPERSAND:{this._startCharacterReference();break}case a.LESS_THAN_SIGN:{this.state=i.RCDATA_LESS_THAN_SIGN;break}case a.NULL:{this._err(h.unexpectedNullCharacter),this._emitChars(I);break}case a.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case a.LESS_THAN_SIGN:{this.state=i.RAWTEXT_LESS_THAN_SIGN;break}case a.NULL:{this._err(h.unexpectedNullCharacter),this._emitChars(I);break}case a.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case a.LESS_THAN_SIGN:{this.state=i.SCRIPT_DATA_LESS_THAN_SIGN;break}case a.NULL:{this._err(h.unexpectedNullCharacter),this._emitChars(I);break}case a.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}Hd=(a,b)=>{let c=a.state;if(c==0)Id(a,b);else if(c==1)Jd(a,b);else if(c==2)Kd(a,b);else if(c==3)Ld(a,b);
…
Id=(a,b)=>{if(b==60)a.state=5;else if(b==38)Ed(a);else if(b==0){dd(a,7,0);Cd(a,b)}else if(b==-1)Ad(a);else Cd(a,b)},Jd=(a,b)=>{if(b==38)Ed(a);else if(b==60)a.state=8;else if(b==0){dd(a,7,0);Dd(a,_b)}else if(b==-1)Ad(a);else Cd(a,b)},Kd=(a,b)=>{if(b==60)a.state=11;else if(b==0){dd(a,7,0);Dd(a,_b)}else if(b==-1)Ad(a);else Cd(a,b)},Ld=(a,b)=>{if(b==60)a.state=14;else if(b==0){dd(a,7,0);Dd(a,_b)}else if(b==-1)Ad(a);else Cd(a,b)}Byte counts are the whole file, gzip -9. The code is an excerpt cut at matching boundaries from the gzip-targeted LilScript build. Full artifacts and build receipts.
LilScript doesn’t just shorten variable names. It also flattens objects, classes and so on, wherever it makes sense to do so.
It may seem trivial, but none of the JS toolchains people use today mangle code completely in a safe way.
Also, remember: in C, a struct (or a C++ class) is just a block of memory. Almost no overhead.
Meanwhile, in JS we use objects and classes everywhere, and they add overhead to both performance and bundle size.
LilScript mitigates that with a typed language that compiles to JS that is as flat as possible, as long as it can be statically analyzed and doesn’t break the code.
The result is better compression and somewhat better performance (that part matters little).
But here’s the catch: types aren’t an afterthought, like they are in TypeScript.
const imAnAfterthought = 5: int;
vs.
int32 int int64 imyYes = 5;
LilScript also compiles to native executables.
The language isn’t perfect (but again, it’s at least better than the alternatives). Let’s channel our tokens and thought into making LilScript better.
It already makes most popular npm libraries 5-25% smaller (yes, both before and after gzip/Brotli). And LLMs really can rewrite your libraries in one shot.
| Library | raw | gzip | brotli |
|---|---|---|---|
| marked@18.0.10 | −25.4%31,834 / 42,650 | −21.5%9,834 / 12,530 | −23.0%8,851 / 11,488 |
| hast-util-to-html@9.0.5 | −9.9%28,483 / 31,627 | −17.3%9,274 / 11,217 | −16.3%8,235 / 9,833 |
| rehype-stringify@10.0.1 | −9.4%28,743 / 31,728 | −16.5%9,396 / 11,255 | −14.6%8,433 / 9,875 |
| rehype@13.0.2 | −26.9%159,668 / 218,304 | −15.1%57,442 / 67,636 | −11.9%48,371 / 54,909 |
| react-markdown@10.1.0 | −24.6%109,743 / 145,510 | −10.0%41,766 / 46,410 | −12.0%35,781 / 40,662 |
| mdast-util-to-hast@13.2.1 | −19.5%13,458 / 16,709 | −9.5%4,875 / 5,385 | −8.9%4,426 / 4,857 |
| remark-rehype@11.1.2 | −19.8%13,518 / 16,855 | −9.1%4,950 / 5,443 | −9.6%4,438 / 4,908 |
| zod@4.4.3 | −34.0%87,282 / 132,160 | −8.7%32,437 / 35,532 | −3.8%28,807 / 29,956 |
| remark-gfm@4.0.1 | −25.5%31,262 / 41,973 | −8.4%11,334 / 12,380 | −9.3%10,134 / 11,178 |
| remark-breaks@4.0.0 | −14.1%2,566 / 2,988 | −7.6%1,186 / 1,284 | −9.0%1,067 / 1,173 |
| motion@13.1.0 | −15.3%114,644 / 135,340 | −7.4%41,699 / 45,028 | −9.2%36,483 / 40,188 |
| unified@11.0.5 | −12.7%11,696 / 13,394 | −6.5%4,490 / 4,801 | −6.0%4,085 / 4,348 |
| mdast-util-from-markdown@2.0.3 | −19.1%68,067 / 84,154 | −3.2%25,987 / 26,849 | −4.7%22,066 / 23,151 |
| katex@0.16.22 | −5.5%248,998 / 263,473 | −2.9%73,936 / 76,117 | −2.3%61,503 / 62,959 |
| remark-parse@11.0.0 | −23.4%64,590 / 84,339 | −2.7%26,179 / 26,914 | −4.4%22,158 / 23,171 |
| micromark@4.0.2 | −21.4%63,806 / 81,191 | −2.2%25,706 / 26,278 | −3.7%21,866 / 22,696 |
| remark-math@6.0.0 | −0.7%6,072 / 6,112 | +8.0%2,446 / 2,265 | +7.9%2,203 / 2,041 |
| remark@15.0.1 | +4.4%124,185 / 118,946 | +16.6%43,205 / 37,039 | +13.6%36,698 / 32,318 |
| rehype-katex@7.0.1 | +20.6%1,503 / 1,246 | +21.0%847 / 700 | +18.9%729 / 613 |
Size of the LilScript build vs the smallest of Terser 5.51.2, esbuild 0.28.1, Oxc via Vite 8.2.1 for the same metric (gzip level 9, Brotli quality 11 / window 22). Each column is a separate LilScript compile targeting that metric. Bytes shown as LilScript / best original. Scope per library (shared public API, excluded exports, parity checks) is on each linked page.