Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/om/omega-reference/page.om # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / om / omega-reference / page.om` 887 lines ยท 15638 bytes Raw Blame History 1 note page: writes /omega/reference/ to stdout from vendor.pin, vendor.sha256 and vendor/ 2 note Run from om/omega-reference with the pinned omc (check.sh). Inputs are read, never fetched. 3 note Markdown subset of the guide: headings, paragraphs, lists, tables, fences, code, bold, links. 4 note Every example file is printed byte for byte; html_to_text in seo.rs keeps it so in llms-full. 5 om2 6 text t_amp "&" 7 text t_lt "<" 8 text t_gt ">" 9 text t_quot """ 10 note t_hash: the # of a reference such as #775, written as an entity so no # is followed by digits 11 text t_hash "#" 12 text t_pin "vendor.pin" 13 text t_pinkey "omega-harness " 14 text t_man "vendor.sha256" 15 text t_vend "vendor/" 16 text t_skill "skills/writing-omega/SKILL.md" 17 text t_gate "examples/gate" 18 text t_dotsh ".sh" 19 text t_om ".om" 20 text t_exp ".expect" 21 text t_sin ".stdin" 22 text t_arg ".args" 23 text t_env ".env" 24 text t_out ".stdout" 25 text t_fm "---\n" 26 text t_dash3 "---" 27 text t_fence "```" 28 text t_h1 "# " 29 text t_h2 "## " 30 text t_h3 "### " 31 text t_li "- " 32 text t_two " " 33 text t_bar "|" 34 text t_sep "|-" 35 text t_up2 "../../" 36 text t_up1 "../" 37 text t_gh "https://interplane.io/drakestapleton/omega-harness/blob/" 38 text t_skl "/skills/" 39 note The guide names omega-mv on GitHub; the page links the forge and says the download is not open yet. 40 text t_ghmv "https://github.com/aien-dev/omega-mv" 41 text t_fgmv "https://interplane.io/drakestapleton/omega-mv" 42 text t_ghcl "git clone https://github.com/aien-dev/omega-mv && cd omega-mv" 43 text t_rdcl "# omega-mv is moving to Interplane, my own forge; downloads are not open yet." 44 text t_pre "
\n"

45 text t_epre "
" 46 text t_p "

" 47 text t_ep "

" 48 text t_ul "" 50 text t_lio "
  • " 51 text t_eli "
  • " 52 text t_tab "" 53 text t_etab "
    " 54 text t_tr "" 55 text t_etr "" 56 text t_th "" 57 text t_eth "" 58 text t_td "" 59 text t_etd "" 60 text t_code "" 61 text t_ecode "" 62 text t_bo "" 63 text t_ebo "" 64 text t_ahref "" 66 text t_ea "" 67 text t_hid "

    " 70 text t_art3 "

    " 71 text t_eart "" 72 text t_lab1 "

    File: " 73 text t_lab2 "" 74 text t_empty " (empty file)

    " 75 text t_hexl " (hex bytes)

    \n"
    
    76 text t_nonl " (no final newline)

    \n"
    
    77 text t_endp "

    \n"
    
    78 text t_top1 "

    Omega

    Omega language reference

    Everything an agent needs to write Omega that the pinned compiler accepts and that does what it should: program shape, types, declarations, statements, words, OM-2, the host words, every compiler error and trap exit code, common mistakes, and " 79 text t_top2 " worked examples that each passed the examples gate.

    An Omega program writes this page: om/omega-reference/page.om in the aienos.com repository reads the guide skills/writing-omega/SKILL.md and the examples of omega-harness commit " 82 text t_top5 " and prints every file byte for byte. The compiler pin is omega-mv `e5b32567a7aff3ce594e3254a622a846a6cd190b`, omc sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. The same text is in llms-full.txt.

    " 83 text t_mid1 "

    Worked examples

    " 84 text t_mid2 " programs from examples/ and skills/omega-encoding/examples/, each listed with its files. NAME.om is the program. NAME.expect is what the gate checks: compile N is the compiler's exit status, stderr LINE its whole stderr when N is not 0, exit N the program's exit status, input dir and output full the two refusals that need a special compiler input or output. NAME.stdout is the exact standard output, and an absent one means empty. NAME.stdin, NAME.args (one argument per line) and NAME.env (one KEY=VALUE per line) are what the program is given.

    Each file is labelled File: PATH and followed by its bytes in one block. To copy a file out of llms-full.txt, take the lines between its two fences and end each with a newline. A label ending in (no final newline) means the file does not end in a newline, so drop the last one. A label ending in (hex bytes) means the block lists the bytes as two hex digits each, sixteen to a line. A label ending in (empty file) means the file has no bytes and no block follows.

    " 85 text t_end1 "

    Checking the examples

    Write every file on this page into one directory tree with the paths in the labels, then run bash examples/gate.sh /path/to/omc. The gate refuses any compiler but the pinned one. It compiles each program, runs it with an empty environment plus its .env in an empty scratch directory under a 20 second timeout, compares the exit status and the stdout bytes, requires an empty stderr, prints one PASS or FAIL line per program and ends with GATE PASS examples=N when all of them match. The aienos.com build checks that the files in llms-full.txt are these files, and om/omega-reference/llms-check.sh extracts them from llms-full.txt and runs this gate on them.

    " 86 text t_end2 "
    " 87 global ob uchar 65536 88 global fb uchar 262144 89 global mb uchar 65536 90 global pb uchar 512 91 global cm uchar 64 92 global st ulong 8 93 note st: 0 output fill, 1 file length, 2 manifest length, 3 commit length, 94 note 4 path length, 5 bold open, 6 stem length 95 96 fn oflush to void 97 n = get st 0 98 p = ulong 0 99 while lt p n bound 65536 100 k = write 1 ob p sub n p 101 if le k 0 102 exit 90 103 end 104 p = add p ulong k 105 end 106 put st 0 0 107 end 108 109 fn putb b uchar to void 110 n = get st 0 111 if eq n len ob 112 oflush 113 n = ulong 0 114 end 115 put ob n b 116 put st 0 add n 1 117 end 118 119 fn outs s view uchar * to void 120 for i ulong len s 121 putb get s i 122 end 123 end 124 125 fn esc b uchar to void 126 if eq b 38 127 outs t_amp 128 ret 129 end 130 if eq b 60 131 outs t_lt 132 ret 133 end 134 if eq b 62 135 outs t_gt 136 ret 137 end 138 if eq b 34 139 outs t_quot 140 ret 141 end 142 putb b 143 end 144 145 note fbhash: fb[p] is # and fb[p+1], before b, is a digit 146 fn fbhash p ulong b ulong to bool 147 if ne get fb p 35 148 ret false 149 end 150 q = add p 1 151 if ge q b 152 ret false 153 end 154 c = get fb q 155 if lt c 48 156 ret false 157 end 158 if gt c 57 159 ret false 160 end 161 ret true 162 end 163 164 note mbhash: the same test in mb 165 fn mbhash p ulong b ulong to bool 166 if ne get mb p 35 167 ret false 168 end 169 q = add p 1 170 if ge q b 171 ret false 172 end 173 c = get mb q 174 if lt c 48 175 ret false 176 end 177 if gt c 57 178 ret false 179 end 180 ret true 181 end 182 183 fn escfb a ulong b ulong to void 184 p = a 185 while lt p b bound 262144 186 if fbhash p b 187 outs t_hash 188 else 189 esc get fb p 190 end 191 p = add p 1 192 end 193 end 194 195 fn escmb a ulong b ulong to void 196 p = a 197 while lt p b bound 65536 198 if mbhash p b 199 outs t_hash 200 else 201 esc get mb p 202 end 203 p = add p 1 204 end 205 end 206 207 fn escs s view uchar * to void 208 for i ulong len s 209 esc get s i 210 end 211 end 212 213 fn outcm to void 214 n = get st 3 215 for i ulong n 216 putb get cm i 217 end 218 end 219 220 fn outdec v ulong to void 221 d = new uchar 20 0 222 n = ulong 0 223 x = v 224 while true bound 21 225 put d n add uchar rem x 10 48 226 n = add n 1 227 x = div x 10 228 if eq x 0 229 break 230 end 231 end 232 while gt n 0 bound 21 233 n = sub n 1 234 putb get d n 235 end 236 end 237 238 note slurp: read the file named by pb[0 .. st 4) into fb; its length, or -2 when it does not exist 239 fn slurp to long 240 fd = fopen pb 0 get st 4 0 0 241 if lt fd 0 242 if eq fd -2 243 ret -2 244 end 245 exit 91 246 end 247 f = int fd 248 t = ulong 0 249 while true bound 262145 250 if eq t len fb 251 exit 92 252 end 253 k = read f fb t sub len fb t 254 if lt k 0 255 exit 93 256 end 257 if eq k 0 258 break 259 end 260 t = add t ulong k 261 end 262 c = fclose f 263 if ne c 0 264 exit 93 265 end 266 put st 1 t 267 ret long t 268 end 269 270 fn pbadd s view uchar * to void 271 n = get st 4 272 for i ulong len s 273 put pb add n i get s i 274 end 275 put st 4 add n len s 276 end 277 278 fn pbmb a ulong b ulong to void 279 n = get st 4 280 p = a 281 while lt p b bound 512 282 put pb n get mb p 283 n = add n 1 284 p = add p 1 285 end 286 put st 4 n 287 end 288 289 note sw: does fb[p .. q) start with s 290 fn sw p ulong q ulong s view uchar * to bool 291 n = len s 292 if gt n sub q p 293 ret false 294 end 295 for i ulong n 296 if ne get fb add p i get s i 297 ret false 298 end 299 end 300 ret true 301 end 302 303 fn eol p ulong e ulong to ulong 304 q = p 305 while lt q e bound 262144 306 if eq get fb q 10 307 ret q 308 end 309 q = add q 1 310 end 311 ret e 312 end 313 314 fn meol p ulong e ulong to ulong 315 q = p 316 while lt q e bound 65536 317 if eq get mb q 10 318 ret q 319 end 320 q = add q 1 321 end 322 ret e 323 end 324 325 note loadpin: the omega-harness commit from the first line of vendor.pin, into cm 326 fn loadpin to void 327 put st 4 0 328 pbadd t_pin 329 n = slurp 330 if lt n 0 331 exit 94 332 end 333 e = eol 0 ulong n 334 if eq sw 0 e t_pinkey false 335 exit 94 336 end 337 s = len t_pinkey 338 if ne sub e s 40 339 exit 94 340 end 341 for i ulong 40 342 put cm i get fb add s i 343 end 344 put st 3 40 345 end 346 347 fn loadman to void 348 put st 4 0 349 pbadd t_man 350 n = slurp 351 if lt n 0 352 exit 95 353 end 354 m = ulong n 355 if gt m len mb 356 exit 96 357 end 358 for i ulong m 359 put mb i get fb i 360 end 361 put st 2 m 362 end 363 364 note isprog: is the manifest line [p .. q) a program, "HASH PATH.om" 365 fn isprog p ulong q ulong to bool 366 if lt sub q p 70 367 ret false 368 end 369 if ne get mb add p 64 32 370 exit 96 371 end 372 if ne get mb sub q 3 46 373 ret false 374 end 375 if ne get mb sub q 2 111 376 ret false 377 end 378 if ne get mb sub q 1 109 379 ret false 380 end 381 ret true 382 end 383 384 fn nprogs to ulong 385 m = get st 2 386 c = ulong 0 387 p = ulong 0 388 while lt p m bound 4096 389 q = meol p m 390 if isprog p q 391 c = add c 1 392 end 393 p = add q 1 394 end 395 ret c 396 end 397 398 fn bold to void 399 if eq get st 5 0 400 outs t_bo 401 put st 5 1 402 else 403 outs t_ebo 404 put st 5 0 405 end 406 end 407 408 fn icode p ulong b ulong to ulong 409 q = add p 1 410 while lt q b bound 65536 411 if eq get fb q 96 412 outs t_code 413 escfb add p 1 q 414 outs t_ecode 415 ret add q 1 416 end 417 q = add q 1 418 end 419 esc 96 420 ret add p 1 421 end 422 423 fn iurl a ulong b ulong to void 424 if sw a b t_ghmv 425 outs t_fgmv 426 escfb add a len t_ghmv b 427 ret 428 end 429 if sw a b t_up2 430 outs t_gh 431 outcm 432 putb 47 433 escfb add a 6 b 434 ret 435 end 436 if sw a b t_up1 437 outs t_gh 438 outcm 439 outs t_skl 440 escfb add a 3 b 441 ret 442 end 443 escfb a b 444 end 445 446 note ilink: [text](url) at p; a lone [ is printed as it is 447 fn ilink p ulong b ulong to ulong 448 m = add p 1 449 while lt add m 1 b bound 65536 450 if and eq get fb m 93 eq get fb add m 1 40 451 e = add m 2 452 while lt e b bound 65536 453 if eq get fb e 41 454 outs t_ahref 455 iurl add m 2 e 456 outs t_aend 457 inl add p 1 m 458 outs t_ea 459 ret add e 1 460 end 461 e = add e 1 462 end 463 esc 91 464 ret add p 1 465 end 466 m = add m 1 467 end 468 esc 91 469 ret add p 1 470 end 471 472 fn isbold p ulong b ulong to bool 473 if lt add p 1 b 474 if eq get fb add p 1 42 475 ret true 476 end 477 end 478 ret false 479 end 480 481 fn inl a ulong b ulong to void 482 p = a 483 while lt p b bound 65536 484 y = get fb p 485 if eq y 96 486 p = icode p b 487 else 488 if and eq y 42 isbold p b 489 bold 490 p = add p 2 491 else 492 if eq y 91 493 p = ilink p b 494 else 495 if fbhash p b 496 outs t_hash 497 else 498 esc y 499 end 500 p = add p 1 501 end 502 end 503 end 504 end 505 end 506 507 note head: a guide heading; # is h2, ## is h3 with id sN from its number, ### is h4 508 fn head p ulong q ulong lvl ulong to void 509 s = add p add lvl 1 510 if eq lvl 2 511 outs t_hid 512 x = s 513 while lt x q bound 8 514 y = get fb x 515 if or lt y 48 gt y 57 516 break 517 end 518 putb y 519 x = add x 1 520 end 521 outs t_aend 522 else 523 putb 60 524 putb 104 525 putb add uchar lvl 49 526 putb 62 527 end 528 inl s q 529 putb 60 530 putb 47 531 putb 104 532 putb add uchar lvl 49 533 putb 62 534 end 535 536 fn trims a ulong b ulong to ulong 537 p = a 538 while lt p b bound 4096 539 if ne get fb p 32 540 ret p 541 end 542 p = add p 1 543 end 544 ret b 545 end 546 547 fn trime a ulong b ulong to ulong 548 q = b 549 while gt q a bound 4096 550 if ne get fb sub q 1 32 551 ret q 552 end 553 q = sub q 1 554 end 555 ret a 556 end 557 558 fn cell a ulong b ulong hdr ulong to void 559 s = trims a b 560 e = trime s b 561 if eq hdr 1 562 outs t_th 563 inl s e 564 outs t_eth 565 else 566 outs t_td 567 inl s e 568 outs t_etd 569 end 570 end 571 572 note row: one table row; a | inside a code span does not split cells 573 fn row p ulong q ulong hdr ulong to void 574 a = add p 1 575 b = trime a q 576 if gt b a 577 if eq get fb sub b 1 124 578 b = sub b 1 579 end 580 end 581 outs t_tr 582 s = a 583 c = ulong 0 584 x = a 585 while lt x b bound 4096 586 y = get fb x 587 if eq y 96 588 c = xor c 1 589 end 590 if and eq y 124 eq c 0 591 cell s x hdr 592 s = add x 1 593 end 594 x = add x 1 595 end 596 cell s b hdr 597 outs t_etr 598 end 599 600 fn mdclose mode ulong to void 601 if eq mode 1 602 outs t_ep 603 end 604 if eq mode 2 605 outs t_eul 606 end 607 if eq mode 3 608 outs t_etab 609 end 610 if eq mode 4 611 outs t_epre 612 end 613 end 614 615 note mdline: one guide line in state mode (0 none, 1 paragraph, 2 list, 3 table, 4 fence) 616 fn mdline p ulong q ulong mode ulong to ulong 617 if eq mode 4 618 if sw p q t_fence 619 outs t_epre 620 ret 0 621 end 622 if and eq sub q p len t_ghcl sw p q t_ghcl 623 escs t_rdcl 624 else 625 escfb p q 626 end 627 putb 10 628 ret 4 629 end 630 if sw p q t_fence 631 mdclose mode 632 outs t_pre 633 ret 4 634 end 635 if eq p q 636 mdclose mode 637 ret 0 638 end 639 if sw p q t_h3 640 mdclose mode 641 head p q 3 642 ret 0 643 end 644 if sw p q t_h2 645 mdclose mode 646 head p q 2 647 ret 0 648 end 649 if sw p q t_h1 650 mdclose mode 651 head p q 1 652 ret 0 653 end 654 if sw p q t_li 655 if eq mode 2 656 outs t_eli 657 else 658 mdclose mode 659 outs t_ul 660 end 661 outs t_lio 662 inl add p 2 q 663 ret 2 664 end 665 if and eq mode 2 sw p q t_two 666 putb 10 667 inl add p 2 q 668 ret 2 669 end 670 if sw p q t_bar 671 if sw p q t_sep 672 ret 3 673 end 674 if eq mode 3 675 row p q 0 676 ret 3 677 end 678 mdclose mode 679 outs t_tab 680 row p q 1 681 ret 3 682 end 683 if eq mode 1 684 putb 10 685 else 686 mdclose mode 687 outs t_p 688 end 689 inl p q 690 ret 1 691 end 692 693 fn skipfm e ulong to ulong 694 if sw 0 e t_fm 695 p = ulong 4 696 while lt p e bound 100000 697 q = eol p e 698 if eq sub q p 3 699 if sw p q t_dash3 700 ret add q 1 701 end 702 end 703 p = add q 1 704 end 705 end 706 ret 0 707 end 708 709 fn guide to void 710 put st 4 0 711 pbadd t_vend 712 pbadd t_skill 713 n = slurp 714 if lt n 0 715 exit 97 716 end 717 e = ulong n 718 p = skipfm e 719 mode = ulong 0 720 while lt p e bound 100000 721 q = eol p e 722 mode = mdline p q mode 723 p = add q 1 724 end 725 mdclose mode 726 if ne get st 5 0 727 exit 97 728 end 729 end 730 731 fn hexd v uchar to uchar 732 if lt v 10 733 ret add v 48 734 end 735 ret add v 87 736 end 737 738 fn hexout n ulong to void 739 for i ulong n 740 b = get fb i 741 putb hexd shr b 4 742 putb hexd and b 15 743 j = add i 1 744 if eq rem j 16 0 745 putb 10 746 else 747 if lt j n 748 putb 32 749 end 750 end 751 end 752 if ne rem n 16 0 753 putb 10 754 end 755 end 756 757 note kind: 0 text ending in a newline, 1 text without one, 2 bytes to show in hex 758 fn kind n ulong to ulong 759 vis = ulong 0 760 for i ulong n 761 b = get fb i 762 if gt b 126 763 ret 2 764 end 765 if lt b 32 766 if and ne b 9 ne b 10 767 ret 2 768 end 769 end 770 if gt b 32 771 vis = ulong 1 772 end 773 end 774 if eq vis 0 775 ret 2 776 end 777 if eq get fb sub n 1 10 778 ret 0 779 end 780 ret 1 781 end 782 783 note efile: pb holds vendor/STEM; print STEM plus x when that file exists 784 fn efile x view uchar * to void 785 put st 4 get st 6 786 pbadd x 787 r = slurp 788 if lt r 0 789 ret 790 end 791 n = ulong r 792 outs t_lab1 793 e = get st 4 794 for i ulong sub e 7 795 esc get pb add i 7 796 end 797 outs t_lab2 798 if eq n 0 799 outs t_empty 800 ret 801 end 802 k = kind n 803 if eq k 2 804 outs t_hexl 805 hexout n 806 outs t_epre 807 ret 808 end 809 if eq k 1 810 outs t_nonl 811 else 812 outs t_endp 813 end 814 escfb 0 n 815 outs t_epre 816 end 817 818 fn example a ulong q ulong to void 819 s = sub q 3 820 nb = a 821 x = a 822 while lt x s bound 512 823 if eq get mb x 47 824 nb = add x 1 825 end 826 x = add x 1 827 end 828 outs t_art1 829 escmb nb s 830 outs t_art2 831 escmb nb s 832 outs t_art3 833 put st 4 0 834 pbadd t_vend 835 pbmb a s 836 put st 6 get st 4 837 efile t_om 838 efile t_exp 839 efile t_sin 840 efile t_arg 841 efile t_env 842 efile t_out 843 outs t_eart 844 end 845 846 fn examples to void 847 m = get st 2 848 p = ulong 0 849 while lt p m bound 4096 850 q = meol p m 851 if isprog p q 852 example add p 66 q 853 end 854 p = add q 1 855 end 856 end 857 858 fn main to int 859 loadpin 860 loadman 861 c = nprogs 862 if eq c 0 863 exit 96 864 end 865 outs t_top1 866 outdec c 867 outs t_top2 868 outs t_top3 869 outcm 870 outs t_top4 871 outcm 872 outs t_top5 873 guide 874 outs t_mid1 875 outdec c 876 outs t_mid2 877 examples 878 outs t_end1 879 put st 4 0 880 pbadd t_vend 881 pbadd t_gate 882 put st 6 get st 4 883 efile t_dotsh 884 outs t_end2 885 oflush 886 ret 0 887 end