The engine

Parse once. Reason semantically. Emit for the stack.

KERN starts as compact .kern source, becomes a structured IR, and then flows into compiler targets, review rules, MCP tools, tests, and language-evolution workflows.

The important part is not a template string. It is the shared semantic layer: nodes, props, types, routes, effects, guards, confidence, and evidence survive across tools.

.KERNSOURCEASTSEMANTICKERN IRTAILWINDNUXTNEXT.JSREACTVUEEXPRESSFASTAPINATIVECLITERMINALINKREVIEWHover to explore — source → IR → 11 targets

Why it works

The IR carries meaning across products.

The parser accepts an indentation-based language with key=value props, style shorthands, typed nodes, handlers, machines, routes, MCP tools, tests, and evolved node hints. Review and compile both consume the same structured tree.

.kerncompact source
parserAST + diagnostics
semantic IRnodes, effects, guards
targetsframework output

Actions and effects

Review can distinguish reads, writes, network calls, auth, validation, and recovery paths instead of only matching text.

Capability matrix

Target support is explicit: native, lowered, or unsupported by feature and position, so the compiler can be honest about what emits cleanly.

Diagnostics and confidence

Parse diagnostics, review confidence, suppression metadata, and evidence spans make findings easier to audit and automate.

The language (v4)

A typed core language. Two real runtimes.

v4 turns KERN's portable layer into a typed core language: classes, enums, and closures that compile to both TypeScript and Python with identical behavior. The same source, two runtimes, one meaning.

Classes — inheritance, abstract, getters, static
class name=Shape abstract=true export=true
  method name=area returns=number
class name=Square extends=Shape export=true
  field name=side type=number value={{ 3 }}
  method name=area returns=number
    handler
      return value="this.side * this.side"

fn name=measure returns=number
  param name=shape type=Shape
  handler
    return value="shape.area()"
Enums — TS native, Python namespace class
enum name=Status values="Pending|Active|Done"

# TypeScript:  export enum Status { ... }
# Python:      class Status:  (Pending = 0, ...)
#
# Same member values, including auto-increment.
# Reverse indexing Status[0] and Object.keys(Status)
# iteration are rejected at compile time on BOTH
# targets — neither side can silently diverge.

Parity is enforced, not promised

Every construct ships with differential conformance fixtures that execute the generated TypeScript and the generated Python and require identical results. Anything outside the provable subset fails closed with an explicit compile error instead of guessing — closures with captured-variable mutation are lowered correctly on both targets.

kern check — nominal type checker

Verifies class hierarchies and Liskov-checked override variance, call-site arity and argument types, and declared returns. Zero false positives by design: it only reports violations it can prove. Exit codes 0 / 1 / 2 and a stable JSON contract for CI.

Compile

15 concrete targets in the compiler config.

Each target has its own emitter path. Some features compile natively, some lower to runtime helpers, and some are intentionally marked unsupported until the target can emit them correctly.

--target=lib

shared TypeScript library output

--target=nextjs

Next.js App Router pages and routes

--target=tailwind

React output with Tailwind classes

--target=web

React web components

--target=native

React Native output

--target=express

Node/Express APIs

--target=cli

command-line apps

--target=terminal

ANSI terminal UI

--target=ink

React terminal UI

--target=vue

Vue 3 SFCs

--target=nuxt

Nuxt pages and routes

--target=fastapi

Python FastAPI services

--target=mcp

Model Context Protocol servers

--target=python

portable Python lowering

--target=go

portable Go lowering

Review engine

Static analysis uses more than AST matching.

The review package builds file context, import graphs, call graphs, concept maps, taint flows, public API maps, quality rules, and confidence graphs. That is why it can report problems like unguarded effects or route contract drift with evidence.

reviewDirectory()
  build context graph
  extract TS/Python concepts
  analyze taint flows
  run active rule layers
  group by root cause
  assign confidence
  emit report / SARIF
evolve(input)
  collect TS files
  detect gaps
  analyze patterns
  propose templates
  validate proposals
  stage approved output

Evolve

Turn repeated code into reviewable language.

kern evolve is an experimental pipeline for detecting recurring TypeScript patterns, proposing templates or structural nodes, validating them, and staging the result for approval.

Proof

This site is built from Kern source and Next.js output.

The landing app keeps .kern sources beside generated Next files, uses the compiler target for app routes, and ships the result as a normal Next.js site.