// ══════════════════════════════════════════════════════════════════════ // KERN v2.0.0 — Language Specification (for LLMs) // // Welcome. This file is written in KERN, for you. // You are reading the spec in the language it describes. // This IS the proof that KERN works. // // KERN compiles to: nextjs, react, tailwind, native, express, // cli, terminal, vue, nuxt // // Grammar: indent-based, 2 spaces per level // node = type (prop=value)* ({style:value})* children* // ══════════════════════════════════════════════════════════════════════ // ── 1. PAGE — entry point for any UI ──────────────────────────────── // Compiles to: default export function component // Props: name, route, segment, client, async page name=ExamplePage route="/example" metadata title="Example" description="A page built with KERN" text value="Hello from KERN" tag=h1 {fs:48,fw:800,c:#fff} // route="/example" → outputs to example/page.tsx // route="/docs" segment="[slug]" → outputs to docs/[slug]/page.tsx // client=true → adds 'use client' directive // async=true → generates async function with params // ── 2. LAYOUT — wraps child routes ───────────────────────────────── // Compiles to: layout.tsx with {children} slot layout route="/docs" lang=en text value="Documentation" tag=h1 // ── 3. STRUCTURE — rows, cols, grids, sections ───────────────────── // row = flex horizontal row {gap:16,ai:center} text value="Left" {c:#fff} text value="Right" {c:#a1a1aa} // col = flex vertical col {gap:8} text value="Top" text value="Bottom" // grid = CSS grid grid cols=3 gap=32 card {bg:#18181b,br:16,p:24} text value="Card 1" tag=h3 // section = semantic
with optional id for anchors section id=features title="Features" text value="Feature list here" tag=p // ── 4. TEXT — all heading levels ──────────────────────────────────── // Tags: h1, h2, h3, h4, h5, h6, p, label, span (default) text value="Heading 1" tag=h1 {fs:48,fw:800,c:#fff} text value="Heading 2" tag=h2 {fs:32,fw:700,c:#fff} text value="Heading 3" tag=h3 {fs:24,fw:600,c:#fff} text value="Paragraph" tag=p {fs:16,c:#a1a1aa} text value="Label" tag=label {fs:12,c:#71717a} // bind= for dynamic content text bind=userName tag=p // ── 5. IMAGE — next/image with full path support ──────────────────── // Full paths used as-is, bare names get /.png image src="/images/hero.png" alt="Hero" width=800 height=400 priority=true image src="https://cdn.example.com/photo.jpg" alt="Photo" fill=true image src=logo alt="Logo" width=100 height=40 // priority=true → adds priority attribute (LCP optimization) // fill=true → omits width/height, adds fill prop // ── 6. BUTTON + LINK — navigation and actions ────────────────────── button text="Click Me" onClick=handleClick {bg:#f97316,c:#fff,br:8,p:12} button text="Go Home" to=home {bg:#f97316,c:#fff,br:8,p:12} link to=/docs text value="Read Docs" {c:#f97316} // to= generates next/link, onClick= generates