omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / src / osh / osh_layout.lst
| 1 | # osh workspace layout: the one list every accessor is generated from (osh_gen.sh). |
| 2 | # Format: NAME VALUE (decimal; text after '#' is a comment). Cells are u64. |
| 3 | # Region numbers are fixed by OSH_PLATFORM_ABI.md section 6.1 (aien-protocols PR #16, v1 DRAFT); |
| 4 | # session cells 0..11 by section 6.2; 12..47 are core-internal and are assigned here. |
| 5 | |
| 6 | # --- ABI constants (section 3, 5, 6) --- |
| 7 | ABI_MAGIC 1330858071 # 0x4F534857 "OSHW" |
| 8 | ABI_VERSION 1 |
| 9 | WS_CELLS 11456 # exact workspace size in cells |
| 10 | LINE_CAP 4096 # CAP_LINE: bytes of buffered input |
| 11 | TOKEN_CAP 128 # CAP_TOKENS |
| 12 | LEX_BUDGET 1024 # input bytes per lex_run call |
| 13 | |
| 14 | # --- regions (section 6.1) --- |
| 15 | SESSION 0 |
| 16 | TOKENS 64 |
| 17 | CMDS 576 |
| 18 | PIPES 832 |
| 19 | STAGING 896 |
| 20 | REQUEST 1928 |
| 21 | OUT 3264 |
| 22 | |
| 23 | # --- session cells (section 6.2) --- |
| 24 | S_MAGIC 0 |
| 25 | S_VERSION 1 |
| 26 | S_PHASE 2 # 0 active, 255 terminal error |
| 27 | S_LAST_STATUS 3 # adapter-owned ($?); the lexer never touches it |
| 28 | S_ERR_CODE 4 |
| 29 | S_ERR_OFF 5 |
| 30 | S_CURSOR 6 # next input byte to lex |
| 31 | S_WS_CELLS 7 |
| 32 | S_RESERVED 48 # 48..63 must be zero in v1 |
| 33 | |
| 34 | # --- lexer-internal session cells (12..47) --- |
| 35 | LX_STATE 12 # state machine state (osh_lex.osc.in) |
| 36 | LX_WS 13 # start offset of the word or operator in progress |
| 37 | LX_WFLAGS 14 # token flags gathered for the word in progress |
| 38 | LX_NAMEOK 15 # word so far is a valid NAME |
| 39 | LX_EQPOS 16 # offset+1 of the '=' of a NAME= word, else 0 |
| 40 | LX_NTOK 17 # tokens written |
| 41 | LX_LINE 18 # newlines consumed (line number minus 1) |
| 42 | LX_WLINE 19 # line number (1-based) where the word started |
| 43 | LX_NSEG 20 # quoted segments in the word |
| 44 | LX_ALLDIG 21 # word so far is all digits |
| 45 | LX_MID 22 # 1 while the last byte did not complete a line |
| 46 | LX_BRD 23 # open unquoted `{` count in the word (brace expansion detector) |
| 47 | LX_BRM 24 # bit d set: the open brace at depth d has an unquoted `,` or `..` directly inside |
| 48 | LX_PDOT 25 # the last byte was an unquoted plain `.` in the word |
| 49 | LX_BRN 26 # ${...} name: 0 none/alpha start, 1 digits so far (one digit) |
| 50 | LX_DONE 27 # 1 when the last lex_run returned PHASE_DONE (the parser requires it) |
| 51 | S_EOI 28 # end of input: written by the host (0 or 1); 1 = no more bytes will be appended; a final `\` is then a literal |
| 52 | LX_CONT 29 # 1 after a `\` that starts a backslash-newline pair; the next byte (the newline) is swallowed |
| 53 | LX_PREV 30 # the last significant byte (a swallowed `\<nl>` pair does not count) |
| 54 | LX_PO 31 # offset of LX_PREV |
| 55 | LX_PLUS 32 # 1 when the last significant byte was a `+` right after a valid NAME (append-assignment detector) |
| 56 | LX_USC 33 # offset+1 of a `_` that is the whole name after `$` or `${` (the `$_` special parameter), else 0 |
| 57 | |
| 58 | # --- parser-internal session cells (osh_parse.osc.in) --- |
| 59 | PX_STATE 34 # 0 FRESH 1 AFTER_OP 2 IN_CMD 3 NEED_TARGET 4 DONE |
| 60 | PX_TOK 35 # next token index to parse |
| 61 | PX_NCMD 36 # command entries written |
| 62 | PX_NPIPE 37 # pipeline entries written |
| 63 | PX_PCMDS 38 # commands in the open pipeline |
| 64 | PX_ANYW 39 # 1 once the current command has a non-assignment word |
| 65 | PX_RKIND 40 # token kind of the redirection operator awaiting its target |
| 66 | |
| 67 | # --- parser capacities (E-parser-design.md section 5, ABI 5.3) --- |
| 68 | CAP_CMDS 32 |
| 69 | CAP_PIPES 16 |
| 70 | CAP_PIPE_LEN 8 |
| 71 | CAP_WORDS 32 |
| 72 | CAP_ASSIGNS 16 |
| 73 | CAP_REDIRS 8 |
| 74 | PARSE_BUDGET 64 # tokens per parse_run call |
| 75 | |
| 76 | # --- variable request cells (ABI section 6.2 cells 8..11) --- |
| 77 | S_VR_KIND 8 # 1 NAME, 2 $?, 3 positional, 4 $#, 5 positional list (npos only) |
| 78 | S_VR_A 9 # NAME: offset in inp; positional: k |
| 79 | S_VR_LEN 10 # NAME: length |
| 80 | S_VR_SEQ 11 # counts requests |
| 81 | |
| 82 | # --- expander capacities and constants (E-parser-design.md section 5, ABI 5.3, 7.1) --- |
| 83 | CAP_FIELDS 32 # argv entries per command after splitting |
| 84 | CAP_OUT 8192 # expanded bytes per pipeline |
| 85 | CAP_VALUE 1024 # one variable value |
| 86 | CAP_VARREQ 64 # variable requests per pipeline |
| 87 | EXP_BUDGET 1024 # expander steps (one raw byte or one value byte each) per call |
| 88 | REC_MAGIC 1330791761 # 0x4F524551 "OREQ" |
| 89 | REQ_CMD_CELLS 164 |
| 90 | |
| 91 | # --- expander cells (osh_expand.osc.in). 41..47 are fresh; 12..16, 18..26 and 29..33 (the lexer's continuation and |
| 92 | # --- append-assignment cells) are lexer cells that are dead |
| 93 | # --- once the parser has completed the list (the session is single use after that), so expand_run zeroes and reuses them. |
| 94 | EX_INIT 41 # 1 after the first expand_run call zeroed the overlay cells |
| 95 | EX_ST 29 # 0 pick next pipeline, 1 expanding, 2 PIPELINE_READY returned, 3 list complete |
| 96 | EX_PIPE 30 # pipeline index being expanded |
| 97 | EX_CMD 31 # command index inside the pipeline |
| 98 | EX_TOK 32 # token cursor (the word token while a word is open) |
| 99 | EX_NVREQ 33 # variable requests in this pipeline |
| 100 | EX_OUT 42 # OUT bytes used |
| 101 | EX_ANYW 43 # offset+1 of the first non-assignment word of this command, 0 before it |
| 102 | EX_A0 44 # input offset of the word that produced argv[0] |
| 103 | EX_WM 45 # word mode: 0 none, 1 argv, 2 assignment value, 3 redirection target |
| 104 | EX_PH 46 # 0 raw scan, 1 copying a value, 2 waiting for the host's answer |
| 105 | EX_POS 47 # raw cursor in inp |
| 106 | EX_Q 12 # 0 unquoted, 1 inside '', 2 inside "" |
| 107 | EX_FOPEN 13 # a field is open |
| 108 | EX_FSTART 14 # OUT offset where the open field began |
| 109 | EX_DQF 15 # inside "": bit 0 saw $@, bit 1 saw anything else |
| 110 | EX_WNF 16 # fields closed by the redirection target word |
| 111 | EX_NEXT 18 # raw cursor after the reference being resolved |
| 112 | EX_VCUR 19 # absolute cell of the next value byte |
| 113 | EX_VEND 20 # absolute cell after the last value byte |
| 114 | EX_VM 21 # 1 split the value at IFS bytes (unquoted), 0 copy it |
| 115 | EX_RK 22 # reference: 1 NAME 2 $? 3 positional 4 $# ; lists 5 split 6 joined 7 one field each |
| 116 | EX_K 23 # list: positional being copied |
| 117 | EX_NPOS 24 # list: positional count |
| 118 | S_NOSKIP 25 # host-written before the first expand_run: 1 = emit every pipeline (no connector skipping; conformance vectors) |