From c2dc6d4da1cc750379b546ba923cc5a05cbdef4a Mon Sep 17 00:00:00 2001 From: Orual Date: Sun, 1 Mar 2026 13:53:46 -0500 Subject: [PATCH] fixes and grammar updates --- asm/builtins.py | 7 +- design-notes/OR-1 Design.md | 48 +- design-notes/design-alternatives.md | 34 +- design-notes/flow-control.excalidraw.md | 126 ++ .../loop-patterns-and-flow-control.md | 110 +- dfasm.lark | 4 +- editor/obsidian/dfasm.tmLanguage.json | 8 +- editor/sublime/dfasm.sublime-syntax | 2 +- editor/textmate/dfasm.tmLanguage.json | 8 +- editor/tree-sitter-dfasm/grammar.js | 278 ++-- editor/tree-sitter-dfasm/package-lock.json | 2 +- editor/tree-sitter-dfasm/package.json | 5 +- editor/tree-sitter-dfasm/src/grammar.json | 26 +- editor/tree-sitter-dfasm/src/node-types.json | 28 +- editor/tree-sitter-dfasm/src/parser.c | 1117 ++++++++--------- .../tree-sitter-dfasm/tree-sitter-dfasm.wasm | Bin 25611 -> 0 bytes examples/fib_recursion.dfasm | 36 + tests/test_builtins.py | 85 +- 18 files changed, 1005 insertions(+), 919 deletions(-) create mode 100644 design-notes/flow-control.excalidraw.md delete mode 100755 editor/tree-sitter-dfasm/tree-sitter-dfasm.wasm create mode 100644 examples/fib_recursion.dfasm diff --git a/asm/builtins.py b/asm/builtins.py index c2e18f2..8aa51f4 100644 --- a/asm/builtins.py +++ b/asm/builtins.py @@ -47,11 +47,12 @@ BUILTIN_MACROS = """\ ; --- Permit injection (variadic) --- ; Injects one const(1) seed token per target. -; Call with: #permit_inject &gate_a, &gate_b, &gate_c +; Call with: #permit_inject &gate_a, &gate_b, &gate_c |> @a, @b, @c #permit_inject *targets |> { $( &p <| const, 1 - &p |> ${targets} + ${targets} |> &p + &p |> @ret ),* } @@ -83,7 +84,7 @@ BUILTIN_MACROS = """\ """ # Count newlines in BUILTIN_MACROS for line number offset calculation -_BUILTIN_LINE_COUNT: int = BUILTIN_MACROS.count('\n') +_BUILTIN_LINE_COUNT: int = BUILTIN_MACROS.count("\n") __all__ = [ "BUILTIN_MACROS", diff --git a/design-notes/OR-1 Design.md b/design-notes/OR-1 Design.md index b1093ec..838a8e6 100644 --- a/design-notes/OR-1 Design.md +++ b/design-notes/OR-1 Design.md @@ -60,8 +60,52 @@ The contents of the reset vector, after the length, contain the raw tokens requi ### Dynamic scheduling -The OR-1 is, for a number of reasons, a mostly *static* dataflow machine. The way instructions are routed is built in to the instructions and tokens themselves. There's no dynamic load balancing inherent to the machine, as that would add a nontrivial amount of additional logic. There are of course a few escapes for this. One is `exec`, which reads out memory directly as tokens, and the closely related `iram_write`, which replaces the contents of a cell in instruction memory. Another, not yet implemented, is `mkpkt`, which creates an arbitrary packet from two operands. +The OR-1 is, for a number of reasons, a mostly *static* dataflow machine. The way instructions are routed is built in to the instructions and tokens themselves. There's no dynamic load balancing inherent to it, due to the lack of control unit, as that would add a nontrivial amount of additional logic. There are of course a few escapes for this. One is `exec`, which reads out memory directly as tokens, and the closely related `iram_write`, which replaces the contents of a word in instruction memory. `ctx_override` options on existing compatible instructions can jump betweeen slots. A planned `change_tag` instruction would allow explicit token creation based on a data value, with `extract_tag` capturing the executing token's context info. call descriptor tables in SM and an SM cell service as ref counter can dynamically schedule arbitrary code, albeit with overhead. The main barrier to going *fully* dynamic this way is simply the, um, challenges of doing runtime code generation on this small a machine, though it's certainly *possible* to write a small runtime capable of it, potentially enough to implement something like BASIC. If it is possible to port a version of the dfasm assembler to run on it, then I will have succeeded beyond my wildest dreams. + +That being said, *loading* code dynamically goes a long, long way, and staging it in structure memory allows rewriting of specific fields as necessary, it's just a high overhead operation you must explicitly *do*. This *is* one of the major contraints of the architecture. Executing directly from ROM just does *not* work well with each PE requiring its own miniature address bus. It either introduces a severe bottleneck, requires significant fanout and arbitration (and likely caching!) logic, or all of the above. The benefit is that you get a wildly efficient machine outside of that. ### Function calls -While obviously the `exec` instruction can effectively "call" a function, that is a high-overhead operation. Optimized code interleaves IRAM writes following `free_ctx` operations. \ No newline at end of file +While obviously the `exec` instruction can effectively "call" a function, that is, as described, a high-overhead operation. Optimized code interleaves IRAM writes or judicious `exec` calls following `free_ctx` operations, or preloads and uses bank switching, if that hardware makes it in. + +Passing arguments to a function requires setting the destination context to match the correct context for the function call. If there is only one call site, then the return instruction is effectively baked into the code already, setting the context appropriately. However, for multiple call sites, this gets more complex. `change_tag` simplifies a lot, here, but if not, a return trampoline (essentially a `pass` instruction with a `ctx_override`) can be placed in IRAM for each call site. Furthermore, context slots are a cap on *simultaneous* calls in flight (e.g. recursion). Clever multiplexing of context slots within a code section for repeated operations can greatly reduce IRAM usage if that is the primary constraint. + +```dfasm +; Function definition: +$add_pair |> { + add &a, &b |> @ret +} + +; Static call: named args wire to internal labels: +$add_pair a=&x, b=&y |> @output +``` + +dfasm's assembler handles some but not all of this. It will override context as needed and wire up arguments to function or macro parameters as shown above, add trampolines, and route returns to the correct nodes. However it will *not* preload code. Code beyond what can be loaded at bootstrap must be loaded explicitly. + +Assuming the `extract_tag` and `change_tag` instructions are available, here is what you need to set up a dynamic recursive call. + +1. A call stub in IRAM for the function. You need more or less $2 + 2n$ IRAM slots, where N is the number of parameters. +2. In ROM or elsewhere in structure memory, $n$ `read_c` tokens providing argument and return tag templates for `change_tag` +3. Per call site, instructions to allocate the callee context, `exec` the call sequence, and capture the tag for return + +Call stubs can be parameterized by `exec` target and descriptor shape and the addresses loaded from structure memory, effectively creating a vtable. Functions with many arguments, or which take larger data structures as arguments, can have their arguments passed via structure memory. Args get written to allocated cells for the call frame, and then the caller runs `exec` on the call sequence, which can load the entire function, including the saved arguments. If the function is infrequently called or not latency sensitive on initial invocation, the exec sequence can handle all of the required setup. + +Built-in macros will ease this as they are developed. + +#### Loops and flow control + +Dataflow machines require thinking about iteration in odd ways, and the OR-1 is no exception. Perhaps the *strangest* feature is how, depending on the data dependencies involved, multiple parts of an iterative process can be partially complete at the same time, traversing through the pipeline *extremely* tightly packed, even on a single PE without strongly-connected blocks. A "for each" or "map" where no accumulation happens can essentially proceed through the pipeline as fast as the amount of parallel context allocated will allow and as much as the code required is replicated across PEs (or designed in such a way as to spread the work across them correctly). + +The initial iterator, if it completes faster than the body, will leave multiple iterations in progress, waiting on their data dependencies. To avoid deadlocks and context slot exhaustion, some means of flow control is required. The typical method is to use **permit tokens**. These circulate through the system after loop initialization. The token will be a `const` instruction resident in IRAM, and any token directed to its address will trigger its emission. + +```dfasm +; Permit-gated dispatch +&gate <| gate ; dyadic: L=permit, R=dispatch data +&loop_output |> &gate:R ; loop control feeds data to gate + +; Body completion recycles the permit +&body_done |> &gate:L ; body's final instruction returns permit +``` + +![[flow-control.excalidraw]] + diff --git a/design-notes/design-alternatives.md b/design-notes/design-alternatives.md index 11fb91b..fbd5ac0 100644 --- a/design-notes/design-alternatives.md +++ b/design-notes/design-alternatives.md @@ -515,4 +515,36 @@ are not a good fit for matching store overflow. - Very speculative. would require significant additional hardware (tag memory, eviction logic, demand-fetch state machine). probably not worth it for v0-v4. but the writable instruction memory path means - the hardware foundation exists. \ No newline at end of file + the hardware foundation exists. + +### ROM-Mapped IRAM Banks (Execute in Place) +- The '610 memory mapper doesn't care whether the physical backing + store is SRAM or ROM. Some logical IRAM banks could map to shared + ROM (parallel EPROM/flash on the address bus) instead of per-PE + SRAM. Shared library code lives in ROM once, every PE fetches from + it directly — no bootstrap loading needed for that code. +- **Appeal**: standard library or runtime support code is + write-once/read-many. ROM-mapping avoids loading it into every PE's + SRAM at bootstrap time and frees those SRAM banks for user code. +- **Timing mismatch**: parallel ROMs of the era (27C256, AT28C256) + run 150-250ns access time. if IRAM SRAM is at the fast end + (~55-100ns), ROM-banked fetches need wait states — 3-4 cycles + instead of the normal 2-cycle two-half read. the PE pipeline would + need to stall differently depending on which bank is active. + Solvable with wait-state insertion keyed to the active bank's + backing store type (ROM vs SRAM flag per '610 mapping entry, or a + separate register). +- **Fan-out**: each PE has its own IRAM data bus. sharing a single + ROM across PEs requires either multiplexed access (contention, + arbitration) or ROM per PE (defeats the sharing benefit). on a + shared bus this is less of an issue, but with per-PE IRAM buses + it's a real constraint. +- **Write protection**: IRAM write tokens targeting a ROM-backed bank + must be rejected or ignored. needs write-protect logic per bank + mapping (a flag bit in the '610 mapping register or a separate + WP register). +- **Status**: back-burner. the bootstrap EXEC approach handles v0 + fine. ROM-mapped banks become interesting at scale where bootstrap + loading time or SRAM capacity per PE is a real constraint. the + '610 infrastructure makes it a relatively cheap upgrade path if + the timing issues are solved. \ No newline at end of file diff --git a/design-notes/flow-control.excalidraw.md b/design-notes/flow-control.excalidraw.md new file mode 100644 index 0000000..6d9625d --- /dev/null +++ b/design-notes/flow-control.excalidraw.md @@ -0,0 +1,126 @@ +--- + +excalidraw-plugin: parsed +tags: [excalidraw] + +--- +==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠== You can decompress Drawing data with the command palette: 'Decompress current Excalidraw file'. For more info check in plugin settings under 'Saving' + + +# Excalidraw Data + +## Text Elements +GATE ^EELxmlez + +body ^vG36SAlQ + +dispatch to body ctx ^blVFF3vx + +on completion ^bRp3gzOJ + +emit permit token ^cyJehuEj + +inject K permits at init ^mHrSfMnu + +dispatch data ^DQHBza7V + +acc +or +ctrl flow ^HCkm2Xnr + +condition ^wiBkjCjS + +%% +## Drawing +```compressed-json +N4KAkARALgngDgUwgLgAQQQDwMYEMA2AlgCYBOuA7hADTgQBuCpAzoQPYB2KqATLZMzYBXUtiRoIACyhQ4zZAHoFAc0JRJQgEYA6bGwC2CgF7N6hbEcK4OCtptbErHALRY8RMpWdx8Q1TdIEfARcZgRmBShcZQUebQBGADYEmjoghH0EDihmbgBtcDBQMBKIEm4IIQAlACEAawoACQArUgA1BAB1AEkAGQAOAHFBxPwqgGUARVSSyFhECqCiOSR+ + +UsxuZ36ATm0AVjXIGE29/r2EgBYABkSeA8LIChJ1bnirgGZDqQRCZWlXq7xbTbEGgsFgr7WZTBbhXL7MKCkNh1BAAYTY+DYpAqAGJ4gh8fiZqVNLhsHVlEihBxiOjMdiJIjrMw4LhAt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XK+YQks41SbhansXbJQkE0sbuN+gfSComI3qh3q4obAEiD5CJYE8J/ZOAZqM1LIAQ60Z/I1D+zmajAbAAwC3IYAEBF4rwP4pJuE3EbLJumPGTSBfWUgSAtak+heqC3EABQCARFuZvC1YQikCAGTbgHSYfLdJJAGAnvBqAYgD4oGUkAAApswJYXgF2GoBFbCti0PYAAEoxQM8ZQH6DZAVActuAfLTihK0sNWtLW0sfsCq2eahN3bPBFRpEXBq+ + +cPlY1DPCDB9xJu4tA9MltTUrrINywZxT6IVAHpj1GypbaX0ngrxFtfVfQGyBRCkAGwxqbbV8F21nqmAiWmbdts812BnervZgOMAPQ/t4tF24ILFKrUFxGAnsJzfgBc2fwwgwQV3vYow0IgDAKm05IWtt78KDJBgcYOkEB2S5i1bgvtIDs+3fbc0mUcAIxBmK8hwgPRdyMmCAA=== +``` +%% \ No newline at end of file diff --git a/design-notes/loop-patterns-and-flow-control.md b/design-notes/loop-patterns-and-flow-control.md index 1bfffa5..2d3ea1d 100644 --- a/design-notes/loop-patterns-and-flow-control.md +++ b/design-notes/loop-patterns-and-flow-control.md @@ -6,7 +6,7 @@ from existing hardware primitives — no dedicated loop hardware exists. Most patterns described here are candidates for **assembler macros**: reusable expansions that emit the underlying instruction sequences. -The programmer writes `LOOP_COUNTED(counter, limit, body_label)` and +The programmer writes `#loop_counted counter, limit, body_label` and the assembler expands it into the token feedback arcs, SWITCH routing, and permit structures described below. @@ -28,18 +28,18 @@ each time a token completes the feedback circuit. ``` graph: - CONST(0) ─────────────────────────────────┐ + CONST(0) ──────────────────────────────────┐ │ ┌───────────────────────────────────────────┤ - │ ▼ - │ ┌─────┐ ┌──────────┐ ┌────────────────┐ + │ V + │ ┌─────┐ ┌──────────┐ ┌────────────────┐ └─►│ INC │────►│ LT limit │────►│ SWITCH │ - └─────┘ └──────────┘ │ true → body │ - ▲ i+1 bool │ false → exit │ - │ └────────┬───────┘ - │ data (i+1) to body ◄──────┘ - │ │ - └── i+1 fed back (same token) ──────┘ + └─────┘ └──────────┘ │ true → body │ + ▲ i+1 bool │ false → exit │ + │ └────────┬───────┘ + │ data (i+1) to body ◄────────┘ + │ │ + └── i+1 fed back (same token) ─────────┘ ``` Instructions (all on same PE, same context): @@ -156,7 +156,7 @@ the GATE. Options: entry token via fan-out. Burns K IRAM slots but is simple. - **SM EXEC:** pre-load K permit tokens in SM, EXEC emits them. Uses one IRAM slot for the EXEC trigger. Better for large K. -- **Assembler macro:** `PERMITS(K, gate_offset)` expands to the +- **Assembler macro:** `#permit_inject *args` expands to the appropriate injection sequence. ### Assembler Macro Sketch @@ -408,7 +408,7 @@ $add_pair |> { $add_pair a=&x, b=&y |> @output ``` -`#ret` is a built-in macro that marks the function's return point. +`@ret` is a built-in pseudo-node that marks the function's return point. The assembler resolves `a=&x` to mean "wire `&x`'s output to `$add_pair.&a`, port L, with ctx_mode=01 and the allocator-assigned context slot." The `|> @output` wires the return point to `@output`. @@ -563,7 +563,7 @@ $fib |> { &n |> &test:L ; base case - &test:L |> #ret + &test:L |> @ret ; recursive case sub &n, 1 |> &n1 @@ -587,7 +587,7 @@ $fib |> { &n2 |> &__fib_ct_n:R ; reduction - add &r1, &r2 |> #ret ; r1 at offset 20, r2 at offset 21 + add &r1, &r2 |> @ret ; r1 at offset 20, r2 at offset 21 } ``` @@ -743,67 +743,7 @@ The caller just writes args to SM and fires EXEC. The function loads, receives its arguments, runs, sends results, done. --- - -### Macro System Requirements - -The call macros above need the following from the macro system. -All of these are within the capability of rust-style `macro_rules!` -or a purpose-built assembler template system. No conditionals, no -recursion in the macro evaluator, no type system. - -> **Implementation status:** All five requirements below are now -> implemented in the `asm/expand.py` pass. The implemented syntax -> differs from the Rust-style examples in this section — see -> `dfasm-primer.md` for the canonical syntax reference. - -#### 1. Named Variadic Repetition - -**Implemented.** Variadic parameters use `*name` in the macro -definition. Repetition blocks use `$( ... ),*` syntax -(`IRRepetitionBlock` in the IR). Each iteration binds the variadic -parameter to the current element. - -#### 2. Token Pasting (Label Synthesis) - -**Implemented.** `ParamRef` supports `prefix` and `suffix` fields -for token pasting. Within a macro body, `&${name}_tag` produces -labels incorporating the parameter value. Unique labels per -repetition entry are generated automatically. - -#### 3. Implicit Repetition Index - -**Implemented.** `${_idx}` is bound to the current iteration index -(0-based) within `$(...),*` expansion blocks. Used for descriptor -table offset arithmetic and generating unique per-iteration names. - -#### 4. Constant Arithmetic in Expressions - -**Implemented.** `ConstExpr` in `ir.py` supports compile-time `+`, -`-`, `*` on integer values and parameter references. Expressions like -`${base} + ${_idx} + 1` are evaluated during macro expansion. - -#### 5. Label Reference Across Macro Boundaries - -**Implemented via scoped naming.** Expanded macro names are -automatically qualified with scope prefixes (`#macroname_N.&label` -for top-level, `$func.#macro_N.&label` inside functions). Cross-macro -references use these qualified names. The expand pass also handles -function call wiring via `CallSite` metadata, which generates -cross-context edges and trampoline nodes automatically. - -#### What's NOT Needed (still true) - -- **Conditional expansion** — different call shapes get different - macros, not `if` inside a macro. -- **Recursive macro expansion** — macros CAN invoke other macros - (nested expansion with depth limit of 32). Per-arity variants are - provided for the built-ins for simplicity, not due to a limitation. -- **Type checking** — the assembler validates after expansion (wrong - arity, missing labels, offset overflow). The macro doesn't check. -- **Hygiene** — scoped naming (`#macroname_N.&label`) prevents - collisions between multiple invocations of the same macro. - -#### Built-in Macros +## Built-in Macros The assembler ships built-in macros (prepended to every program) that implement common patterns from this document: @@ -965,7 +905,7 @@ and `exit` as `@ret` outputs: ### Reduction Tree Macro ```dfasm -$reduce_tree &op, &inputs[], &output |> { +#reduce_tree &op, &inputs[], &output |> { ; expands to ceil(log2(N)) levels of binary &op instructions ; N inferred from length of &inputs[] ; &output receives the final reduced value @@ -989,7 +929,7 @@ $body |> { &acc <| add &acc |> &acc:L ; feedback: acc recirculates ; &i arrives as input, feeds &acc:R - ; &acc drains to #ret on completion + ; &acc drains to @ret on completion } ; Loop control @@ -1016,14 +956,14 @@ $body i=&gate |> &partial ## Pattern Cost Summary -| Pattern | HW cost | IRAM slots | Iterations/cycle | Parallel? | -|---------|---------|------------|-------------------|-----------| -| Self-loop accumulator | 0 | 1 (the ADD) | ~1/8 (bus RT) | yes (per-ctx) | -| Permit-token throttle | 0 | K+2 (permits + GATE) | K in flight | yes | -| Counted loop control | 0 | 4 (CONST+INC+LT+SWITCH) | ~1/8 (bus RT) | no (sequential) | -| Binary reduction tree | 0 | K-1 (one per ADD) | log2(K) levels | yes | -| Predicate register | ~1 chip | +1 bit/instr | saves ~4 cycles/iter | no (shared) | -| Accumulator register | ~3 chips | 1 (ACC_ADD) | ~1/4 (no bus RT) | no (shared) | +| Pattern | HW cost | IRAM slots | Iterations/cycle | Parallel? | +| --------------------- | -------- | ----------------------- | -------------------- | --------------- | +| Self-loop accumulator | 0 | 1 (the ADD) | ~1/8 (bus RT) | yes (per-ctx) | +| Permit-token throttle | 0 | K+2 (permits + GATE) | K in flight | yes | +| Counted loop control | 0 | 4 (CONST+INC+LT+SWITCH) | ~1/8 (bus RT) | no (sequential) | +| Binary reduction tree | 0 | K-1 (one per ADD) | log2(K) levels | yes | +| Predicate register | ~1 chip | +1 bit/instr | saves ~4 cycles/iter | no (shared) | +| Accumulator register | ~3 chips | 1 (ACC_ADD) | ~1/4 (no bus RT) | no (shared) | All zero-hardware patterns work with v0. Predicate and accumulator registers are independent future additions that compose with the diff --git a/dfasm.lark b/dfasm.lark index f700bf9..443cd88 100644 --- a/dfasm.lark +++ b/dfasm.lark @@ -148,8 +148,8 @@ OPCODE.2: "add" | "sub" | "inc" | "dec" | "breq" | "brgt" | "brge" | "brof" | "brty" | "sweq" | "swgt" | "swge" | "swof" | "swty" | "gate" | "sel" | "merge" - | "pass" | "const" | "free_ctx" - | "read" | "write" | "clear" | "alloc" | "free" | "rd_inc" | "rd_dec" | "cmp_sw" + | "pass" | "const" | "free_ctx" | "change_tag" | "extract_tag" + | "read" | "write" | "clear" | "exec" | "alloc" | "free" | "rd_inc" | "rd_dec" | "cmp_sw" | "ior" | "iow" | "iorw" | "load_inst" | "route_set" diff --git a/editor/obsidian/dfasm.tmLanguage.json b/editor/obsidian/dfasm.tmLanguage.json index 64c5e06..74aa48d 100644 --- a/editor/obsidian/dfasm.tmLanguage.json +++ b/editor/obsidian/dfasm.tmLanguage.json @@ -1,9 +1,7 @@ { "scopeName": "source.dfasm", "name": "dfasm", - "fileTypes": [ - "dfasm" - ], + "fileTypes": ["dfasm"], "patterns": [ { "match": "(@)([a-zA-Z_][a-zA-Z0-9_]*)(?:(\\|)([a-zA-Z_][a-zA-Z0-9_]*))?(?:(:)([a-zA-Z_][a-zA-Z0-9_]*|0x[0-9a-fA-F]+|[0-9]+))?", @@ -91,7 +89,7 @@ "name": "keyword.operator.flow.in.dfasm" }, { - "match": "\\b(?:(?:add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|route_set))\\b", + "match": "\\b(?:(?:add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|change_tag|extract_tag|exec))\\b", "name": "support.function.opcode.dfasm" }, { @@ -255,4 +253,4 @@ } ], "repository": {} -} \ No newline at end of file +} diff --git a/editor/sublime/dfasm.sublime-syntax b/editor/sublime/dfasm.sublime-syntax index 6a09fce..9e39479 100644 --- a/editor/sublime/dfasm.sublime-syntax +++ b/editor/sublime/dfasm.sublime-syntax @@ -23,7 +23,7 @@ variables: identifier: '[a-zA-Z_][a-zA-Z0-9_]*' hex_lit: '0x[0-9a-fA-F]+' dec_lit: '[0-9]+' - opcodes: 'add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|route_set' + opcodes: 'add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|change_tag|extract_tag|exec' contexts: main: diff --git a/editor/textmate/dfasm.tmLanguage.json b/editor/textmate/dfasm.tmLanguage.json index 64c5e06..74aa48d 100644 --- a/editor/textmate/dfasm.tmLanguage.json +++ b/editor/textmate/dfasm.tmLanguage.json @@ -1,9 +1,7 @@ { "scopeName": "source.dfasm", "name": "dfasm", - "fileTypes": [ - "dfasm" - ], + "fileTypes": ["dfasm"], "patterns": [ { "match": "(@)([a-zA-Z_][a-zA-Z0-9_]*)(?:(\\|)([a-zA-Z_][a-zA-Z0-9_]*))?(?:(:)([a-zA-Z_][a-zA-Z0-9_]*|0x[0-9a-fA-F]+|[0-9]+))?", @@ -91,7 +89,7 @@ "name": "keyword.operator.flow.in.dfasm" }, { - "match": "\\b(?:(?:add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|route_set))\\b", + "match": "\\b(?:(?:add|sub|inc|dec|shiftl|shiftr|ashiftr|and|or|xor|not|eq|lt|lte|gt|gte|breq|brgt|brge|brof|brty|sweq|swgt|swge|swof|swty|gate|sel|merge|pass|const|free_ctx|read|write|clear|alloc|free|rd_inc|rd_dec|cmp_sw|ior|iow|iorw|load_inst|change_tag|extract_tag|exec))\\b", "name": "support.function.opcode.dfasm" }, { @@ -255,4 +253,4 @@ } ], "repository": {} -} \ No newline at end of file +} diff --git a/editor/tree-sitter-dfasm/grammar.js b/editor/tree-sitter-dfasm/grammar.js index 05c0708..f9bcdc1 100644 --- a/editor/tree-sitter-dfasm/grammar.js +++ b/editor/tree-sitter-dfasm/grammar.js @@ -1,114 +1,50 @@ module.exports = grammar({ - name: 'dfasm', + name: "dfasm", - word: $ => $.identifier, + word: ($) => $.identifier, rules: { - program: $ => repeat($._statement), - - _statement: $ => choice( - $.func_def, - $.inst_def, - $.strong_edge, - $.weak_edge, - $.plain_edge, - $.data_def, - $.pragma, - $.location_dir, - ), + program: ($) => repeat($._statement), + + _statement: ($) => + choice($.func_def, $.inst_def, $.strong_edge, $.weak_edge, $.plain_edge, $.data_def, $.pragma, $.location_dir), // ===== Function definition ===== // $name |> { body } - func_def: $ => prec(2, - seq( - $.func_ref, - $.flow_out, - '{', - repeat($._statement), - '}', - ), - ), + func_def: ($) => prec(2, seq($.func_ref, $.flow_out, "{", repeat($._statement), "}")), // ===== Instruction definition (named node) ===== // &label <| opcode [, arg ...] - inst_def: $ => prec(2, - seq( - $.qualified_ref, - $.flow_in, - $.opcode, - repeat(seq(',', $._argument)), - ), - ), + inst_def: ($) => prec(2, seq($.qualified_ref, $.flow_in, $.opcode, repeat(seq(",", $._argument)))), // ===== Strong inline edge (internal route, anonymous node) ===== // opcode input [, input ...] |> output [, output ...] - strong_edge: $ => prec(2, - seq( - $.opcode, - $._argument, - repeat(seq(',', $._argument)), - $.flow_out, - $.ref_list, - ), - ), + strong_edge: ($) => prec(2, seq($.opcode, $._argument, repeat(seq(",", $._argument)), $.flow_out, $.ref_list)), // ===== Weak inline edge (token output, anonymous node) ===== // output [, output ...] opcode <| input [, input ...] - weak_edge: $ => prec(2, - seq( - $.ref_list, - $.opcode, - $.flow_in, - $._argument, - repeat(seq(',', $._argument)), - ), - ), + weak_edge: ($) => prec(2, seq($.ref_list, $.opcode, $.flow_in, $._argument, repeat(seq(",", $._argument)))), // ===== Plain edge (wiring between named nodes) ===== // source |> dest [, dest ...] - plain_edge: $ => prec(2, - seq( - $.qualified_ref, - $.flow_out, - $.ref_list, - ), - ), + plain_edge: ($) => prec(2, seq($.qualified_ref, $.flow_out, $.ref_list)), // ===== Data / initialisation ===== // ref = value | ref = #macro args - data_def: $ => prec(2, - seq( - $.qualified_ref, - '=', - choice($.macro_call, $.value_list), - ), - ), + data_def: ($) => prec(2, seq($.qualified_ref, "=", choice($.macro_call, $.value_list))), // ===== Pragma (system configuration) ===== // @system pe=4, sm=1, iram=128, ctx=2 - pragma: $ => prec(2, - seq( - '@system', - $.system_param, - repeat(seq(',', $.system_param)), - ), - ), + pragma: ($) => prec(2, seq("@system", $.system_param, repeat(seq(",", $.system_param)))), - system_param: $ => seq( - field('name', $.identifier), - '=', - field('value', $.number_literal), - ), + system_param: ($) => seq(field("name", $.identifier), "=", field("value", $.number_literal)), // ===== Location directive (bare qualified ref, no operator) ===== // Sets location context for subsequent definitions. - location_dir: $ => prec(-1, $.qualified_ref), + location_dir: ($) => prec(-1, $.qualified_ref), // ===== Reference list ===== - ref_list: $ => seq( - $.qualified_ref, - repeat(seq(',', $.qualified_ref)), - ), + ref_list: ($) => seq($.qualified_ref, repeat(seq(",", $.qualified_ref))), // ===== Qualified references ===== // Qualifier chain: max one placement (|ident) and one port (:spec). @@ -116,126 +52,118 @@ module.exports = grammar({ // &name — local label reference // $name — function / subgraph reference // Chaining: @sum|pe0:L (placement + port) - qualified_ref: $ => seq( - field('ref', choice($.node_ref, $.label_ref, $.func_ref)), - field('placement', optional($.placement)), - field('port', optional($.port)), - ), + qualified_ref: ($) => + seq( + field("ref", choice($.node_ref, $.label_ref, $.func_ref)), + field("placement", optional($.placement)), + field("port", optional($.port)), + ), - node_ref: $ => seq('@', field('name', $.identifier)), - label_ref: $ => seq('&', field('name', $.identifier)), - func_ref: $ => seq('$', field('name', $.identifier)), + node_ref: ($) => seq("@", field("name", $.identifier)), + label_ref: ($) => seq("&", field("name", $.identifier)), + func_ref: ($) => seq("$", field("name", $.identifier)), - placement: $ => seq(field('separator', token.immediate('|')), field('name', $.identifier)), - port: $ => seq(field('separator', token.immediate(':')), field('name', choice($.identifier, $.number_literal))), + placement: ($) => seq(field("separator", token.immediate("|")), field("name", $.identifier)), + port: ($) => seq(field("separator", token.immediate(":")), field("name", choice($.identifier, $.number_literal))), // ===== Arguments ===== // An argument is a value, a qualified ref, or a named key=value pair. - _argument: $ => choice($.named_arg, $._positional_arg), + _argument: ($) => choice($.named_arg, $._positional_arg), - named_arg: $ => seq( - field('key', $.identifier), - '=', - field('value', $._positional_arg), - ), + named_arg: ($) => seq(field("key", $.identifier), "=", field("value", $._positional_arg)), - _positional_arg: $ => choice($._value, $.qualified_ref), + _positional_arg: ($) => choice($._value, $.qualified_ref), // ===== Values / Literals ===== - _value: $ => choice( - $.number_literal, - $.char_literal, - $.string_literal, - $.raw_string_literal, - $.byte_string_literal, - ), - - value_list: $ => seq( - $._value, - repeat(seq(',', $._value)), - ), - - number_literal: $ => choice( - $.hex_literal, - $.dec_literal, - ), - - hex_literal: $ => token(seq('0x', /[0-9a-fA-F]+/)), - dec_literal: $ => /[0-9]+/, - - char_literal: $ => seq( - "'", - choice( - $.escape_sequence, - /[^'\\]/, - ), - "'", - ), + _value: ($) => + choice($.number_literal, $.char_literal, $.string_literal, $.raw_string_literal, $.byte_string_literal), - string_literal: $ => seq( - '"', - repeat(choice($.escape_sequence, /[^"\\]+/)), - '"', - ), + value_list: ($) => seq($._value, repeat(seq(",", $._value))), - raw_string_literal: $ => seq( - 'r"', - /[^"]*/, - '"', - ), + number_literal: ($) => choice($.hex_literal, $.dec_literal), - byte_string_literal: $ => seq( - 'b"', - repeat(choice($.escape_sequence, /[^"\\]+/)), - '"', - ), + hex_literal: ($) => token(seq("0x", /[0-9a-fA-F]+/)), + dec_literal: ($) => /[0-9]+/, - escape_sequence: $ => /\\([ntr0\\'"]|x[0-9a-fA-F]{2})/, + char_literal: ($) => seq("'", choice($.escape_sequence, /[^'\\]/), "'"), + + string_literal: ($) => seq('"', repeat(choice($.escape_sequence, /[^"\\]+/)), '"'), + + raw_string_literal: ($) => seq('r"', /[^"]*/, '"'), + + byte_string_literal: ($) => seq('b"', repeat(choice($.escape_sequence, /[^"\\]+/)), '"'), + + escape_sequence: ($) => /\\([ntr0\\'"]|x[0-9a-fA-F]{2})/, // ===== Macros ===== // #name arg [arg ...] — expanded in a later pass, not during parsing. // Only $._value arguments allowed; qualified_ref removed to prevent greedy consumption - macro_call: $ => prec.right(seq( - '#', - field('name', $.identifier), - repeat($._value), - )), + macro_call: ($) => prec.right(seq("#", field("name", $.identifier), repeat($._value))), // ===== Opcodes ===== // Exhaustive keyword terminal. - opcode: $ => choice( - // Arithmetic operations - 'add', 'sub', 'inc', 'dec', - 'shiftl', 'shiftr', 'ashiftr', - // Logic operations - 'and', 'or', 'xor', 'not', - 'eq', 'lt', 'lte', 'gt', 'gte', - // Routing/branch operations - 'breq', 'brgt', 'brge', 'brof', 'brty', - 'sweq', 'swgt', 'swge', 'swof', 'swty', - 'gate', 'sel', 'merge', - 'pass', 'const', 'free_ctx', - // Memory operations - 'read', 'write', 'clear', 'alloc', 'free', - 'rd_inc', 'rd_dec', 'cmp_sw', - // I/O operations - 'ior', 'iow', 'iorw', - // Configuration operations - 'load_inst', 'route_set', - ), + opcode: ($) => + choice( + // Arithmetic operations + "add", + "sub", + "inc", + "dec", + "shiftl", + "shiftr", + "ashiftr", + // Logic operations + "and", + "or", + "xor", + "not", + "eq", + "lt", + "lte", + "gt", + "gte", + // Routing/branch operations + "breq", + "brgt", + "brge", + "brof", + "brty", + "sweq", + "swgt", + "swge", + "swof", + "swty", + "gate", + "sel", + "merge", + "pass", + "const", + "free_ctx", + "change_tag", + "extract_tag", + // Memory operations + "read", + "write", + "clear", + "alloc", + "exec", + "free", + "rd_inc", + "rd_dec", + "cmp_sw", + // Configuration operations + "load_inst", + ), // ===== Flow operators ===== - flow_in: $ => '<|', - flow_out: $ => '|>', + flow_in: ($) => "<|", + flow_out: ($) => "|>", // ===== Base tokens ===== - identifier: $ => /[a-zA-Z_][a-zA-Z0-9_]*/, + identifier: ($) => /[a-zA-Z_][a-zA-Z0-9_]*/, - comment: $ => token(seq(';', /[^\n]*/)), + comment: ($) => token(seq(";", /[^\n]*/)), }, - extras: $ => [ - /\s/, - $.comment, - ], + extras: ($) => [/\s/, $.comment], }); diff --git a/editor/tree-sitter-dfasm/package-lock.json b/editor/tree-sitter-dfasm/package-lock.json index 98a3728..f3bebdd 100644 --- a/editor/tree-sitter-dfasm/package-lock.json +++ b/editor/tree-sitter-dfasm/package-lock.json @@ -13,7 +13,7 @@ "node-gyp-build": "^4.8.0" }, "devDependencies": { - "tree-sitter-cli": "^0.25.0" + "tree-sitter-cli": "^0.25.10" }, "peerDependencies": { "tree-sitter": "^0.22.0" diff --git a/editor/tree-sitter-dfasm/package.json b/editor/tree-sitter-dfasm/package.json index 16ea09a..2900d9f 100644 --- a/editor/tree-sitter-dfasm/package.json +++ b/editor/tree-sitter-dfasm/package.json @@ -19,7 +19,7 @@ "node-gyp-build": "^4.8.0" }, "devDependencies": { - "tree-sitter-cli": "^0.25.0" + "tree-sitter-cli": "^0.25.10" }, "peerDependencies": { "tree-sitter": "^0.22.0" @@ -27,6 +27,7 @@ "scripts": { "generate": "tree-sitter generate", "test": "tree-sitter test", - "parse": "tree-sitter parse" + "parse": "tree-sitter parse", + "build": "tree-sitter build" } } diff --git a/editor/tree-sitter-dfasm/src/grammar.json b/editor/tree-sitter-dfasm/src/grammar.json index b818542..fd5c1ef 100644 --- a/editor/tree-sitter-dfasm/src/grammar.json +++ b/editor/tree-sitter-dfasm/src/grammar.json @@ -906,55 +906,51 @@ }, { "type": "STRING", - "value": "read" + "value": "change_tag" }, { "type": "STRING", - "value": "write" + "value": "extract_tag" }, { "type": "STRING", - "value": "clear" + "value": "read" }, { "type": "STRING", - "value": "alloc" + "value": "write" }, { "type": "STRING", - "value": "free" + "value": "clear" }, { "type": "STRING", - "value": "rd_inc" + "value": "alloc" }, { "type": "STRING", - "value": "rd_dec" + "value": "exec" }, { "type": "STRING", - "value": "cmp_sw" + "value": "free" }, { "type": "STRING", - "value": "ior" + "value": "rd_inc" }, { "type": "STRING", - "value": "iow" + "value": "rd_dec" }, { "type": "STRING", - "value": "iorw" + "value": "cmp_sw" }, { "type": "STRING", "value": "load_inst" - }, - { - "type": "STRING", - "value": "route_set" } ] }, diff --git a/editor/tree-sitter-dfasm/src/node-types.json b/editor/tree-sitter-dfasm/src/node-types.json index 296ffa5..e93ec22 100644 --- a/editor/tree-sitter-dfasm/src/node-types.json +++ b/editor/tree-sitter-dfasm/src/node-types.json @@ -781,6 +781,10 @@ "type": "brty", "named": false }, + { + "type": "change_tag", + "named": false + }, { "type": "clear", "named": false @@ -814,6 +818,14 @@ "type": "escape_sequence", "named": true }, + { + "type": "exec", + "named": false + }, + { + "type": "extract_tag", + "named": false + }, { "type": "flow_in", "named": true @@ -854,18 +866,6 @@ "type": "inc", "named": false }, - { - "type": "ior", - "named": false - }, - { - "type": "iorw", - "named": false - }, - { - "type": "iow", - "named": false - }, { "type": "load_inst", "named": false @@ -910,10 +910,6 @@ "type": "read", "named": false }, - { - "type": "route_set", - "named": false - }, { "type": "sel", "named": false diff --git a/editor/tree-sitter-dfasm/src/parser.c b/editor/tree-sitter-dfasm/src/parser.c index 56f7ee1..2c5ebdb 100644 --- a/editor/tree-sitter-dfasm/src/parser.c +++ b/editor/tree-sitter-dfasm/src/parser.c @@ -9,9 +9,9 @@ #define LANGUAGE_VERSION 15 #define STATE_COUNT 92 #define LARGE_STATE_COUNT 28 -#define SYMBOL_COUNT 108 +#define SYMBOL_COUNT 107 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 71 +#define TOKEN_COUNT 70 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 7 #define MAX_ALIAS_SEQUENCE_LENGTH 5 @@ -74,59 +74,58 @@ enum ts_symbol_identifiers { anon_sym_pass = 52, anon_sym_const = 53, anon_sym_free_ctx = 54, - anon_sym_read = 55, - anon_sym_write = 56, - anon_sym_clear = 57, - anon_sym_alloc = 58, - anon_sym_free = 59, - anon_sym_rd_inc = 60, - anon_sym_rd_dec = 61, - anon_sym_cmp_sw = 62, - anon_sym_ior = 63, - anon_sym_iow = 64, - anon_sym_iorw = 65, + anon_sym_change_tag = 55, + anon_sym_extract_tag = 56, + anon_sym_read = 57, + anon_sym_write = 58, + anon_sym_clear = 59, + anon_sym_alloc = 60, + anon_sym_exec = 61, + anon_sym_free = 62, + anon_sym_rd_inc = 63, + anon_sym_rd_dec = 64, + anon_sym_cmp_sw = 65, anon_sym_load_inst = 66, - anon_sym_route_set = 67, - sym_flow_in = 68, - sym_flow_out = 69, - sym_comment = 70, - sym_program = 71, - sym__statement = 72, - sym_func_def = 73, - sym_inst_def = 74, - sym_strong_edge = 75, - sym_weak_edge = 76, - sym_plain_edge = 77, - sym_data_def = 78, - sym_pragma = 79, - sym_system_param = 80, - sym_location_dir = 81, - sym_ref_list = 82, - sym_qualified_ref = 83, - sym_node_ref = 84, - sym_label_ref = 85, - sym_func_ref = 86, - sym_placement = 87, - sym_port = 88, - sym__argument = 89, - sym_named_arg = 90, - sym__positional_arg = 91, - sym__value = 92, - sym_value_list = 93, - sym_number_literal = 94, - sym_char_literal = 95, - sym_string_literal = 96, - sym_raw_string_literal = 97, - sym_byte_string_literal = 98, - sym_macro_call = 99, - sym_opcode = 100, - aux_sym_program_repeat1 = 101, - aux_sym_inst_def_repeat1 = 102, - aux_sym_pragma_repeat1 = 103, - aux_sym_ref_list_repeat1 = 104, - aux_sym_value_list_repeat1 = 105, - aux_sym_string_literal_repeat1 = 106, - aux_sym_macro_call_repeat1 = 107, + sym_flow_in = 67, + sym_flow_out = 68, + sym_comment = 69, + sym_program = 70, + sym__statement = 71, + sym_func_def = 72, + sym_inst_def = 73, + sym_strong_edge = 74, + sym_weak_edge = 75, + sym_plain_edge = 76, + sym_data_def = 77, + sym_pragma = 78, + sym_system_param = 79, + sym_location_dir = 80, + sym_ref_list = 81, + sym_qualified_ref = 82, + sym_node_ref = 83, + sym_label_ref = 84, + sym_func_ref = 85, + sym_placement = 86, + sym_port = 87, + sym__argument = 88, + sym_named_arg = 89, + sym__positional_arg = 90, + sym__value = 91, + sym_value_list = 92, + sym_number_literal = 93, + sym_char_literal = 94, + sym_string_literal = 95, + sym_raw_string_literal = 96, + sym_byte_string_literal = 97, + sym_macro_call = 98, + sym_opcode = 99, + aux_sym_program_repeat1 = 100, + aux_sym_inst_def_repeat1 = 101, + aux_sym_pragma_repeat1 = 102, + aux_sym_ref_list_repeat1 = 103, + aux_sym_value_list_repeat1 = 104, + aux_sym_string_literal_repeat1 = 105, + aux_sym_macro_call_repeat1 = 106, }; static const char * const ts_symbol_names[] = { @@ -185,19 +184,18 @@ static const char * const ts_symbol_names[] = { [anon_sym_pass] = "pass", [anon_sym_const] = "const", [anon_sym_free_ctx] = "free_ctx", + [anon_sym_change_tag] = "change_tag", + [anon_sym_extract_tag] = "extract_tag", [anon_sym_read] = "read", [anon_sym_write] = "write", [anon_sym_clear] = "clear", [anon_sym_alloc] = "alloc", + [anon_sym_exec] = "exec", [anon_sym_free] = "free", [anon_sym_rd_inc] = "rd_inc", [anon_sym_rd_dec] = "rd_dec", [anon_sym_cmp_sw] = "cmp_sw", - [anon_sym_ior] = "ior", - [anon_sym_iow] = "iow", - [anon_sym_iorw] = "iorw", [anon_sym_load_inst] = "load_inst", - [anon_sym_route_set] = "route_set", [sym_flow_in] = "flow_in", [sym_flow_out] = "flow_out", [sym_comment] = "comment", @@ -296,19 +294,18 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_pass] = anon_sym_pass, [anon_sym_const] = anon_sym_const, [anon_sym_free_ctx] = anon_sym_free_ctx, + [anon_sym_change_tag] = anon_sym_change_tag, + [anon_sym_extract_tag] = anon_sym_extract_tag, [anon_sym_read] = anon_sym_read, [anon_sym_write] = anon_sym_write, [anon_sym_clear] = anon_sym_clear, [anon_sym_alloc] = anon_sym_alloc, + [anon_sym_exec] = anon_sym_exec, [anon_sym_free] = anon_sym_free, [anon_sym_rd_inc] = anon_sym_rd_inc, [anon_sym_rd_dec] = anon_sym_rd_dec, [anon_sym_cmp_sw] = anon_sym_cmp_sw, - [anon_sym_ior] = anon_sym_ior, - [anon_sym_iow] = anon_sym_iow, - [anon_sym_iorw] = anon_sym_iorw, [anon_sym_load_inst] = anon_sym_load_inst, - [anon_sym_route_set] = anon_sym_route_set, [sym_flow_in] = sym_flow_in, [sym_flow_out] = sym_flow_out, [sym_comment] = sym_comment, @@ -572,47 +569,47 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, - [anon_sym_read] = { + [anon_sym_change_tag] = { .visible = true, .named = false, }, - [anon_sym_write] = { + [anon_sym_extract_tag] = { .visible = true, .named = false, }, - [anon_sym_clear] = { + [anon_sym_read] = { .visible = true, .named = false, }, - [anon_sym_alloc] = { + [anon_sym_write] = { .visible = true, .named = false, }, - [anon_sym_free] = { + [anon_sym_clear] = { .visible = true, .named = false, }, - [anon_sym_rd_inc] = { + [anon_sym_alloc] = { .visible = true, .named = false, }, - [anon_sym_rd_dec] = { + [anon_sym_exec] = { .visible = true, .named = false, }, - [anon_sym_cmp_sw] = { + [anon_sym_free] = { .visible = true, .named = false, }, - [anon_sym_ior] = { + [anon_sym_rd_inc] = { .visible = true, .named = false, }, - [anon_sym_iow] = { + [anon_sym_rd_dec] = { .visible = true, .named = false, }, - [anon_sym_iorw] = { + [anon_sym_cmp_sw] = { .visible = true, .named = false, }, @@ -620,10 +617,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, - [anon_sym_route_set] = { - .visible = true, - .named = false, - }, [sym_flow_in] = { .visible = true, .named = true, @@ -1340,47 +1333,47 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 'r') ADVANCE(22); END_STATE(); case 3: - if (lookahead == 'l') ADVANCE(23); - if (lookahead == 'm') ADVANCE(24); - if (lookahead == 'o') ADVANCE(25); + if (lookahead == 'h') ADVANCE(23); + if (lookahead == 'l') ADVANCE(24); + if (lookahead == 'm') ADVANCE(25); + if (lookahead == 'o') ADVANCE(26); END_STATE(); case 4: - if (lookahead == 'e') ADVANCE(26); + if (lookahead == 'e') ADVANCE(27); END_STATE(); case 5: - if (lookahead == 'q') ADVANCE(27); + if (lookahead == 'q') ADVANCE(28); + if (lookahead == 'x') ADVANCE(29); END_STATE(); case 6: - if (lookahead == 'r') ADVANCE(28); + if (lookahead == 'r') ADVANCE(30); END_STATE(); case 7: - if (lookahead == 'a') ADVANCE(29); - if (lookahead == 't') ADVANCE(30); + if (lookahead == 'a') ADVANCE(31); + if (lookahead == 't') ADVANCE(32); END_STATE(); case 8: - if (lookahead == 'n') ADVANCE(31); - if (lookahead == 'o') ADVANCE(32); + if (lookahead == 'n') ADVANCE(33); END_STATE(); case 9: - if (lookahead == 'o') ADVANCE(33); - if (lookahead == 't') ADVANCE(34); + if (lookahead == 'o') ADVANCE(34); + if (lookahead == 't') ADVANCE(35); END_STATE(); case 10: - if (lookahead == 'e') ADVANCE(35); + if (lookahead == 'e') ADVANCE(36); END_STATE(); case 11: - if (lookahead == 'o') ADVANCE(36); + if (lookahead == 'o') ADVANCE(37); END_STATE(); case 12: - if (lookahead == 'r') ADVANCE(37); + if (lookahead == 'r') ADVANCE(38); END_STATE(); case 13: - if (lookahead == 'a') ADVANCE(38); + if (lookahead == 'a') ADVANCE(39); END_STATE(); case 14: - if (lookahead == 'd') ADVANCE(39); - if (lookahead == 'e') ADVANCE(40); - if (lookahead == 'o') ADVANCE(41); + if (lookahead == 'd') ADVANCE(40); + if (lookahead == 'e') ADVANCE(41); END_STATE(); case 15: if (lookahead == 'e') ADVANCE(42); @@ -1413,64 +1406,64 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 't') ADVANCE(55); END_STATE(); case 23: - if (lookahead == 'e') ADVANCE(56); + if (lookahead == 'a') ADVANCE(56); END_STATE(); case 24: - if (lookahead == 'p') ADVANCE(57); + if (lookahead == 'e') ADVANCE(57); END_STATE(); case 25: - if (lookahead == 'n') ADVANCE(58); + if (lookahead == 'p') ADVANCE(58); END_STATE(); case 26: - if (lookahead == 'c') ADVANCE(59); + if (lookahead == 'n') ADVANCE(59); END_STATE(); case 27: - ACCEPT_TOKEN(anon_sym_eq); + if (lookahead == 'c') ADVANCE(60); END_STATE(); case 28: - if (lookahead == 'e') ADVANCE(60); + ACCEPT_TOKEN(anon_sym_eq); END_STATE(); case 29: - if (lookahead == 't') ADVANCE(61); + if (lookahead == 'e') ADVANCE(61); + if (lookahead == 't') ADVANCE(62); END_STATE(); case 30: - ACCEPT_TOKEN(anon_sym_gt); - if (lookahead == 'e') ADVANCE(62); + if (lookahead == 'e') ADVANCE(63); END_STATE(); case 31: - if (lookahead == 'c') ADVANCE(63); + if (lookahead == 't') ADVANCE(64); END_STATE(); case 32: - if (lookahead == 'r') ADVANCE(64); - if (lookahead == 'w') ADVANCE(65); + ACCEPT_TOKEN(anon_sym_gt); + if (lookahead == 'e') ADVANCE(65); END_STATE(); case 33: - if (lookahead == 'a') ADVANCE(66); + if (lookahead == 'c') ADVANCE(66); END_STATE(); case 34: - ACCEPT_TOKEN(anon_sym_lt); - if (lookahead == 'e') ADVANCE(67); + if (lookahead == 'a') ADVANCE(67); END_STATE(); case 35: - if (lookahead == 'r') ADVANCE(68); + ACCEPT_TOKEN(anon_sym_lt); + if (lookahead == 'e') ADVANCE(68); END_STATE(); case 36: - if (lookahead == 't') ADVANCE(69); + if (lookahead == 'r') ADVANCE(69); END_STATE(); case 37: - ACCEPT_TOKEN(anon_sym_or); + if (lookahead == 't') ADVANCE(70); END_STATE(); case 38: - if (lookahead == 's') ADVANCE(70); + ACCEPT_TOKEN(anon_sym_or); END_STATE(); case 39: - if (lookahead == '_') ADVANCE(71); + if (lookahead == 's') ADVANCE(71); END_STATE(); case 40: - if (lookahead == 'a') ADVANCE(72); + if (lookahead == '_') ADVANCE(72); END_STATE(); case 41: - if (lookahead == 'u') ADVANCE(73); + if (lookahead == 'a') ADVANCE(73); END_STATE(); case 42: if (lookahead == 'l') ADVANCE(74); @@ -1519,94 +1512,93 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 'y') ADVANCE(89); END_STATE(); case 56: - if (lookahead == 'a') ADVANCE(90); + if (lookahead == 'n') ADVANCE(90); END_STATE(); case 57: - if (lookahead == '_') ADVANCE(91); + if (lookahead == 'a') ADVANCE(91); END_STATE(); case 58: - if (lookahead == 's') ADVANCE(92); + if (lookahead == '_') ADVANCE(92); END_STATE(); case 59: - ACCEPT_TOKEN(anon_sym_dec); + if (lookahead == 's') ADVANCE(93); END_STATE(); case 60: - if (lookahead == 'e') ADVANCE(93); + ACCEPT_TOKEN(anon_sym_dec); END_STATE(); case 61: - if (lookahead == 'e') ADVANCE(94); + if (lookahead == 'c') ADVANCE(94); END_STATE(); case 62: - ACCEPT_TOKEN(anon_sym_gte); + if (lookahead == 'r') ADVANCE(95); END_STATE(); case 63: - ACCEPT_TOKEN(anon_sym_inc); + if (lookahead == 'e') ADVANCE(96); END_STATE(); case 64: - ACCEPT_TOKEN(anon_sym_ior); - if (lookahead == 'w') ADVANCE(95); + if (lookahead == 'e') ADVANCE(97); END_STATE(); case 65: - ACCEPT_TOKEN(anon_sym_iow); + ACCEPT_TOKEN(anon_sym_gte); END_STATE(); case 66: - if (lookahead == 'd') ADVANCE(96); + ACCEPT_TOKEN(anon_sym_inc); END_STATE(); case 67: - ACCEPT_TOKEN(anon_sym_lte); + if (lookahead == 'd') ADVANCE(98); END_STATE(); case 68: - if (lookahead == 'g') ADVANCE(97); + ACCEPT_TOKEN(anon_sym_lte); END_STATE(); case 69: - ACCEPT_TOKEN(anon_sym_not); + if (lookahead == 'g') ADVANCE(99); END_STATE(); case 70: - if (lookahead == 's') ADVANCE(98); + ACCEPT_TOKEN(anon_sym_not); END_STATE(); case 71: - if (lookahead == 'd') ADVANCE(99); - if (lookahead == 'i') ADVANCE(100); + if (lookahead == 's') ADVANCE(100); END_STATE(); case 72: if (lookahead == 'd') ADVANCE(101); + if (lookahead == 'i') ADVANCE(102); END_STATE(); case 73: - if (lookahead == 't') ADVANCE(102); + if (lookahead == 'd') ADVANCE(103); END_STATE(); case 74: ACCEPT_TOKEN(anon_sym_sel); END_STATE(); case 75: - if (lookahead == 'f') ADVANCE(103); + if (lookahead == 'f') ADVANCE(104); END_STATE(); case 76: ACCEPT_TOKEN(anon_sym_sub); END_STATE(); case 77: - if (lookahead == 'q') ADVANCE(104); + if (lookahead == 'q') ADVANCE(105); END_STATE(); case 78: - if (lookahead == 'e') ADVANCE(105); - if (lookahead == 't') ADVANCE(106); + if (lookahead == 'e') ADVANCE(106); + if (lookahead == 't') ADVANCE(107); END_STATE(); case 79: - if (lookahead == 'f') ADVANCE(107); + if (lookahead == 'f') ADVANCE(108); END_STATE(); case 80: - if (lookahead == 'y') ADVANCE(108); + if (lookahead == 'y') ADVANCE(109); END_STATE(); case 81: - if (lookahead == 't') ADVANCE(109); + if (lookahead == 't') ADVANCE(110); END_STATE(); case 82: ACCEPT_TOKEN(anon_sym_xor); END_STATE(); case 83: - if (lookahead == 'c') ADVANCE(110); + if (lookahead == 'c') ADVANCE(111); END_STATE(); case 84: - if (lookahead == 'f') ADVANCE(111); + if (lookahead == 'f') ADVANCE(112); END_STATE(); case 85: ACCEPT_TOKEN(anon_sym_breq); @@ -1624,159 +1616,186 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_brty); END_STATE(); case 90: - if (lookahead == 'r') ADVANCE(112); + if (lookahead == 'g') ADVANCE(113); END_STATE(); case 91: - if (lookahead == 's') ADVANCE(113); + if (lookahead == 'r') ADVANCE(114); END_STATE(); case 92: - if (lookahead == 't') ADVANCE(114); + if (lookahead == 's') ADVANCE(115); END_STATE(); case 93: - ACCEPT_TOKEN(anon_sym_free); - if (lookahead == '_') ADVANCE(115); + if (lookahead == 't') ADVANCE(116); END_STATE(); case 94: - ACCEPT_TOKEN(anon_sym_gate); + ACCEPT_TOKEN(anon_sym_exec); END_STATE(); case 95: - ACCEPT_TOKEN(anon_sym_iorw); + if (lookahead == 'a') ADVANCE(117); END_STATE(); case 96: - if (lookahead == '_') ADVANCE(116); + ACCEPT_TOKEN(anon_sym_free); + if (lookahead == '_') ADVANCE(118); END_STATE(); case 97: - if (lookahead == 'e') ADVANCE(117); + ACCEPT_TOKEN(anon_sym_gate); END_STATE(); case 98: - ACCEPT_TOKEN(anon_sym_pass); + if (lookahead == '_') ADVANCE(119); END_STATE(); case 99: - if (lookahead == 'e') ADVANCE(118); + if (lookahead == 'e') ADVANCE(120); END_STATE(); case 100: - if (lookahead == 'n') ADVANCE(119); + ACCEPT_TOKEN(anon_sym_pass); END_STATE(); case 101: - ACCEPT_TOKEN(anon_sym_read); + if (lookahead == 'e') ADVANCE(121); END_STATE(); case 102: - if (lookahead == 'e') ADVANCE(120); + if (lookahead == 'n') ADVANCE(122); END_STATE(); case 103: - if (lookahead == 't') ADVANCE(121); + ACCEPT_TOKEN(anon_sym_read); END_STATE(); case 104: - ACCEPT_TOKEN(anon_sym_sweq); + if (lookahead == 't') ADVANCE(123); END_STATE(); case 105: - ACCEPT_TOKEN(anon_sym_swge); + ACCEPT_TOKEN(anon_sym_sweq); END_STATE(); case 106: - ACCEPT_TOKEN(anon_sym_swgt); + ACCEPT_TOKEN(anon_sym_swge); END_STATE(); case 107: - ACCEPT_TOKEN(anon_sym_swof); + ACCEPT_TOKEN(anon_sym_swgt); END_STATE(); case 108: - ACCEPT_TOKEN(anon_sym_swty); + ACCEPT_TOKEN(anon_sym_swof); END_STATE(); case 109: - if (lookahead == 'e') ADVANCE(122); + ACCEPT_TOKEN(anon_sym_swty); END_STATE(); case 110: - ACCEPT_TOKEN(anon_sym_alloc); + if (lookahead == 'e') ADVANCE(124); END_STATE(); case 111: - if (lookahead == 't') ADVANCE(123); + ACCEPT_TOKEN(anon_sym_alloc); END_STATE(); case 112: - ACCEPT_TOKEN(anon_sym_clear); + if (lookahead == 't') ADVANCE(125); END_STATE(); case 113: - if (lookahead == 'w') ADVANCE(124); + if (lookahead == 'e') ADVANCE(126); END_STATE(); case 114: - ACCEPT_TOKEN(anon_sym_const); + ACCEPT_TOKEN(anon_sym_clear); END_STATE(); case 115: - if (lookahead == 'c') ADVANCE(125); + if (lookahead == 'w') ADVANCE(127); END_STATE(); case 116: - if (lookahead == 'i') ADVANCE(126); + ACCEPT_TOKEN(anon_sym_const); END_STATE(); case 117: - ACCEPT_TOKEN(anon_sym_merge); + if (lookahead == 'c') ADVANCE(128); END_STATE(); case 118: - if (lookahead == 'c') ADVANCE(127); + if (lookahead == 'c') ADVANCE(129); END_STATE(); case 119: - if (lookahead == 'c') ADVANCE(128); + if (lookahead == 'i') ADVANCE(130); END_STATE(); case 120: - if (lookahead == '_') ADVANCE(129); + ACCEPT_TOKEN(anon_sym_merge); END_STATE(); case 121: - if (lookahead == 'l') ADVANCE(130); - if (lookahead == 'r') ADVANCE(131); + if (lookahead == 'c') ADVANCE(131); END_STATE(); case 122: - ACCEPT_TOKEN(anon_sym_write); + if (lookahead == 'c') ADVANCE(132); END_STATE(); case 123: - if (lookahead == 'r') ADVANCE(132); + if (lookahead == 'l') ADVANCE(133); + if (lookahead == 'r') ADVANCE(134); END_STATE(); case 124: - ACCEPT_TOKEN(anon_sym_cmp_sw); + ACCEPT_TOKEN(anon_sym_write); END_STATE(); case 125: - if (lookahead == 't') ADVANCE(133); + if (lookahead == 'r') ADVANCE(135); END_STATE(); case 126: - if (lookahead == 'n') ADVANCE(134); + if (lookahead == '_') ADVANCE(136); END_STATE(); case 127: - ACCEPT_TOKEN(anon_sym_rd_dec); + ACCEPT_TOKEN(anon_sym_cmp_sw); END_STATE(); case 128: - ACCEPT_TOKEN(anon_sym_rd_inc); + if (lookahead == 't') ADVANCE(137); END_STATE(); case 129: - if (lookahead == 's') ADVANCE(135); + if (lookahead == 't') ADVANCE(138); END_STATE(); case 130: - ACCEPT_TOKEN(anon_sym_shiftl); + if (lookahead == 'n') ADVANCE(139); END_STATE(); case 131: - ACCEPT_TOKEN(anon_sym_shiftr); + ACCEPT_TOKEN(anon_sym_rd_dec); END_STATE(); case 132: - ACCEPT_TOKEN(anon_sym_ashiftr); + ACCEPT_TOKEN(anon_sym_rd_inc); END_STATE(); case 133: - if (lookahead == 'x') ADVANCE(136); + ACCEPT_TOKEN(anon_sym_shiftl); END_STATE(); case 134: - if (lookahead == 's') ADVANCE(137); + ACCEPT_TOKEN(anon_sym_shiftr); END_STATE(); case 135: - if (lookahead == 'e') ADVANCE(138); + ACCEPT_TOKEN(anon_sym_ashiftr); END_STATE(); case 136: - ACCEPT_TOKEN(anon_sym_free_ctx); + if (lookahead == 't') ADVANCE(140); END_STATE(); case 137: - if (lookahead == 't') ADVANCE(139); + if (lookahead == '_') ADVANCE(141); END_STATE(); case 138: - if (lookahead == 't') ADVANCE(140); + if (lookahead == 'x') ADVANCE(142); END_STATE(); case 139: - ACCEPT_TOKEN(anon_sym_load_inst); + if (lookahead == 's') ADVANCE(143); END_STATE(); case 140: - ACCEPT_TOKEN(anon_sym_route_set); + if (lookahead == 'a') ADVANCE(144); + END_STATE(); + case 141: + if (lookahead == 't') ADVANCE(145); + END_STATE(); + case 142: + ACCEPT_TOKEN(anon_sym_free_ctx); + END_STATE(); + case 143: + if (lookahead == 't') ADVANCE(146); + END_STATE(); + case 144: + if (lookahead == 'g') ADVANCE(147); + END_STATE(); + case 145: + if (lookahead == 'a') ADVANCE(148); + END_STATE(); + case 146: + ACCEPT_TOKEN(anon_sym_load_inst); + END_STATE(); + case 147: + ACCEPT_TOKEN(anon_sym_change_tag); + END_STATE(); + case 148: + if (lookahead == 'g') ADVANCE(149); + END_STATE(); + case 149: + ACCEPT_TOKEN(anon_sym_extract_tag); END_STATE(); default: return false; @@ -1932,19 +1951,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(1), [anon_sym_const] = ACTIONS(1), [anon_sym_free_ctx] = ACTIONS(1), + [anon_sym_change_tag] = ACTIONS(1), + [anon_sym_extract_tag] = ACTIONS(1), [anon_sym_read] = ACTIONS(1), [anon_sym_write] = ACTIONS(1), [anon_sym_clear] = ACTIONS(1), [anon_sym_alloc] = ACTIONS(1), + [anon_sym_exec] = ACTIONS(1), [anon_sym_free] = ACTIONS(1), [anon_sym_rd_inc] = ACTIONS(1), [anon_sym_rd_dec] = ACTIONS(1), [anon_sym_cmp_sw] = ACTIONS(1), - [anon_sym_ior] = ACTIONS(1), - [anon_sym_iow] = ACTIONS(1), - [anon_sym_iorw] = ACTIONS(1), [anon_sym_load_inst] = ACTIONS(1), - [anon_sym_route_set] = ACTIONS(1), [sym_flow_in] = ACTIONS(1), [sym_flow_out] = ACTIONS(1), [sym_comment] = ACTIONS(3), @@ -2004,19 +2022,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(15), [anon_sym_const] = ACTIONS(15), [anon_sym_free_ctx] = ACTIONS(15), + [anon_sym_change_tag] = ACTIONS(15), + [anon_sym_extract_tag] = ACTIONS(15), [anon_sym_read] = ACTIONS(15), [anon_sym_write] = ACTIONS(15), [anon_sym_clear] = ACTIONS(15), [anon_sym_alloc] = ACTIONS(15), + [anon_sym_exec] = ACTIONS(15), [anon_sym_free] = ACTIONS(17), [anon_sym_rd_inc] = ACTIONS(15), [anon_sym_rd_dec] = ACTIONS(15), [anon_sym_cmp_sw] = ACTIONS(15), - [anon_sym_ior] = ACTIONS(17), - [anon_sym_iow] = ACTIONS(15), - [anon_sym_iorw] = ACTIONS(15), [anon_sym_load_inst] = ACTIONS(15), - [anon_sym_route_set] = ACTIONS(15), [sym_comment] = ACTIONS(3), }, [STATE(2)] = { @@ -2074,19 +2091,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(33), [anon_sym_const] = ACTIONS(33), [anon_sym_free_ctx] = ACTIONS(33), + [anon_sym_change_tag] = ACTIONS(33), + [anon_sym_extract_tag] = ACTIONS(33), [anon_sym_read] = ACTIONS(33), [anon_sym_write] = ACTIONS(33), [anon_sym_clear] = ACTIONS(33), [anon_sym_alloc] = ACTIONS(33), + [anon_sym_exec] = ACTIONS(33), [anon_sym_free] = ACTIONS(36), [anon_sym_rd_inc] = ACTIONS(33), [anon_sym_rd_dec] = ACTIONS(33), [anon_sym_cmp_sw] = ACTIONS(33), - [anon_sym_ior] = ACTIONS(36), - [anon_sym_iow] = ACTIONS(33), - [anon_sym_iorw] = ACTIONS(33), [anon_sym_load_inst] = ACTIONS(33), - [anon_sym_route_set] = ACTIONS(33), [sym_comment] = ACTIONS(3), }, [STATE(3)] = { @@ -2143,19 +2159,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(15), [anon_sym_const] = ACTIONS(15), [anon_sym_free_ctx] = ACTIONS(15), + [anon_sym_change_tag] = ACTIONS(15), + [anon_sym_extract_tag] = ACTIONS(15), [anon_sym_read] = ACTIONS(15), [anon_sym_write] = ACTIONS(15), [anon_sym_clear] = ACTIONS(15), [anon_sym_alloc] = ACTIONS(15), + [anon_sym_exec] = ACTIONS(15), [anon_sym_free] = ACTIONS(17), [anon_sym_rd_inc] = ACTIONS(15), [anon_sym_rd_dec] = ACTIONS(15), [anon_sym_cmp_sw] = ACTIONS(15), - [anon_sym_ior] = ACTIONS(17), - [anon_sym_iow] = ACTIONS(15), - [anon_sym_iorw] = ACTIONS(15), [anon_sym_load_inst] = ACTIONS(15), - [anon_sym_route_set] = ACTIONS(15), [sym_comment] = ACTIONS(3), }, [STATE(4)] = { @@ -2212,19 +2227,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(15), [anon_sym_const] = ACTIONS(15), [anon_sym_free_ctx] = ACTIONS(15), + [anon_sym_change_tag] = ACTIONS(15), + [anon_sym_extract_tag] = ACTIONS(15), [anon_sym_read] = ACTIONS(15), [anon_sym_write] = ACTIONS(15), [anon_sym_clear] = ACTIONS(15), [anon_sym_alloc] = ACTIONS(15), + [anon_sym_exec] = ACTIONS(15), [anon_sym_free] = ACTIONS(17), [anon_sym_rd_inc] = ACTIONS(15), [anon_sym_rd_dec] = ACTIONS(15), [anon_sym_cmp_sw] = ACTIONS(15), - [anon_sym_ior] = ACTIONS(17), - [anon_sym_iow] = ACTIONS(15), - [anon_sym_iorw] = ACTIONS(15), [anon_sym_load_inst] = ACTIONS(15), - [anon_sym_route_set] = ACTIONS(15), [sym_comment] = ACTIONS(3), }, [STATE(5)] = { @@ -2281,19 +2295,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(15), [anon_sym_const] = ACTIONS(15), [anon_sym_free_ctx] = ACTIONS(15), + [anon_sym_change_tag] = ACTIONS(15), + [anon_sym_extract_tag] = ACTIONS(15), [anon_sym_read] = ACTIONS(15), [anon_sym_write] = ACTIONS(15), [anon_sym_clear] = ACTIONS(15), [anon_sym_alloc] = ACTIONS(15), + [anon_sym_exec] = ACTIONS(15), [anon_sym_free] = ACTIONS(17), [anon_sym_rd_inc] = ACTIONS(15), [anon_sym_rd_dec] = ACTIONS(15), [anon_sym_cmp_sw] = ACTIONS(15), - [anon_sym_ior] = ACTIONS(17), - [anon_sym_iow] = ACTIONS(15), - [anon_sym_iorw] = ACTIONS(15), [anon_sym_load_inst] = ACTIONS(15), - [anon_sym_route_set] = ACTIONS(15), [sym_comment] = ACTIONS(3), }, [STATE(6)] = { @@ -2348,19 +2361,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(45), [anon_sym_const] = ACTIONS(45), [anon_sym_free_ctx] = ACTIONS(45), + [anon_sym_change_tag] = ACTIONS(45), + [anon_sym_extract_tag] = ACTIONS(45), [anon_sym_read] = ACTIONS(45), [anon_sym_write] = ACTIONS(45), [anon_sym_clear] = ACTIONS(45), [anon_sym_alloc] = ACTIONS(45), + [anon_sym_exec] = ACTIONS(45), [anon_sym_free] = ACTIONS(47), [anon_sym_rd_inc] = ACTIONS(45), [anon_sym_rd_dec] = ACTIONS(45), [anon_sym_cmp_sw] = ACTIONS(45), - [anon_sym_ior] = ACTIONS(47), - [anon_sym_iow] = ACTIONS(45), - [anon_sym_iorw] = ACTIONS(45), [anon_sym_load_inst] = ACTIONS(45), - [anon_sym_route_set] = ACTIONS(45), [sym_comment] = ACTIONS(3), }, [STATE(7)] = { @@ -2415,19 +2427,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(61), [anon_sym_const] = ACTIONS(61), [anon_sym_free_ctx] = ACTIONS(61), + [anon_sym_change_tag] = ACTIONS(61), + [anon_sym_extract_tag] = ACTIONS(61), [anon_sym_read] = ACTIONS(61), [anon_sym_write] = ACTIONS(61), [anon_sym_clear] = ACTIONS(61), [anon_sym_alloc] = ACTIONS(61), + [anon_sym_exec] = ACTIONS(61), [anon_sym_free] = ACTIONS(63), [anon_sym_rd_inc] = ACTIONS(61), [anon_sym_rd_dec] = ACTIONS(61), [anon_sym_cmp_sw] = ACTIONS(61), - [anon_sym_ior] = ACTIONS(63), - [anon_sym_iow] = ACTIONS(61), - [anon_sym_iorw] = ACTIONS(61), [anon_sym_load_inst] = ACTIONS(61), - [anon_sym_route_set] = ACTIONS(61), [sym_comment] = ACTIONS(3), }, [STATE(8)] = { @@ -2482,19 +2493,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(65), [anon_sym_const] = ACTIONS(65), [anon_sym_free_ctx] = ACTIONS(65), + [anon_sym_change_tag] = ACTIONS(65), + [anon_sym_extract_tag] = ACTIONS(65), [anon_sym_read] = ACTIONS(65), [anon_sym_write] = ACTIONS(65), [anon_sym_clear] = ACTIONS(65), [anon_sym_alloc] = ACTIONS(65), + [anon_sym_exec] = ACTIONS(65), [anon_sym_free] = ACTIONS(67), [anon_sym_rd_inc] = ACTIONS(65), [anon_sym_rd_dec] = ACTIONS(65), [anon_sym_cmp_sw] = ACTIONS(65), - [anon_sym_ior] = ACTIONS(67), - [anon_sym_iow] = ACTIONS(65), - [anon_sym_iorw] = ACTIONS(65), [anon_sym_load_inst] = ACTIONS(65), - [anon_sym_route_set] = ACTIONS(65), [sym_comment] = ACTIONS(3), }, [STATE(9)] = { @@ -2544,19 +2554,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(87), [anon_sym_const] = ACTIONS(87), [anon_sym_free_ctx] = ACTIONS(87), + [anon_sym_change_tag] = ACTIONS(87), + [anon_sym_extract_tag] = ACTIONS(87), [anon_sym_read] = ACTIONS(87), [anon_sym_write] = ACTIONS(87), [anon_sym_clear] = ACTIONS(87), [anon_sym_alloc] = ACTIONS(87), + [anon_sym_exec] = ACTIONS(87), [anon_sym_free] = ACTIONS(89), [anon_sym_rd_inc] = ACTIONS(87), [anon_sym_rd_dec] = ACTIONS(87), [anon_sym_cmp_sw] = ACTIONS(87), - [anon_sym_ior] = ACTIONS(89), - [anon_sym_iow] = ACTIONS(87), - [anon_sym_iorw] = ACTIONS(87), [anon_sym_load_inst] = ACTIONS(87), - [anon_sym_route_set] = ACTIONS(87), [sym_flow_in] = ACTIONS(87), [sym_flow_out] = ACTIONS(87), [sym_comment] = ACTIONS(3), @@ -2606,19 +2615,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(91), [anon_sym_const] = ACTIONS(91), [anon_sym_free_ctx] = ACTIONS(91), + [anon_sym_change_tag] = ACTIONS(91), + [anon_sym_extract_tag] = ACTIONS(91), [anon_sym_read] = ACTIONS(91), [anon_sym_write] = ACTIONS(91), [anon_sym_clear] = ACTIONS(91), [anon_sym_alloc] = ACTIONS(91), + [anon_sym_exec] = ACTIONS(91), [anon_sym_free] = ACTIONS(93), [anon_sym_rd_inc] = ACTIONS(91), [anon_sym_rd_dec] = ACTIONS(91), [anon_sym_cmp_sw] = ACTIONS(91), - [anon_sym_ior] = ACTIONS(93), - [anon_sym_iow] = ACTIONS(91), - [anon_sym_iorw] = ACTIONS(91), [anon_sym_load_inst] = ACTIONS(91), - [anon_sym_route_set] = ACTIONS(91), [sym_flow_in] = ACTIONS(91), [sym_flow_out] = ACTIONS(91), [sym_comment] = ACTIONS(3), @@ -2668,19 +2676,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(91), [anon_sym_const] = ACTIONS(91), [anon_sym_free_ctx] = ACTIONS(91), + [anon_sym_change_tag] = ACTIONS(91), + [anon_sym_extract_tag] = ACTIONS(91), [anon_sym_read] = ACTIONS(91), [anon_sym_write] = ACTIONS(91), [anon_sym_clear] = ACTIONS(91), [anon_sym_alloc] = ACTIONS(91), + [anon_sym_exec] = ACTIONS(91), [anon_sym_free] = ACTIONS(93), [anon_sym_rd_inc] = ACTIONS(91), [anon_sym_rd_dec] = ACTIONS(91), [anon_sym_cmp_sw] = ACTIONS(91), - [anon_sym_ior] = ACTIONS(93), - [anon_sym_iow] = ACTIONS(91), - [anon_sym_iorw] = ACTIONS(91), [anon_sym_load_inst] = ACTIONS(91), - [anon_sym_route_set] = ACTIONS(91), [sym_flow_in] = ACTIONS(91), [sym_flow_out] = ACTIONS(99), [sym_comment] = ACTIONS(3), @@ -2731,19 +2738,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(101), [anon_sym_const] = ACTIONS(101), [anon_sym_free_ctx] = ACTIONS(101), + [anon_sym_change_tag] = ACTIONS(101), + [anon_sym_extract_tag] = ACTIONS(101), [anon_sym_read] = ACTIONS(101), [anon_sym_write] = ACTIONS(101), [anon_sym_clear] = ACTIONS(101), [anon_sym_alloc] = ACTIONS(101), + [anon_sym_exec] = ACTIONS(101), [anon_sym_free] = ACTIONS(103), [anon_sym_rd_inc] = ACTIONS(101), [anon_sym_rd_dec] = ACTIONS(101), [anon_sym_cmp_sw] = ACTIONS(101), - [anon_sym_ior] = ACTIONS(103), - [anon_sym_iow] = ACTIONS(101), - [anon_sym_iorw] = ACTIONS(101), [anon_sym_load_inst] = ACTIONS(101), - [anon_sym_route_set] = ACTIONS(101), [sym_flow_out] = ACTIONS(101), [sym_comment] = ACTIONS(3), }, @@ -2793,19 +2799,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(105), [anon_sym_const] = ACTIONS(105), [anon_sym_free_ctx] = ACTIONS(105), + [anon_sym_change_tag] = ACTIONS(105), + [anon_sym_extract_tag] = ACTIONS(105), [anon_sym_read] = ACTIONS(105), [anon_sym_write] = ACTIONS(105), [anon_sym_clear] = ACTIONS(105), [anon_sym_alloc] = ACTIONS(105), + [anon_sym_exec] = ACTIONS(105), [anon_sym_free] = ACTIONS(107), [anon_sym_rd_inc] = ACTIONS(105), [anon_sym_rd_dec] = ACTIONS(105), [anon_sym_cmp_sw] = ACTIONS(105), - [anon_sym_ior] = ACTIONS(107), - [anon_sym_iow] = ACTIONS(105), - [anon_sym_iorw] = ACTIONS(105), [anon_sym_load_inst] = ACTIONS(105), - [anon_sym_route_set] = ACTIONS(105), [sym_flow_out] = ACTIONS(105), [sym_comment] = ACTIONS(3), }, @@ -2855,19 +2860,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(109), [anon_sym_const] = ACTIONS(109), [anon_sym_free_ctx] = ACTIONS(109), + [anon_sym_change_tag] = ACTIONS(109), + [anon_sym_extract_tag] = ACTIONS(109), [anon_sym_read] = ACTIONS(109), [anon_sym_write] = ACTIONS(109), [anon_sym_clear] = ACTIONS(109), [anon_sym_alloc] = ACTIONS(109), + [anon_sym_exec] = ACTIONS(109), [anon_sym_free] = ACTIONS(111), [anon_sym_rd_inc] = ACTIONS(109), [anon_sym_rd_dec] = ACTIONS(109), [anon_sym_cmp_sw] = ACTIONS(109), - [anon_sym_ior] = ACTIONS(111), - [anon_sym_iow] = ACTIONS(109), - [anon_sym_iorw] = ACTIONS(109), [anon_sym_load_inst] = ACTIONS(109), - [anon_sym_route_set] = ACTIONS(109), [sym_flow_out] = ACTIONS(109), [sym_comment] = ACTIONS(3), }, @@ -2917,19 +2921,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(113), [anon_sym_const] = ACTIONS(113), [anon_sym_free_ctx] = ACTIONS(113), + [anon_sym_change_tag] = ACTIONS(113), + [anon_sym_extract_tag] = ACTIONS(113), [anon_sym_read] = ACTIONS(113), [anon_sym_write] = ACTIONS(113), [anon_sym_clear] = ACTIONS(113), [anon_sym_alloc] = ACTIONS(113), + [anon_sym_exec] = ACTIONS(113), [anon_sym_free] = ACTIONS(115), [anon_sym_rd_inc] = ACTIONS(113), [anon_sym_rd_dec] = ACTIONS(113), [anon_sym_cmp_sw] = ACTIONS(113), - [anon_sym_ior] = ACTIONS(115), - [anon_sym_iow] = ACTIONS(113), - [anon_sym_iorw] = ACTIONS(113), [anon_sym_load_inst] = ACTIONS(113), - [anon_sym_route_set] = ACTIONS(113), [sym_flow_out] = ACTIONS(113), [sym_comment] = ACTIONS(3), }, @@ -2979,19 +2982,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(117), [anon_sym_const] = ACTIONS(117), [anon_sym_free_ctx] = ACTIONS(117), + [anon_sym_change_tag] = ACTIONS(117), + [anon_sym_extract_tag] = ACTIONS(117), [anon_sym_read] = ACTIONS(117), [anon_sym_write] = ACTIONS(117), [anon_sym_clear] = ACTIONS(117), [anon_sym_alloc] = ACTIONS(117), + [anon_sym_exec] = ACTIONS(117), [anon_sym_free] = ACTIONS(119), [anon_sym_rd_inc] = ACTIONS(117), [anon_sym_rd_dec] = ACTIONS(117), [anon_sym_cmp_sw] = ACTIONS(117), - [anon_sym_ior] = ACTIONS(119), - [anon_sym_iow] = ACTIONS(117), - [anon_sym_iorw] = ACTIONS(117), [anon_sym_load_inst] = ACTIONS(117), - [anon_sym_route_set] = ACTIONS(117), [sym_flow_out] = ACTIONS(117), [sym_comment] = ACTIONS(3), }, @@ -3041,19 +3043,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(121), [anon_sym_const] = ACTIONS(121), [anon_sym_free_ctx] = ACTIONS(121), + [anon_sym_change_tag] = ACTIONS(121), + [anon_sym_extract_tag] = ACTIONS(121), [anon_sym_read] = ACTIONS(121), [anon_sym_write] = ACTIONS(121), [anon_sym_clear] = ACTIONS(121), [anon_sym_alloc] = ACTIONS(121), + [anon_sym_exec] = ACTIONS(121), [anon_sym_free] = ACTIONS(123), [anon_sym_rd_inc] = ACTIONS(121), [anon_sym_rd_dec] = ACTIONS(121), [anon_sym_cmp_sw] = ACTIONS(121), - [anon_sym_ior] = ACTIONS(123), - [anon_sym_iow] = ACTIONS(121), - [anon_sym_iorw] = ACTIONS(121), [anon_sym_load_inst] = ACTIONS(121), - [anon_sym_route_set] = ACTIONS(121), [sym_flow_out] = ACTIONS(121), [sym_comment] = ACTIONS(3), }, @@ -3100,19 +3101,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(125), [anon_sym_const] = ACTIONS(125), [anon_sym_free_ctx] = ACTIONS(125), + [anon_sym_change_tag] = ACTIONS(125), + [anon_sym_extract_tag] = ACTIONS(125), [anon_sym_read] = ACTIONS(125), [anon_sym_write] = ACTIONS(125), [anon_sym_clear] = ACTIONS(125), [anon_sym_alloc] = ACTIONS(125), + [anon_sym_exec] = ACTIONS(125), [anon_sym_free] = ACTIONS(127), [anon_sym_rd_inc] = ACTIONS(125), [anon_sym_rd_dec] = ACTIONS(125), [anon_sym_cmp_sw] = ACTIONS(125), - [anon_sym_ior] = ACTIONS(127), - [anon_sym_iow] = ACTIONS(125), - [anon_sym_iorw] = ACTIONS(125), [anon_sym_load_inst] = ACTIONS(125), - [anon_sym_route_set] = ACTIONS(125), [sym_flow_in] = ACTIONS(125), [sym_flow_out] = ACTIONS(125), [sym_comment] = ACTIONS(3), @@ -3160,19 +3160,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(129), [anon_sym_const] = ACTIONS(129), [anon_sym_free_ctx] = ACTIONS(129), + [anon_sym_change_tag] = ACTIONS(129), + [anon_sym_extract_tag] = ACTIONS(129), [anon_sym_read] = ACTIONS(129), [anon_sym_write] = ACTIONS(129), [anon_sym_clear] = ACTIONS(129), [anon_sym_alloc] = ACTIONS(129), + [anon_sym_exec] = ACTIONS(129), [anon_sym_free] = ACTIONS(131), [anon_sym_rd_inc] = ACTIONS(129), [anon_sym_rd_dec] = ACTIONS(129), [anon_sym_cmp_sw] = ACTIONS(129), - [anon_sym_ior] = ACTIONS(131), - [anon_sym_iow] = ACTIONS(129), - [anon_sym_iorw] = ACTIONS(129), [anon_sym_load_inst] = ACTIONS(129), - [anon_sym_route_set] = ACTIONS(129), [sym_flow_in] = ACTIONS(129), [sym_flow_out] = ACTIONS(129), [sym_comment] = ACTIONS(3), @@ -3220,19 +3219,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(133), [anon_sym_const] = ACTIONS(133), [anon_sym_free_ctx] = ACTIONS(133), + [anon_sym_change_tag] = ACTIONS(133), + [anon_sym_extract_tag] = ACTIONS(133), [anon_sym_read] = ACTIONS(133), [anon_sym_write] = ACTIONS(133), [anon_sym_clear] = ACTIONS(133), [anon_sym_alloc] = ACTIONS(133), + [anon_sym_exec] = ACTIONS(133), [anon_sym_free] = ACTIONS(135), [anon_sym_rd_inc] = ACTIONS(133), [anon_sym_rd_dec] = ACTIONS(133), [anon_sym_cmp_sw] = ACTIONS(133), - [anon_sym_ior] = ACTIONS(135), - [anon_sym_iow] = ACTIONS(133), - [anon_sym_iorw] = ACTIONS(133), [anon_sym_load_inst] = ACTIONS(133), - [anon_sym_route_set] = ACTIONS(133), [sym_flow_in] = ACTIONS(133), [sym_flow_out] = ACTIONS(133), [sym_comment] = ACTIONS(3), @@ -3280,19 +3278,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(137), [anon_sym_const] = ACTIONS(137), [anon_sym_free_ctx] = ACTIONS(137), + [anon_sym_change_tag] = ACTIONS(137), + [anon_sym_extract_tag] = ACTIONS(137), [anon_sym_read] = ACTIONS(137), [anon_sym_write] = ACTIONS(137), [anon_sym_clear] = ACTIONS(137), [anon_sym_alloc] = ACTIONS(137), + [anon_sym_exec] = ACTIONS(137), [anon_sym_free] = ACTIONS(139), [anon_sym_rd_inc] = ACTIONS(137), [anon_sym_rd_dec] = ACTIONS(137), [anon_sym_cmp_sw] = ACTIONS(137), - [anon_sym_ior] = ACTIONS(139), - [anon_sym_iow] = ACTIONS(137), - [anon_sym_iorw] = ACTIONS(137), [anon_sym_load_inst] = ACTIONS(137), - [anon_sym_route_set] = ACTIONS(137), [sym_flow_in] = ACTIONS(137), [sym_flow_out] = ACTIONS(137), [sym_comment] = ACTIONS(3), @@ -3339,19 +3336,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(149), [anon_sym_const] = ACTIONS(149), [anon_sym_free_ctx] = ACTIONS(149), + [anon_sym_change_tag] = ACTIONS(149), + [anon_sym_extract_tag] = ACTIONS(149), [anon_sym_read] = ACTIONS(149), [anon_sym_write] = ACTIONS(149), [anon_sym_clear] = ACTIONS(149), [anon_sym_alloc] = ACTIONS(149), + [anon_sym_exec] = ACTIONS(149), [anon_sym_free] = ACTIONS(151), [anon_sym_rd_inc] = ACTIONS(149), [anon_sym_rd_dec] = ACTIONS(149), [anon_sym_cmp_sw] = ACTIONS(149), - [anon_sym_ior] = ACTIONS(151), - [anon_sym_iow] = ACTIONS(149), - [anon_sym_iorw] = ACTIONS(149), [anon_sym_load_inst] = ACTIONS(149), - [anon_sym_route_set] = ACTIONS(149), [sym_flow_in] = ACTIONS(153), [sym_flow_out] = ACTIONS(155), [sym_comment] = ACTIONS(3), @@ -3398,19 +3394,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(157), [anon_sym_const] = ACTIONS(157), [anon_sym_free_ctx] = ACTIONS(157), + [anon_sym_change_tag] = ACTIONS(157), + [anon_sym_extract_tag] = ACTIONS(157), [anon_sym_read] = ACTIONS(157), [anon_sym_write] = ACTIONS(157), [anon_sym_clear] = ACTIONS(157), [anon_sym_alloc] = ACTIONS(157), + [anon_sym_exec] = ACTIONS(157), [anon_sym_free] = ACTIONS(159), [anon_sym_rd_inc] = ACTIONS(157), [anon_sym_rd_dec] = ACTIONS(157), [anon_sym_cmp_sw] = ACTIONS(157), - [anon_sym_ior] = ACTIONS(159), - [anon_sym_iow] = ACTIONS(157), - [anon_sym_iorw] = ACTIONS(157), [anon_sym_load_inst] = ACTIONS(157), - [anon_sym_route_set] = ACTIONS(157), [sym_flow_in] = ACTIONS(157), [sym_flow_out] = ACTIONS(157), [sym_comment] = ACTIONS(3), @@ -3456,19 +3451,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(161), [anon_sym_const] = ACTIONS(161), [anon_sym_free_ctx] = ACTIONS(161), + [anon_sym_change_tag] = ACTIONS(161), + [anon_sym_extract_tag] = ACTIONS(161), [anon_sym_read] = ACTIONS(161), [anon_sym_write] = ACTIONS(161), [anon_sym_clear] = ACTIONS(161), [anon_sym_alloc] = ACTIONS(161), + [anon_sym_exec] = ACTIONS(161), [anon_sym_free] = ACTIONS(163), [anon_sym_rd_inc] = ACTIONS(161), [anon_sym_rd_dec] = ACTIONS(161), [anon_sym_cmp_sw] = ACTIONS(161), - [anon_sym_ior] = ACTIONS(163), - [anon_sym_iow] = ACTIONS(161), - [anon_sym_iorw] = ACTIONS(161), [anon_sym_load_inst] = ACTIONS(161), - [anon_sym_route_set] = ACTIONS(161), [sym_flow_in] = ACTIONS(161), [sym_flow_out] = ACTIONS(161), [sym_comment] = ACTIONS(3), @@ -3514,19 +3508,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(165), [anon_sym_const] = ACTIONS(165), [anon_sym_free_ctx] = ACTIONS(165), + [anon_sym_change_tag] = ACTIONS(165), + [anon_sym_extract_tag] = ACTIONS(165), [anon_sym_read] = ACTIONS(165), [anon_sym_write] = ACTIONS(165), [anon_sym_clear] = ACTIONS(165), [anon_sym_alloc] = ACTIONS(165), + [anon_sym_exec] = ACTIONS(165), [anon_sym_free] = ACTIONS(167), [anon_sym_rd_inc] = ACTIONS(165), [anon_sym_rd_dec] = ACTIONS(165), [anon_sym_cmp_sw] = ACTIONS(165), - [anon_sym_ior] = ACTIONS(167), - [anon_sym_iow] = ACTIONS(165), - [anon_sym_iorw] = ACTIONS(165), [anon_sym_load_inst] = ACTIONS(165), - [anon_sym_route_set] = ACTIONS(165), [sym_flow_in] = ACTIONS(165), [sym_flow_out] = ACTIONS(165), [sym_comment] = ACTIONS(3), @@ -3572,19 +3565,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(169), [anon_sym_const] = ACTIONS(169), [anon_sym_free_ctx] = ACTIONS(169), + [anon_sym_change_tag] = ACTIONS(169), + [anon_sym_extract_tag] = ACTIONS(169), [anon_sym_read] = ACTIONS(169), [anon_sym_write] = ACTIONS(169), [anon_sym_clear] = ACTIONS(169), [anon_sym_alloc] = ACTIONS(169), + [anon_sym_exec] = ACTIONS(169), [anon_sym_free] = ACTIONS(171), [anon_sym_rd_inc] = ACTIONS(169), [anon_sym_rd_dec] = ACTIONS(169), [anon_sym_cmp_sw] = ACTIONS(169), - [anon_sym_ior] = ACTIONS(171), - [anon_sym_iow] = ACTIONS(169), - [anon_sym_iorw] = ACTIONS(169), [anon_sym_load_inst] = ACTIONS(169), - [anon_sym_route_set] = ACTIONS(169), [sym_flow_in] = ACTIONS(169), [sym_flow_out] = ACTIONS(169), [sym_comment] = ACTIONS(3), @@ -3630,19 +3622,18 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_pass] = ACTIONS(173), [anon_sym_const] = ACTIONS(173), [anon_sym_free_ctx] = ACTIONS(173), + [anon_sym_change_tag] = ACTIONS(173), + [anon_sym_extract_tag] = ACTIONS(173), [anon_sym_read] = ACTIONS(173), [anon_sym_write] = ACTIONS(173), [anon_sym_clear] = ACTIONS(173), [anon_sym_alloc] = ACTIONS(173), + [anon_sym_exec] = ACTIONS(173), [anon_sym_free] = ACTIONS(178), [anon_sym_rd_inc] = ACTIONS(173), [anon_sym_rd_dec] = ACTIONS(173), [anon_sym_cmp_sw] = ACTIONS(173), - [anon_sym_ior] = ACTIONS(178), - [anon_sym_iow] = ACTIONS(173), - [anon_sym_iorw] = ACTIONS(173), [anon_sym_load_inst] = ACTIONS(173), - [anon_sym_route_set] = ACTIONS(173), [sym_flow_out] = ACTIONS(173), [sym_comment] = ACTIONS(3), }, @@ -3656,12 +3647,11 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_COMMA, STATE(39), 1, aux_sym_ref_list_repeat1, - ACTIONS(151), 5, + ACTIONS(151), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(149), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3698,30 +3688,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [65] = 5, + [64] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(182), 1, anon_sym_COMMA, STATE(29), 1, aux_sym_value_list_repeat1, - ACTIONS(185), 5, + ACTIONS(185), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(180), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3758,30 +3747,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [130] = 5, + [128] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(189), 1, anon_sym_COMMA, STATE(35), 1, aux_sym_pragma_repeat1, - ACTIONS(191), 5, + ACTIONS(191), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(187), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3818,30 +3806,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [195] = 5, + [192] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(195), 1, anon_sym_COMMA, STATE(31), 1, aux_sym_ref_list_repeat1, - ACTIONS(198), 5, + ACTIONS(198), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(193), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3878,30 +3865,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [260] = 5, + [256] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(202), 1, anon_sym_COMMA, STATE(37), 1, aux_sym_value_list_repeat1, - ACTIONS(204), 5, + ACTIONS(204), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(200), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3938,30 +3924,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [325] = 5, + [320] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, anon_sym_COMMA, STATE(38), 1, aux_sym_inst_def_repeat1, - ACTIONS(210), 5, + ACTIONS(210), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(206), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -3998,30 +3983,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [390] = 5, + [384] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(189), 1, anon_sym_COMMA, STATE(30), 1, aux_sym_pragma_repeat1, - ACTIONS(214), 5, + ACTIONS(214), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(212), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4058,30 +4042,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [455] = 5, + [448] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(218), 1, anon_sym_COMMA, STATE(35), 1, aux_sym_pragma_repeat1, - ACTIONS(221), 5, + ACTIONS(221), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(216), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4118,30 +4101,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [520] = 5, + [512] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, anon_sym_COMMA, STATE(42), 1, aux_sym_inst_def_repeat1, - ACTIONS(225), 5, + ACTIONS(225), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(223), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4178,30 +4160,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [585] = 5, + [576] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(202), 1, anon_sym_COMMA, STATE(29), 1, aux_sym_value_list_repeat1, - ACTIONS(229), 5, + ACTIONS(229), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(227), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4238,30 +4219,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [650] = 5, + [640] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, anon_sym_COMMA, STATE(27), 1, aux_sym_inst_def_repeat1, - ACTIONS(233), 5, + ACTIONS(233), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(231), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4298,30 +4278,29 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [715] = 5, + [704] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(143), 1, anon_sym_COMMA, STATE(31), 1, aux_sym_ref_list_repeat1, - ACTIONS(237), 5, + ACTIONS(237), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(235), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4358,26 +4337,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [780] = 3, + [768] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(241), 5, + ACTIONS(241), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(239), 48, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4415,27 +4393,26 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, sym_flow_out, - [841] = 3, + [828] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(178), 5, + ACTIONS(178), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(173), 48, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4473,31 +4450,30 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, sym_flow_out, - [902] = 5, + [888] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, anon_sym_COMMA, STATE(27), 1, aux_sym_inst_def_repeat1, - ACTIONS(245), 5, + ACTIONS(245), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(243), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4534,26 +4510,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [967] = 3, + [952] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(198), 5, + ACTIONS(198), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(193), 47, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4591,26 +4566,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1027] = 3, + [1011] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(249), 5, + ACTIONS(249), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(247), 47, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4648,26 +4622,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1087] = 3, + [1070] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(221), 5, + ACTIONS(221), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(216), 47, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4705,26 +4678,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1147] = 3, + [1129] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(253), 5, + ACTIONS(253), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(251), 47, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4762,26 +4734,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1207] = 3, + [1188] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(185), 5, + ACTIONS(185), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(180), 47, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4819,26 +4790,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1267] = 3, + [1247] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(257), 5, + ACTIONS(257), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(255), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4875,26 +4845,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1326] = 3, + [1305] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(261), 5, + ACTIONS(261), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(259), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4931,26 +4900,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1385] = 3, + [1363] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(265), 5, + ACTIONS(265), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(263), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -4987,26 +4955,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1444] = 3, + [1421] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(269), 5, + ACTIONS(269), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(267), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -5043,26 +5010,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1503] = 3, + [1479] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(273), 5, + ACTIONS(273), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(271), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -5099,26 +5065,25 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1562] = 3, + [1537] = 3, ACTIONS(3), 1, sym_comment, - ACTIONS(277), 5, + ACTIONS(277), 4, anon_sym_AT, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(275), 46, ts_builtin_sym_end, anon_sym_RBRACE, @@ -5155,27 +5120,26 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1621] = 4, + [1595] = 4, ACTIONS(3), 1, sym_comment, STATE(86), 1, sym_opcode, - ACTIONS(17), 4, + ACTIONS(17), 3, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(15), 41, anon_sym_add, anon_sym_sub, @@ -5207,27 +5171,26 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1677] = 4, + [1650] = 4, ACTIONS(3), 1, sym_comment, STATE(33), 1, sym_opcode, - ACTIONS(281), 4, + ACTIONS(281), 3, anon_sym_lt, anon_sym_gt, anon_sym_free, - anon_sym_ior, ACTIONS(279), 41, anon_sym_add, anon_sym_sub, @@ -5259,18 +5222,18 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_pass, anon_sym_const, anon_sym_free_ctx, + anon_sym_change_tag, + anon_sym_extract_tag, anon_sym_read, anon_sym_write, anon_sym_clear, anon_sym_alloc, + anon_sym_exec, anon_sym_rd_inc, anon_sym_rd_dec, anon_sym_cmp_sw, - anon_sym_iow, - anon_sym_iorw, anon_sym_load_inst, - anon_sym_route_set, - [1733] = 13, + [1705] = 13, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5308,7 +5271,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1784] = 13, + [1756] = 13, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5346,7 +5309,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1835] = 13, + [1807] = 13, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5384,7 +5347,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1886] = 12, + [1858] = 12, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5418,7 +5381,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1932] = 10, + [1904] = 10, ACTIONS(3), 1, sym_comment, ACTIONS(49), 1, @@ -5445,7 +5408,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1969] = 8, + [1941] = 8, ACTIONS(3), 1, sym_comment, ACTIONS(49), 1, @@ -5467,7 +5430,7 @@ static const uint16_t ts_small_parse_table[] = { sym_string_literal, sym_raw_string_literal, sym_byte_string_literal, - [1999] = 3, + [1971] = 3, ACTIONS(3), 1, sym_comment, ACTIONS(253), 2, @@ -5483,7 +5446,7 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_r_DQUOTE, anon_sym_b_DQUOTE, sym_flow_in, - [2018] = 7, + [1990] = 7, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5500,7 +5463,7 @@ static const uint16_t ts_small_parse_table[] = { sym_node_ref, sym_label_ref, sym_func_ref, - [2042] = 7, + [2014] = 7, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5517,7 +5480,7 @@ static const uint16_t ts_small_parse_table[] = { sym_node_ref, sym_label_ref, sym_func_ref, - [2066] = 7, + [2038] = 7, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5534,7 +5497,7 @@ static const uint16_t ts_small_parse_table[] = { sym_node_ref, sym_label_ref, sym_func_ref, - [2090] = 6, + [2062] = 6, ACTIONS(3), 1, sym_comment, ACTIONS(11), 1, @@ -5549,7 +5512,7 @@ static const uint16_t ts_small_parse_table[] = { sym_node_ref, sym_label_ref, sym_func_ref, - [2111] = 4, + [2083] = 4, ACTIONS(289), 1, anon_sym_DQUOTE, ACTIONS(294), 1, @@ -5559,7 +5522,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(291), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [2125] = 4, + [2097] = 4, ACTIONS(294), 1, sym_comment, ACTIONS(296), 1, @@ -5569,7 +5532,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(298), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [2139] = 4, + [2111] = 4, ACTIONS(294), 1, sym_comment, ACTIONS(300), 1, @@ -5579,7 +5542,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(302), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [2153] = 4, + [2125] = 4, ACTIONS(294), 1, sym_comment, ACTIONS(304), 1, @@ -5589,7 +5552,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(302), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [2167] = 5, + [2139] = 5, ACTIONS(3), 1, sym_comment, ACTIONS(49), 1, @@ -5600,7 +5563,7 @@ static const uint16_t ts_small_parse_table[] = { sym_identifier, STATE(26), 1, sym_number_literal, - [2183] = 4, + [2155] = 4, ACTIONS(294), 1, sym_comment, ACTIONS(308), 1, @@ -5610,7 +5573,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(310), 2, aux_sym_string_literal_token1, sym_escape_sequence, - [2197] = 4, + [2169] = 4, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, @@ -5619,7 +5582,7 @@ static const uint16_t ts_small_parse_table[] = { sym_flow_out, STATE(74), 1, aux_sym_inst_def_repeat1, - [2210] = 4, + [2182] = 4, ACTIONS(3), 1, sym_comment, ACTIONS(208), 1, @@ -5628,7 +5591,7 @@ static const uint16_t ts_small_parse_table[] = { sym_flow_out, STATE(27), 1, aux_sym_inst_def_repeat1, - [2223] = 4, + [2195] = 4, ACTIONS(3), 1, sym_comment, ACTIONS(49), 1, @@ -5637,87 +5600,87 @@ static const uint16_t ts_small_parse_table[] = { sym_dec_literal, STATE(44), 1, sym_number_literal, - [2236] = 3, + [2208] = 3, ACTIONS(3), 1, sym_comment, ACTIONS(316), 1, sym_identifier, STATE(45), 1, sym_system_param, - [2246] = 3, + [2218] = 3, ACTIONS(3), 1, sym_comment, ACTIONS(316), 1, sym_identifier, STATE(34), 1, sym_system_param, - [2256] = 2, + [2228] = 2, ACTIONS(294), 1, sym_comment, ACTIONS(318), 2, aux_sym_char_literal_token1, sym_escape_sequence, - [2264] = 2, + [2236] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(320), 1, anon_sym_DQUOTE, - [2271] = 2, + [2243] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(322), 1, sym_identifier, - [2278] = 2, + [2250] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(324), 1, ts_builtin_sym_end, - [2285] = 2, + [2257] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(326), 1, anon_sym_SQUOTE, - [2292] = 2, + [2264] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(328), 1, sym_identifier, - [2299] = 2, + [2271] = 2, ACTIONS(294), 1, sym_comment, ACTIONS(330), 1, aux_sym_raw_string_literal_token1, - [2306] = 2, + [2278] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(332), 1, anon_sym_LBRACE, - [2313] = 2, + [2285] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(334), 1, sym_flow_in, - [2320] = 2, + [2292] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(336), 1, anon_sym_EQ, - [2327] = 2, + [2299] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(338), 1, sym_identifier, - [2334] = 2, + [2306] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(340), 1, sym_identifier, - [2341] = 2, + [2313] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(342), 1, sym_identifier, - [2348] = 2, + [2320] = 2, ACTIONS(3), 1, sym_comment, ACTIONS(344), 1, @@ -5726,69 +5689,69 @@ static const uint16_t ts_small_parse_table[] = { static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(28)] = 0, - [SMALL_STATE(29)] = 65, - [SMALL_STATE(30)] = 130, - [SMALL_STATE(31)] = 195, - [SMALL_STATE(32)] = 260, - [SMALL_STATE(33)] = 325, - [SMALL_STATE(34)] = 390, - [SMALL_STATE(35)] = 455, - [SMALL_STATE(36)] = 520, - [SMALL_STATE(37)] = 585, - [SMALL_STATE(38)] = 650, - [SMALL_STATE(39)] = 715, - [SMALL_STATE(40)] = 780, - [SMALL_STATE(41)] = 841, - [SMALL_STATE(42)] = 902, - [SMALL_STATE(43)] = 967, - [SMALL_STATE(44)] = 1027, - [SMALL_STATE(45)] = 1087, - [SMALL_STATE(46)] = 1147, - [SMALL_STATE(47)] = 1207, - [SMALL_STATE(48)] = 1267, - [SMALL_STATE(49)] = 1326, - [SMALL_STATE(50)] = 1385, - [SMALL_STATE(51)] = 1444, - [SMALL_STATE(52)] = 1503, - [SMALL_STATE(53)] = 1562, - [SMALL_STATE(54)] = 1621, - [SMALL_STATE(55)] = 1677, - [SMALL_STATE(56)] = 1733, - [SMALL_STATE(57)] = 1784, - [SMALL_STATE(58)] = 1835, - [SMALL_STATE(59)] = 1886, - [SMALL_STATE(60)] = 1932, - [SMALL_STATE(61)] = 1969, - [SMALL_STATE(62)] = 1999, - [SMALL_STATE(63)] = 2018, - [SMALL_STATE(64)] = 2042, - [SMALL_STATE(65)] = 2066, - [SMALL_STATE(66)] = 2090, - [SMALL_STATE(67)] = 2111, - [SMALL_STATE(68)] = 2125, - [SMALL_STATE(69)] = 2139, - [SMALL_STATE(70)] = 2153, - [SMALL_STATE(71)] = 2167, - [SMALL_STATE(72)] = 2183, - [SMALL_STATE(73)] = 2197, - [SMALL_STATE(74)] = 2210, - [SMALL_STATE(75)] = 2223, - [SMALL_STATE(76)] = 2236, - [SMALL_STATE(77)] = 2246, - [SMALL_STATE(78)] = 2256, - [SMALL_STATE(79)] = 2264, - [SMALL_STATE(80)] = 2271, - [SMALL_STATE(81)] = 2278, - [SMALL_STATE(82)] = 2285, - [SMALL_STATE(83)] = 2292, - [SMALL_STATE(84)] = 2299, - [SMALL_STATE(85)] = 2306, - [SMALL_STATE(86)] = 2313, - [SMALL_STATE(87)] = 2320, - [SMALL_STATE(88)] = 2327, - [SMALL_STATE(89)] = 2334, - [SMALL_STATE(90)] = 2341, - [SMALL_STATE(91)] = 2348, + [SMALL_STATE(29)] = 64, + [SMALL_STATE(30)] = 128, + [SMALL_STATE(31)] = 192, + [SMALL_STATE(32)] = 256, + [SMALL_STATE(33)] = 320, + [SMALL_STATE(34)] = 384, + [SMALL_STATE(35)] = 448, + [SMALL_STATE(36)] = 512, + [SMALL_STATE(37)] = 576, + [SMALL_STATE(38)] = 640, + [SMALL_STATE(39)] = 704, + [SMALL_STATE(40)] = 768, + [SMALL_STATE(41)] = 828, + [SMALL_STATE(42)] = 888, + [SMALL_STATE(43)] = 952, + [SMALL_STATE(44)] = 1011, + [SMALL_STATE(45)] = 1070, + [SMALL_STATE(46)] = 1129, + [SMALL_STATE(47)] = 1188, + [SMALL_STATE(48)] = 1247, + [SMALL_STATE(49)] = 1305, + [SMALL_STATE(50)] = 1363, + [SMALL_STATE(51)] = 1421, + [SMALL_STATE(52)] = 1479, + [SMALL_STATE(53)] = 1537, + [SMALL_STATE(54)] = 1595, + [SMALL_STATE(55)] = 1650, + [SMALL_STATE(56)] = 1705, + [SMALL_STATE(57)] = 1756, + [SMALL_STATE(58)] = 1807, + [SMALL_STATE(59)] = 1858, + [SMALL_STATE(60)] = 1904, + [SMALL_STATE(61)] = 1941, + [SMALL_STATE(62)] = 1971, + [SMALL_STATE(63)] = 1990, + [SMALL_STATE(64)] = 2014, + [SMALL_STATE(65)] = 2038, + [SMALL_STATE(66)] = 2062, + [SMALL_STATE(67)] = 2083, + [SMALL_STATE(68)] = 2097, + [SMALL_STATE(69)] = 2111, + [SMALL_STATE(70)] = 2125, + [SMALL_STATE(71)] = 2139, + [SMALL_STATE(72)] = 2155, + [SMALL_STATE(73)] = 2169, + [SMALL_STATE(74)] = 2182, + [SMALL_STATE(75)] = 2195, + [SMALL_STATE(76)] = 2208, + [SMALL_STATE(77)] = 2218, + [SMALL_STATE(78)] = 2228, + [SMALL_STATE(79)] = 2236, + [SMALL_STATE(80)] = 2243, + [SMALL_STATE(81)] = 2250, + [SMALL_STATE(82)] = 2257, + [SMALL_STATE(83)] = 2264, + [SMALL_STATE(84)] = 2271, + [SMALL_STATE(85)] = 2278, + [SMALL_STATE(86)] = 2285, + [SMALL_STATE(87)] = 2292, + [SMALL_STATE(88)] = 2299, + [SMALL_STATE(89)] = 2306, + [SMALL_STATE(90)] = 2313, + [SMALL_STATE(91)] = 2320, }; static const TSParseActionEntry ts_parse_actions[] = { diff --git a/editor/tree-sitter-dfasm/tree-sitter-dfasm.wasm b/editor/tree-sitter-dfasm/tree-sitter-dfasm.wasm deleted file mode 100755 index 0247018edc0c72cedb46fb0a73a2af82b44abb92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25611 zcmZQbEY4+QU|?VndlEkE(RAezWh%zPyMvw~0`1s7c zl+2>kxL&CT2EPMn+a9CUzHQ!T9*{#Nyoe{E7;#>wM38=cnf`XjN_>{zw#Q37roc!cs21ZT}Mh0a@ZYE|H z9!5s4Gxn^^42;~{1sIv?l^GmgG%{u>GdOOr%rawQP-bv^1Li~6AHZzK4=PZ(FA)BP z7YtB=9}s~LO^jJe3=lnkAVLe;7@=w!n!px(P=oSYAp8aDP<{u5{{Y7Cf$%qILFFev z_#HY>{uBs*0*pTc!v6r{&jIlnA&yx9W;?>1asa9m&rHR=R}f5HUBR{;5bqdADF z%;5M1BDEAOrOe>?1H!*!1eN~-;opGq8=AqsoD2)b76|__%)AZ={~XM`9ti&-Onw4{ zKOLrj3WPrs#-9P<--6jU2f}{})4u@1Z#0FvZwZ8d0mfee;ZKE`w+6z0Y5`Th0m5Gh zlivd2|Aoo#fbi$Sa-4)Bgs-p9<6e0m5&C@xMU$+hO{D zK=^xM@_!)wM=<$@7I6HZF@xIQ0^z@b$#+2b*I@EJ5dLnMc@rS~S1|QcApG|*^)n#+ z->~?c1K~f0rH2I&{x+C-OCbEGF!NSG_)lQwt%2~r!OYtL;opOqw*|t#1yjER!v701 ze-DKJ5+;8D!v6`g?+Aq72jicB@ZZ49KLg?Kg~i7O2>$}iyekm?2AF*}ApAox^>-lr zsWAQn2>%3({{+H6597ap@V~|R4fbdtr_;VoqPMH4|K=}V* z@=GB6FEIWJ2!9WZzXrm;1=GI)!oLS|&lU)O28_Q0!k-6o-yR5mGR(XK5Plboe+0sB zfbma2_zPkDGZ6j_V|c}J0V1-=I7%C+KLf&F2U9->!k-P}FM;r1z|!mr2>(7TJl3=^ zW+_0c=?x$@G@Q3U)GdRl+X3Ns!Thxc!aoL<=jH^}lLs0Zv$&6lFtX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Va~+B^elOr5G33)K0PW?)d1W?;A>$-uBll7V5jBm=`6DF%i+QVa~P(hLmCB^elcr5G6INHH)R zlwx35DaF9BM~Z==NQ!}BmNWwcw+sV=s|*7}m<$8Mb7=;KAJPmAdNK?Q($F-MA<4iH Rk7T|Y$X+Q11~+L21_0@Y2e$wK diff --git a/examples/fib_recursion.dfasm b/examples/fib_recursion.dfasm new file mode 100644 index 0000000..4b40bb2 --- /dev/null +++ b/examples/fib_recursion.dfasm @@ -0,0 +1,36 @@ +@system pe=2, sm=1 + +$fib |> { + ; ── function body ── + &n <| pass + lt &n, 2 |> &test + &test <| sweq + &n |> &test:L + + ; base case + &test:L |> @ret + + ; recursive case + sub &n, 1 |> &n1 + sub &n, 2 |> &n2 + + ; two calls, each 3 monadic IRAM slots + shared stub + &__alloc1 <| rd_inc, @ctx_alloc + &__exec1 <| exec, @fib_call_seq + &__extag1 <| extract_tag, 20 ; results arrive at offset 20 + + &__alloc1 |> &__fib_ctx_fan + &__extag1 |> &__fib_ct_ret:R + &n1 |> &__fib_ct_n:R + + &__alloc2 <| rd_inc, @ctx_alloc + &__exec2 <| exec, @fib_call_seq + &__extag2 <| extract_tag, 21 ; results arrive at offset 21 + + &__alloc2 |> &__fib_ctx_fan + &__extag2 |> &__fib_ct_ret:R + &n2 |> &__fib_ct_n:R + + ; reduction + add &r1, &r2 |> @ret ; r1 at offset 20, r2 at offset 21 +} diff --git a/tests/test_builtins.py b/tests/test_builtins.py index 66f5401..0d58d48 100644 --- a/tests/test_builtins.py +++ b/tests/test_builtins.py @@ -7,15 +7,15 @@ Tests verify: - dfasm-macros.AC8.4: Program using built-in macros assembles and runs in emulator """ -import simpy +from pathlib import Path +import simpy from lark import Lark -from pathlib import Path from asm import assemble, run_pipeline -from asm.lower import lower from asm.expand import expand from asm.ir import IRGraph +from asm.lower import lower from emu import build_topology @@ -75,7 +75,7 @@ class TestAC81_BuiltinAvailable: def test_builtins_loaded_from_constant(self): """Verify that built-in macros are available as constant.""" - from asm.builtins import BUILTIN_MACROS, _BUILTIN_LINE_COUNT + from asm.builtins import _BUILTIN_LINE_COUNT, BUILTIN_MACROS assert len(BUILTIN_MACROS) > 0 assert _BUILTIN_LINE_COUNT > 0 @@ -107,8 +107,9 @@ class TestAC81_BuiltinAvailable: """Invoking a built-in macro through pipeline produces expanded nodes.""" source = """ @system pe=1, sm=0 + &source <| pass &sink <| pass - #permit_inject &sink + #permit_inject &source |> &sink """ graph = run_pipeline(source) assert len(graph.errors) == 0 @@ -117,7 +118,11 @@ class TestAC81_BuiltinAvailable: has_p = any("&p" in n and "permit_inject" in n for n in node_names) assert has_p, f"Expected &p node from #permit_inject expansion in {node_names}" - p_node = next(n for n in graph.nodes.values() if "&p" in n.name and "permit_inject" in n.name) + p_node = next( + n + for n in graph.nodes.values() + if "&p" in n.name and "permit_inject" in n.name + ) assert p_node.const == 1, "permit_inject &p should have const=1" @@ -147,7 +152,9 @@ class TestAC82_UserMacroShadows: node_names = list(graph.nodes.keys()) has_custom_node = any("&custom_node" in n for n in node_names) - assert has_custom_node, f"Expected &custom_node from user macro shadowing built-in in {node_names}" + assert has_custom_node, ( + f"Expected &custom_node from user macro shadowing built-in in {node_names}" + ) custom_node = next(n for n in graph.nodes.values() if "&custom_node" in n.name) assert custom_node.const == 99, "User's shadowing macro should use const=99" @@ -191,6 +198,7 @@ class TestAC83_LoopCountedTopology: assert len(graph.errors) == 0 from cm_inst import ArithOp, RoutingOp + opcode_names = set() for node in graph.nodes.values(): if node.opcode is not None: @@ -199,9 +207,9 @@ class TestAC83_LoopCountedTopology: elif isinstance(node.opcode, RoutingOp): opcode_names.add(node.opcode.name.lower()) - assert 'add' in opcode_names, f"Expected 'add' opcode, got: {opcode_names}" - assert 'brgt' in opcode_names, f"Expected 'brgt' opcode, got: {opcode_names}" - assert 'inc' in opcode_names, f"Expected 'inc' opcode, got: {opcode_names}" + assert "add" in opcode_names, f"Expected 'add' opcode, got: {opcode_names}" + assert "brgt" in opcode_names, f"Expected 'brgt' opcode, got: {opcode_names}" + assert "inc" in opcode_names, f"Expected 'inc' opcode, got: {opcode_names}" def test_loop_counted_invoked_creates_feedback_topology(self): """#loop_counted invoked creates feedback arc from increment to counter. @@ -220,24 +228,38 @@ class TestAC83_LoopCountedTopology: graph = run_pipeline(source) from cm_inst import ArithOp - add_nodes = [n for n, node in graph.nodes.items() - if isinstance(node.opcode, ArithOp) and node.opcode == ArithOp.ADD] - inc_nodes = [n for n, node in graph.nodes.items() - if isinstance(node.opcode, ArithOp) and node.opcode == ArithOp.INC] - assert len(add_nodes) >= 1, f"Expected at least 1 'add' node, got {len(add_nodes)}" - assert len(inc_nodes) >= 1, f"Expected at least 1 'inc' node, got {len(inc_nodes)}" + add_nodes = [ + n + for n, node in graph.nodes.items() + if isinstance(node.opcode, ArithOp) and node.opcode == ArithOp.ADD + ] + inc_nodes = [ + n + for n, node in graph.nodes.items() + if isinstance(node.opcode, ArithOp) and node.opcode == ArithOp.INC + ] + + assert len(add_nodes) >= 1, ( + f"Expected at least 1 'add' node, got {len(add_nodes)}" + ) + assert len(inc_nodes) >= 1, ( + f"Expected at least 1 'inc' node, got {len(inc_nodes)}" + ) edge_pairs = [(edge.source, edge.dest, edge.port) for edge in graph.edges] add_node = add_nodes[0] inc_node = inc_nodes[0] has_feedback = any( - src == inc_node and dst == add_node - and (port.name == 'R' if hasattr(port, 'name') else port == 'R') + src == inc_node + and dst == add_node + and (port.name == "R" if hasattr(port, "name") else port == "R") for src, dst, port in edge_pairs ) - assert has_feedback, f"Expected feedback edge from inc to counter, edges: {edge_pairs}" + assert has_feedback, ( + f"Expected feedback edge from inc to counter, edges: {edge_pairs}" + ) class TestAC84_EndToEnd: @@ -278,15 +300,16 @@ class TestAC84_EndToEnd: outputs = run_program_direct(source, until=500) all_values = [] for pe_outputs in outputs.values(): - all_values.extend([t.data for t in pe_outputs if hasattr(t, 'data')]) + all_values.extend([t.data for t in pe_outputs if hasattr(t, "data")]) assert 7 in all_values, f"Expected 3+4=7 in outputs, got {all_values}" def test_builtin_permit_inject_assembles_and_runs(self): """#permit_inject assembles and expands to const nodes.""" source = """ @system pe=1, sm=0 + &source <| pass &sink <| pass - #permit_inject &sink + #permit_inject &source |> &sink """ result = assemble(source) assert result is not None @@ -332,8 +355,9 @@ class TestBuiltinSyntaxValidation: """#permit_inject variadic macro is defined.""" from asm.builtins import BUILTIN_MACROS - assert "#permit_inject *targets" in BUILTIN_MACROS, \ + assert "#permit_inject *targets" in BUILTIN_MACROS, ( "Expected variadic #permit_inject definition in BUILTIN_MACROS" + ) def test_reduce_variants_defined_in_builtins(self): """All #reduce_2 through #reduce_4 are defined with op parameter.""" @@ -341,8 +365,9 @@ class TestBuiltinSyntaxValidation: for i in range(2, 5): macro_name = f"#reduce_{i}" - assert f"{macro_name} op" in BUILTIN_MACROS, \ + assert f"{macro_name} op" in BUILTIN_MACROS, ( f"Expected '{macro_name} op' definition in BUILTIN_MACROS" + ) start = BUILTIN_MACROS.find(f"{macro_name} op") end = BUILTIN_MACROS.find("\n#", start + 1) @@ -350,8 +375,9 @@ class TestBuiltinSyntaxValidation: end = len(BUILTIN_MACROS) macro_body = BUILTIN_MACROS[start:end] - assert "${op}" in macro_body, \ + assert "${op}" in macro_body, ( f"{macro_name} should use '${{op}}' parameter for opcode" + ) class TestBuiltinComposition: @@ -399,16 +425,17 @@ class TestBuiltinComposition: } &sink <| pass - #my_const - #permit_inject &sink + &source <| add, #my_const + + #permit_inject &source |> &sink """ graph = run_pipeline(source) assert len(graph.errors) == 0 node_names = list(graph.nodes.keys()) - has_val = any("&val" in n for n in node_names) + has_val = any("&source" in n for n in node_names) has_p = any("&p" in n and "permit_inject" in n for n in node_names) - assert has_val, f"Expected user macro &val in {node_names}" + assert has_val, f"Expected user macro &source in {node_names}" assert has_p, f"Expected builtin &p in {node_names}" @@ -432,5 +459,5 @@ class TestLineNumberOffset: """ graph = run_pipeline(source) - assert hasattr(graph, 'builtin_line_offset') + assert hasattr(graph, "builtin_line_offset") assert isinstance(graph.builtin_line_offset, int) -- 2.51.2