Tooling
Compiler targeting ARMv7 Assembly
A full compiler, from lexical analysis to ARMv7 Assembly that runs on the simulator — in plain Python, with no dependencies.
55/55
tests passing, from token recognition to the assembly that runs on the simulator
- Conditions
- pytest on the repository tree · 17 lexer, 12 parser, 18 type system and 8 end-to-end
- Role
- Co-author
- Context
- PUCPR — Formal Languages and Compilers
- Period
- 2026
- Status
- Public · academic project, built by two of us
A compiler for a language in reverse Polish notation, built for the Formal Languages and Compilers course at PUCPR. The path is complete: lexical and syntactic analysis over a documented EBNF grammar, a symbol table, strong static typing checked on the attributed syntax tree, and ARMv7 Assembly generation — the output actually runs on the Cpulator simulator.
Written in pure Python with no runtime dependencies: clone and run. That was deliberate, because the point of the exercise is for every stage of the compiler to be visible in the code rather than hidden behind a parser generator.
It was built in a pair, and we reviewed each other’s code through pull requests. The hardest part was code generation: the source language’s semantics are simple, but mapping expressions onto ARMv7 registers while respecting the calling convention forces the attributed tree to be right first — a type error that slips through becomes assembly that assembles fine and quietly does the wrong thing.