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

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:
2026-05-09 12:24:48 +00:00
parent 5c587c0f61
commit 097c7f4590
3 changed files with 50 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
"anagram_check.ml": 2,
"anagrams.ml": 3,
"bag.ml": 3,
"bf_full.ml": 6,
"bigint_add.ml": 28,
"bits.ml": 21,
"balance.ml": 3,