Add JIT acceleration, documentation, and BDD feature tests#3
Merged
Conversation
…provements - Implement IR compilation with run-length encoding for 2-3x speedup - Replace Cells(dict) with optimized list-backed tape for faster cell access - Inline library loading without throwaway execution - Fix O(n²) command history accumulation - Add direct IR dispatch loop eliminating dict lookups - Fix correctness issues (bare except, filter library comments) - Add CLI entry point to pyproject.toml - All doctests pass, backward compatibility preserved
Performance: - Add Numba JIT-compiled execution path for pure-computation programs - Add IR compilation with run-length encoding (+++++ -> single add-5 op) - Add pre-resolved jump targets in compiled IR - Replace Cells(dict) with list-backed tape + sparse dict for negative indices - Inline library loading without throwaway BrainFuck instance execution - Fix O(n²) command history accumulation (list append instead of string concat) Documentation: - Add product definition, glossary, system overview, technical design - Add domain model, context map, ADRs for IR compilation and JIT acceleration - Add feature files for core-interpreter, jit-acceleration, library-imports - Add interview notes, research synthesis, branding guide, visual assets - Add CHANGELOG.md, update README.md and pyproject.toml Tests: - Add 16 BDD feature tests (1 per @id tag in feature files) - Add 19 unit contract tests for IR compilation, numeric conversion, and Cells - All 36 tests passing, doctests passing (8/8 brainfuck.py, 6/6 how-to-use.md) Correctness: - Replace bare except: with except (ValueError, TypeError): - Remove Python 2 cruft (from __future__ import print_function) - Filter library .bf files to valid BF commands only - Fix regex escape warnings in import_lib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Performance Changes
Test Plan
brainfuck -c '+++.>'){p10}*{tochar})Files Changed
brainfuck.py— Core interpreter with JIT acceleration, IR compilation, optimized Cellspyproject.toml— Updated description, version 0.2.0, added numba/numpy deps, CLI entry pointREADME.md— Complete rewrite reflecting current architectureCHANGELOG.md— v0.1.0 → v0.2.0 changelogdocs/spec/— Product definition, glossary, system overview, technical design, domain model, context mapdocs/adr/— ADRs for IR compilation and JIT acceleration decisionsdocs/features/— BDD feature files for core-interpreter, jit-acceleration, library-importsdocs/branding/— Branding guide with palette and visual identitydocs/interview-notes/— Requirements interview notesdocs/research/— Performance research synthesisdocs/assets/— Logo and banner SVGstests/features/— 16 BDD feature tests (1 per @id)tests/unit/— 19 unit contract testsconftest.py— Test path configuration