interplane.io
Source of interplane.io: a Rust generator that renders the page from the protocol repository's public record, deployed hourly from the Spark.
Brought by drakestapleton
interplane.io / content / omega / write / index.html
| 1 | title: Write and check Omega programs | Interplane |
| 2 | description: Set up the Omega Harness and seeded compiler, write a bounded program, and verify the result with a negative control. |
| 3 | --- |
| 4 | <section class="page-head omega-sky omega-feature"><div class="shell"><div class="col wide omega-feature-grid"><div> |
| 5 | <span class="eyebrow">Omega · Field guide</span><h1>Write it. Run it. Check it.</h1> |
| 6 | <p class="lede">Get the Harness, learn the few rules that shape an Omega program, and use a compiler refusal to test your first working example.</p> |
| 7 | <div class="actions"><a class="button orange" href="#harness">Get the Omega Harness</a><a class="text-link" href="/omega/tools.txt">Agent tool index</a></div> |
| 8 | </div><figure class="omega-illustration"><img src="/public/omega-writing.png" width="1200" height="800" alt="Illustration of three clear glass plates etched with parallel lines, two stacked at the back and one large in front, beside a metal block with two raised blocks and a metal scribing pen."><figcaption>Illustration of a program at the workbench.</figcaption></figure></div></div></section> |
| 9 | <section class="band"><div class="shell"><article class="col prose"> |
| 10 | <h2>What you write</h2> |
| 11 | <p>Omega source uses <code>.om</code> files. Omegese is the source notation described in the language reference. Operators come first, followed by their inputs. In <code>add mul a b c</code>, <code>mul</code> consumes <code>a</code> and <code>b</code>, and <code>add</code> consumes that result and <code>c</code>. A name introduced inside a block goes out of scope at its <code>end</code>. Declare shared state before the block that updates it. <a href="https://interplane.io/drakestapleton/omega-mv/blob/main/docs/one_layer/OMEGESE.md">Language reference</a>.</p> |
| 12 | <p>A function spells out its argument and return types. The compiler checks the types of operations and rejects incompatible operands. Loops can carry explicit bounds, and the executable can trap if it crosses a bound at runtime. Choose a small positive case and a deliberately broken input, and record the expected outcome of each before running. <a href="https://interplane.io/drakestapleton/omega-mv/blob/main/seed/README.md">Compiler checks and controls</a>.</p> |
| 13 | <h2 id="harness">Start with the Omega Harness</h2> |
| 14 | <p>The Harness gives people and agents a shared workflow, with language guides, compiler pins and executable examples. Get the Git checkout, then read the workflow and writing guide before editing <code>.om</code>. Use the encoding guide when you need a specific rule, host operation or diagnostic. <a href="https://interplane.io/drakestapleton/omega-harness">Omega Harness project</a>.</p> |
| 15 | <pre class="wrap"><code>git clone https://interplane.io/projects/omega-harness/repo.git omega-harness |
| 16 | cd omega-harness |
| 17 | git rev-parse HEAD |
| 18 | cat PIN |
| 19 | cat skills/omega-harness/SKILL.md skills/writing-omega/SKILL.md</code></pre> |
| 20 | <figure class="omega-diagram"><ol class="omega-flow omega-workflow" aria-label="Omega writing and verification workflow"> |
| 21 | <li><strong>Pin</strong><span>Identify the source, target and compiler hash before writing.</span></li> |
| 22 | <li><strong>Write</strong><span>Use the language guide and a nearby compiled example.</span></li> |
| 23 | <li><strong>Compile and run</strong><span>Capture diagnostics, exit status and output on the named target.</span></li> |
| 24 | <li><strong>Try to break it</strong><span>Change one input or one rule and require the expected failure.</span></li> |
| 25 | <li><strong>Hand off evidence</strong><span>Retain the exact commands, results and hashes for another run.</span></li> |
| 26 | </ol><figcaption>The Harness workflow from source selection to reproducible evidence.</figcaption></figure> |
| 27 | <details class="agent-prompt" id="prompt-write-omega"> |
| 28 | <summary>Agent prompt: Write and verify an Omega program</summary> |
| 29 | <pre class="wrap"><code>{{agents/prompts/write-omega.txt}}</code></pre> |
| 30 | <p><a class="button dark small" href="/agents/prompts/write-omega.txt">Open plain text</a></p> |
| 31 | </details> |
| 32 | <h2 id="example">Trace a small program</h2> |
| 33 | <p><code>total</code> starts as an <code>int</code> outside the loop. Each iteration adds the counter to it. <code>bound 4</code> makes the loop limit explicit. <code>ret total</code> sends the result back as the process exit code.</p> |
| 34 | <pre class="wrap"><code id="sum-source">fn main to int |
| 35 | total = int 0 |
| 36 | for i int 4 bound 4 |
| 37 | total = add total i |
| 38 | end |
| 39 | ret total |
| 40 | end</code></pre> |
| 41 | <p>Save <a href="/omega/examples/sum.om">sum.om</a> and obtain the <a href="/omega/#downloads">verified compiler preview</a>. These commands assume you extracted the preview into the same scratch directory and are running 64-bit Arm Linux. The example reports through its exit status. The expected status is <code>6</code>.</p> |
| 42 | <pre class="wrap"><code>if ./omc < sum.om > omega-sum && chmod +x omega-sum; then |
| 43 | ./omega-sum |
| 44 | printf 'exit=%s\n' "$?" |
| 45 | fi</code></pre> |
| 46 | <p>For a negative control, replace the integer return value with a boolean in a separate file. The published preview refuses this program with compiler error <code>7</code>, a type mismatch at line <code>6</code>.</p> |
| 47 | <pre class="wrap"><code>sed 's/ret total/ret true/' sum.om > sum-bad.om |
| 48 | ./omc < sum-bad.om > sum-bad |
| 49 | printf 'compiler exit=%s\n' "$?"</code></pre> |
| 50 | <h2 id="tools">Choose the guide for your next task</h2> |
| 51 | <dl class="deflist"> |
| 52 | <dt>Compiler rules and examples</dt><dd>In the Harness clone, read <code>skills/omega-encoding/SKILL.md</code>. The <code>examples/gate.sh</code> runner checks the compiler hash in <code>PIN</code> before compiling or running examples. For work in another repository, use that project's compiler pin.</dd> |
| 53 | <dt>Compiler internals and targets</dt><dd>Read <code>seed/omc/omc.om</code> and <code>docs/one_layer/OM_COMPLETION.md</code> in the <a href="https://interplane.io/drakestapleton/omega-mv">compiler repository</a>. The scalar OSC IR backends cover specific WebAssembly and SPIR-V subsets. Start with the target's test and refusal evidence, and check your runtime separately. <a href="https://interplane.io/drakestapleton/omega-mv/blob/main/seed/README.md">Backend and smoke-test references</a>.</dd> |
| 54 | <dt>Conversion of existing code</dt><dd><a href="https://interplane.io/drakestapleton/omega-bridge">Omega Bridge</a> documents accepted source subsets and refusals. Use its source and tests for a migration, and use the seeded compiler and Harness for new Omega source.</dd> |
| 55 | <dt>Focused tools</dt><dd>Read <code>coder/README.md</code> in the Harness for the optional <code>omp</code> workflow. Use the dedicated Harness guides for Lean 4 proofs, Wolfram calculations and authorized GB10 hardware work only when your task needs them.</dd> |
| 56 | <dt>Local agent and editor tools</dt><dd><a href="https://interplane.io/drakestapleton/omega-mcp">Omega MCP</a> offers local language lookup, compilation and execution over standard input and output. Its checkout documents its compiler pin and Bubblewrap requirement. See <a href="https://interplane.io/drakestapleton/vscode-omega">Omega for VS Code</a> for source, syntax highlighting and optional compiler diagnostics.</dd> |
| 57 | </dl> |
| 58 | <div class="actions"><a class="button dark" href="/omega/tools.txt">Open the agent tool index</a><a class="text-link" href="/omega/bootstrap/">See how the compiler was built</a></div> |
| 59 | </article></div></section> |