Compiler and VM
ClearKrypt must compile 1-to-1 from source to supported targets without AI translation. The compiler is the contract.
Lexer
Reads source text and creates tokens: identifiers, strings, numbers, braces, decorators, operators, keywords.
app "Demo" → APP STRING
Parser
Turns tokens into an AST with nodes like AppDecl, UseDecl, ModelDecl, ScreenDecl, ButtonNode.
ScreenDecl(name: Home, body: [...])
Semantic checker
Confirms modules are imported, identifiers exist, types match, and target permissions are declared.
button requires module ui
IR builder
Creates platform-neutral ClearKrypt IR so all emitters receive the same meaning.
{ kind:"Button", action:"go" }VM
Runs IR for testing, server tasks, scripted flows, and sandbox evaluation.
ck run app.ck
Emitters
Produce Web, Worker, Phone shell, PC shell, and documentation metadata.
ck build-all main.ck --out dist
Compiler contract
ClearKrypt source must be deterministic. The same input + same compiler version = same emitted output. No AI inference is allowed in the compiler path. Unknown command = compile error. Missing module = compile error. Invalid target permission = compile error.
Target emitters
Web emitter
Produces HTML, CSS, and JS bundles from the same IR tree used by the preview renderer.
Inline emitter
Produces one self-contained HTML file for demos, docs, and quick sharing.
C# emitter
Maps screens to .NET-style StackLayout, Label, Button, and future MAUI components.
Swift emitter
Maps screens to SwiftUI VStack, Text, Button, and native styling concepts.
