MM Compiler

A compiler that adds zero bytes. Everything you see is earned through barcode scans.

The Gate

The only hardcoded logic in the entire application:

function canAccept(prime, generated) {
  // Direct: this number exists in the generated set
  if (generated.has(prime)) return true;

  // GCD: shares a factor with anything generated
  for (const existing of generated) {
    if (gcd(prime, existing) > 1) return true;
  }

  return false;
}

function gcd(a, b) {
  a = Math.abs(a); b = Math.abs(b);
  while (b) { [a, b] = [b, a % b]; }
  return a;
}

Everything else — CSS, content, fonts, database tables, the lexicon — arrives through barcodes and must pass this gate.

The Ledger (mm_loop)

The heart of the system. A single table in localStorage:

ColumnTypeDescription
valuenumberThe number itself
typestring'prime' | 'composite'
originstringHow it got here (e.g. "scanned", "2×3")
costnumberφ² ≈ 2.618 for primes, 0 for composites
ticknumberGeneration order (0-indexed)
consumedbooleanHas a barcode used this number yet?

When you scan a raw prime:

  1. The prime is added with cost = φ²
  2. Every product (prime × existing values) is added as a composite with cost = 0
  3. The pending queue is swept — any barcode whose prime now passes the gate gets replayed

The potential is: SELECT * FROM mm_loop WHERE consumed = false

Barcode Protocol

Format: type:prime:content

TypeGate RuleWhat It Does
(raw number)Always acceptedAdds prime to ledger
cssExact prime in generatedInjects <style> tag
h1, h2, h3, pcanAccept(prime)Content node
mathcanAccept(prime)Math expression
defcanAccept(prime)Definition
hrcanAccept(prime)Separator
metacanAccept(prime)Page title
jscanAccept(prime)Code (earned execution)
tp, tpb, op, qcanAccept(prime)Database operations
compose, join, pipecanAccept(prime)Composition
lexcanAccept(prime)Lexicon

What the IDE Builds

  1. The gate function (canAccept + gcd)
  2. The ledger table (mm_loop)
  3. The scan input (camera + manual + calculator)
  4. The DB visualizer (Studio tab)

That's it. Everything else arrives through barcodes.

What the IDE Does NOT Build

Boot Sequence

  1. Phase 1: Scan raw primes (2, 3, 5, 7, 11, 13, 17, 19) — build the ledger
  2. Phase 2: Scan CSS tensors — the app becomes beautiful
  3. Phase 3: Scan content — the paper materializes
  4. Phase 4: Scan JS — database engine arrives
  5. Phase 5: Scan lexicon — the app speaks English

The compiler adds zero bytes of content. Zero bytes of styling. Zero lines of business logic. It only knows how to accept or reject. Everything else is earned.