inlang (.in)

inlang is inauguration’s surface for compiler orchestration, agent reports, and bounded programs. You can write it in human-readable form (colons + indentation, no braces) or brace form; the parser normalizes human syntax to braces before Core IR. Pipeline: Core IRMIRnative JIT (no LLVM, no bytecode VM).

Crepuscularity is the sibling UI stack (.crepus, GPUI, WASM sites). Inauguration owns compilation; crepuscularity owns rendering. The docs-site is a crepuscularity web target (crepus web build / web serve), same as crepuscularity’s own docs-site.

Workflow flags and CI entry points stay in the repo README. This page is grammar, imports, and IR shape.

Quick start (human-readable)

Indent with spaces. Headers end with :; the compiler expands this to brace form internally (normalize_human_in_source in in_lang_parse).

import std.io

needs process.stdout

host_log(text: String) uses process.stdout

Message:
  text: String

main:
  print "hello from inlang"
  host_log "visible to in agent"

Same program in brace form (what you see after canonicalize / in tools that emit braces):

import std.io;

capability process.stdout;

extern human fn host_log(text: String) -> void requires process.stdout;

struct Message {
  String text;
}

fn main() -> void {
  print("hello from inlang");
  host_log("visible to in agent");
  return;
}
in build --path hello.in
in execute --path hello.in
in graph --path hello.in --json

Syntax by example

Params are always name: Type in signatures. Prefer human-readable for docs and scripts; use brace form when you want explicit { / } or C-like bodies.

Human-readable rules

You writeMeaning
import std.io or import "./lib.in"Semicolon optional on human lines
needs capability.namecapability capability.name;
enable my-extensionenable my-extension;
Name: then indented linesStruct (field: Type per line) or function body
fn name(a: Int) -> String:Function with indented body
main:Entry function (same as fn main() -> void)
print "text"Call — becomes print("text")
host_log "msg"Bare words → call with string arg
bump on its own lineBare identifier → bump()
donereturn
sig uses cap.a, cap.bextern human fn sig -> void requires cap.a, cap.b;
parallel:parallel { … } block
distributed train:distributed fn train() -> void { … }

Full example (human):

package demo.app
module demo.app.main

import std.io
import std.process

needs process.stdout

host_log(msg: String) uses process.stdout

Message:
  text: String

main:
  print "ok"
  host_log "docs hook ran"
  process_run "./scripts/build-docs-site.sh"
  done

Package, module, imports (brace form)

package demo.app;
module demo.app.main;

import "./helpers.in";
import std.io;
import std.process;

fn main() -> void {
  print("ok");
  return;
}

Semantic package wiring (needs inauguration.package nearby):

use my.lib;
bind my.lib as lib;

Types, constants, variables

const MAX = 128;
var counter: Int = 0;

fn bump() -> Int {
  counter = counter + 1;
  return counter;
}

Built-ins: Int, String, Bool, void / Void, plus struct/class names you declare.

Struct and class

struct Point {
  Int x;
  Int y;
}

class Greeter {
  name: String;

  fn hello() -> String {
    return "hi " + name;
  }
}

fn main() -> String {
  let p = Point { x: 1, y: 2 };
  let g = Greeter { name: "Ada" };
  return g.hello();
}

Interface and component (contracts)

interface Writer {
  fn write(msg: String) -> void;
}

component AppShell {
  target "aarch64-apple-darwin"
  deterministic true

  export main: BootEntry
  capability serial: DebugConsole(write)
}

Interfaces are surface contracts; components declare exports, targets, and capability needs for in agent / SCI-style checks.

Functions, control flow, calls

fn fib(n: Int) -> Int {
  if n <= 1 {
    return n;
  } else {
    return fib(n - 1) + fib(n - 2);
  }
}

fn sum_to(limit: Int) -> Int {
  let acc: Int = 0;
  let i: Int = 0;
  while i < limit {
    acc = acc + i;
    i = i + 1;
  }
  return acc;
}

fn main() -> Int {
  return fib(10) + sum_to(5);
}

for i in 0..8 { … } is recognized where the front supports bounded ranges.

Extern and capabilities

capability memory;

extern rust fn alloc(size: Int) -> Int;
extern c fn free(ptr: Int) -> void requires memory;

fn main() -> void {
  return;
}

Missing capability lines for requires show up as in agent warnings (AGENT_MISSING_CAPABILITY).

Orchestration metadata

enable distributed-workers;

@pure
fn hash(data: String) -> Int {
  return 0;
}

distributed fn train(data: String) -> Int {
  return 0;
}

parallel {
  step(0);
  step(1);
}

fn step(id: Int) -> void {
  return;
}

distributed, parallel, and enable are facts for graphs and agents; remote/threaded execution is not guaranteed yet.

Stdlib-style I/O (JIT builtins)

import std.io;
import std.fs;
import std.process;

fn main() -> void {
  print("hello");
  write_file("/tmp/out.txt", "data");
  process_run("./scripts/build-docs-site.sh");
  return;
}

Kernel / bare-metal subset (when lowering allows)

const PORT: Int = 0x3F8;

fn uart_put(c: Int) -> void {
  outb(PORT, c);
  return;
}

fn read_word(addr: Int) -> Int {
  return load64(addr);
}

fn halt_loop() -> void {
  while true {
    hlt();
  }
}

load* / store*, inb / outb, hlt, sti, cli, and friends target freestanding emit paths; availability depends on target and type support in native_emit.

Expressions and operators

fn ops(a: Int, b: Int) -> Bool {
  let sum = a + b;
  let masked = (a << 4) | (b & 0xFF);
  return sum == 42 && masked != 0;
}

Arithmetic, bitwise, and comparisons chain as in the table in parser-surface.md; method calls desugar to mangled functions on classes.

Ideology

Top-level declarations (v0.2+)

FormRole
package name; / module name;Dotted identity for reports (at most one each per file)
import "./lib.in";Merge local .in declarations
import std.io;Synthesize stdlib bindings (print, …)
use pkg.key; / bind pkg.key as alias;Semantic package imports (manifest resolution)
capability name;Declared outside-world capability facts
enable ext;Orchestration extension fact (registry validation)
struct / class / interface / componentTypes and contracts (see skill + conformance)
fn name(params) -> Ret { … }Functions; fn main required for entry
extern rust fn …;Foreign binding stub + capability requires

Stdlib imports

std.io, std.fs, std.http, std.json, std.process, std.cli, std.env, std.path add extern-style declarations. JIT-backed today includes print, read_file, write_file, process_run, env_get, env_set, env_has, and path helpers where wired in native_stdlib / lower_stdlib. http_get, full json_parse, and remote package install remain contract/diagnostic surfaces until runtime tests land.

Orchestration (v0.4 contract)

CommandPurpose
in canonicalize --path <file>Deterministic .in formatting
in graph --path <file> [--json]Parser decision, symbols, calls, package identity
in package --path <dir|manifest|source>Manifest + dependency graph facts
in agentEffects, capabilities, orchestration facts

See orchestration-compiler.md.

Types and bodies

Runtime boundaries

Treat roadmap bullets as contracts until in test and runtime code back them: GPU scheduling, remote distributed fn, semantic use install, and full FFI execution.

hybrid_sil merge

Merged textual SIL keeps legacy last-sil @ function_id while exposing per-function records in SilArtifact::functions. Emitters place @main last for single-function views. Details: multi-frontend-ir.md.

See also