B-minor Compiler Build

Job ID: 38178951

Budget: €30 – €250 EUR

I am in need of an expert in compiler design and construction to build an efficient compiler for B-minor. The project requires specifics such as:

- Syntax checking: to ensure the source code meets the requirements of programming language rules and grammar.

- Optimizations: to improve the performance and quality of the generated code.

- Code generation: result into target language code, once the source code has been analyzed for correctness.

The ideal freelancer should have exceptional expertise in B-minor language with a keen eye for details. Experience in compiler construction is a must-have. The created compiler should be compatible with Windows and Linux platforms. I look forward to receiving your bids.

Mission Statement
Build a Compiler!

Input: Source Code in the programming language b-minor (.b) (http://compilerbook.org)
Output: Assembly Code (.s) for x86_64 Linux systems
The assembly code should be able to be assembled and linked into an executable program using the gcc toolchain.

The compiler should consist of several steps.
All steps should be carried out within one process, i.e., the intermediate formats AST and IR (see below) are "in memory".
For debugging purposes, these intermediate formats should also be output in a readable form.

- Frontend
- Reading b-minor source code
- Lexer/Scanner
- Parser
- Generation of AST (Abstract Syntax Tree) and auxiliary data (type system, symbol table, etc.)
- Middle
- Semantic analysis (symbols, type compatibility) at the AST level
- Simple optimizations at the AST level
- Generation of an IR (Intermediate Representation)
- Backend
- Mapping of the IR to the specific target architecture (register assignment, stack layout, ABI)
- Optimization (at least a few simple methods)
- Generation and output of assembly code as ASCII text file (.s)

For the frontend, tools should be evaluated and possibly used, see the list in Moodle.
The frontend can also be manually implemented.
The backend should be manually implemented.
The programming language for the compiler should be C, C++, or Python.
Other tools or programming languages can be used after consultation with the instructors.

There are no specific requirements for the concrete implementation of AST and IR.

Start with the simplest subset of the language and gradually expand it.
Build in depth first, so that you always have a runnable MVP (minimal viable product).
Create many small source code examples (unit tests) to verify the translation of individual language constructs in different contexts.
Create several larger, more challenging source code examples that will convince the instructors (and yourself) of the compiler's capability.
Develop a strategy for automated testing for frequent regression tests.
Assume that you will refactor (or completely replace) the code multiple times.
By the end, your compiler should master a Turing-complete subset of the source code language.