ocaml: phase 5.1 bf_full.ml baseline (full Brainfuck with [] loops, +++[.-] = 6)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Extends the iter-92 brainfuck.ml subset interpreter with bracket
matching:
'[' if mem[ptr] = 0, jump past matching ']'
(forward depth-counting scan: '[' increments depth, ']' decrements)
']' if mem[ptr] <> 0, jump back to matching '['
(backward depth-counting scan)
Test program '+++[.-]':
+++ set cell 0 = 3
[ enter loop (cell != 0)
. acc += cell
- cell -= 1
] loop while cell != 0
result: acc = 3 + 2 + 1 = 6
Tests deeply nested while loops, mutable pc / ptr / acc, multi-arm
if/else if dispatch on chars + nested begin/end blocks for loop
body conditionals.
58 baseline programs total.
This commit is contained in:
@@ -407,6 +407,13 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-09 Phase 5.1 — bf_full.ml baseline (Brainfuck interpreter
|
||||
with `[`/`]` loops, `+++[.-]` → 3+2+1 = 6). Extends the iter-92
|
||||
brainfuck.ml subset with bracket matching: `[` jumps past matching
|
||||
`]` if cell is zero (forward depth-counting scan); `]` jumps back
|
||||
to matching `[` if cell is non-zero (backward depth-counting scan).
|
||||
Tests deeply nested while loops, mutable pc + ptr + acc, multi-arm
|
||||
if-else if dispatch on chars. 58 baseline programs total.
|
||||
- 2026-05-09 Phase 5.1 — anagram_check.ml baseline (char-frequency
|
||||
array, 2/4 pairs are anagrams). to_counts builds a 256-slot int
|
||||
array of character frequencies. same_counts compares two arrays
|
||||
|
||||
Reference in New Issue
Block a user