How imgajeed76/bfscript works
Project Type & Purpose
• This is a compiler/interpreter project. Its purpose is to allow developers to write code in an easier, C-inspired syntax and then compile that code into Brainfuck, which is then executed by a custom interpreter.
• The README outlines that the compiler provides familiar constructs – such as variable declarations, loops and conditionals – and that the interpreter can execute the produced Brainfuck code. It also explicitly emphasizes a 32-bit cell architecture.
File Structure
• Top-Level Files & Directories:
• The root directory includes key files like compiler.py and interpreter.py. These act as the entry points for command-line usage.
• The lib directory further divides the implementation into submodules:
◦ lib/compiler: Contains modules such as assembler.py, compiler.py, memory_manager.py, preprocessing.py, scope_manager.py, transformer.py, and a grammar file (brainfuckscript.lark). Test files for the compiler are included here.
◦ lib/interpreter.py and lib/test_interpreter.py provide the core logic and tests for the Brainfuck interpreter.
• Examples Directory:
• Contains sample source code (e.g., pyramid.bfs) used for demonstration.
• Configuration Files:
• pyproject.toml configures dependencies and builds with Poetry.
• .gitignore and LICENSE.md handle version control and licensing.