Two lessons from writing the own BPE tokenizer of Omega LLM (aien-dev/aien-train branch feat/ollm-own-bpe). The pin is omega-mv e5b32567 (omc sha256 2c824805…). The writing-omega skill does not state either one yet.
1. A global is visible only after its line
The skill says this for const (section 4) but not for global. If a concatenated program uses a global in a unit that comes before the global's declaration, omc fails with error 3, even though functions may be referenced forward.
Reproduced through omega MCP run at the pin:
fn main to int/put g 0 uchar 7/ret int get g 0/end/global g uchar 4givesomc: line 2: error 3.- The same lines with the
globalline first compile and exit 7. This is the control.
Proposed guide line, for section 4 and the mistakes table: "A global is visible only after its line (error 3). In a multi-unit build, order the units so each global's declaration comes before its first use."
2. Wrapping a while in a for does not add capacity
The pattern for o T K around while COND bound 999999 does not raise the limit to K × 999999 unless the while also counts its own passes and stops below the bound. The bound applies to each run of the while. A run that needs more passes traps 4 (exit 104) on the first outer pass.
Reproduced at the pin:
n = uint 5,for o uint 3,while gt n 0 bound 3,n = sub n 1traps with exit 104.- Adding
q = uint 0before thewhile,and gt n 0 lt q 3as the condition, andq = add q 1in the body exits 0. This is the control.
Proposed guide line, for section 6: "To run more than N passes, put the bound guard in the condition (while and C lt q N bound N), reset q on each outer pass, and loop on the outer for. A for around a while without such a counter adds nothing."
Two functions in aien-dev/aien-train native/omegallm/bpe.om at main ac4a7c1 use the unguarded pattern:
bpsel:for o ulong 3aroundwhile gt get bqst 8 0 bound 999999.bpwalk:for o ulong 5aroundwhile gt nd 0 bound 999999.
Each one is limited to 999999 passes per call, not 3 × or 5 × that. It traps only if one heap pop sequence or one pair's type list goes past 999999. That case has not been reproduced, so it is a latent limit and not an observed failure.
Not done: the skill files were not edited. This issue is the guide update.