4 ms·
Show HN: 0x – A language that compiles to React, Vue, and Svelte (80% less code)
I kept running into the same problem with AI-generated frontend code: most tokens go to boilerplate, and the AI can never pick a consistent pattern. So I built a language where there's only one way to write things.
0x is indentation-based (think Python), declarative, and compiles to React JSX, Vue 3 SFC, or Svelte 5. A counter component is 18 lines in 0x vs 96 in production React.
page Counter:
state count: int = 0
fn increment():
count += 1
layout col gap=16 padding=24 center:
text "{count}" size=4xl color=cyan
button "+1" style=primary -> increment()
The compiler is ~3K lines of TypeScript, zero dependencies. Pipeline: Lexer → Parser → AST → CodeGen (one pass per target). It handles state, derived values, typed variables, functions, flexbox layouts, control flow (if/elif/else, each, match), lifecycle hooks, API calls with loading/error states.
I chose indentation-based syntax because it's the most token-efficient structure I could find. No curly braces, no semicolons, no JSX closing tags, no import boilerplate. For an LLM, fewer structural decisions = fewer hallucinations.
There's a built-in MCP server so Claude and Cursor can compile inline. Also works as a library:
import { compile } from '0x-lang/compiler';
const result = compile(source, { target: 'react' });
I'm curious about two things:
Is "designed for AI" a real market, or is this too niche?
For folks who've built compilers — any obvious mistakes you see in the architecture?
Website: https://0xlang.com https://0xlang.com
GitHub: https://github.com/hankimis/0x-lang https://github.com/hankimis/0x-lang
npm: https://www.npmjs.com/package/0x-lang https://www.npmjs.com/package/0x-lang