Bleach: A Programming Language for Teaching Compilers

  • Victor Costa UFPE
  • Leopoldo Teixeira UFPE

Resumo


Programming languages designed as teaching tools for undergraduate Compilers courses occupy a constrained design space. Existing options such as COOL and MiniJava are deliberately minimal and statically typed, while ChocoPy targets compilation rather than interpretation. This paper presents Bleach, a dynamically typed, object-oriented programming language with a tree-walk interpreter implemented in C++, designed to fill the gap left by these alternatives. Structurally inspired by Lox (from Crafting Interpreters), Bleach extends it with multi-line comments, do-while and for loops, elif clauses, a ternary operator, a list type, break/continue statements, an expanded standard library, and a resolver that statically detects 10 distinct classes of scoping and control-flow errors. We present the language’s design rationale, describe the architecture and key implementation decisions of its interpreter, and compare Bleach feature-by-feature with ChocoPy, COOL, and MiniJava, positioning it in the space of compiler-teaching languages. We validated the interpreter through a 44-case test suite covering all AST node types and by implementing 11 standard algorithms and data structures in the language; all test cases pass, and every algorithm runs correctly without modification to the language. Despite the lack of an empirical pedagogical evaluation, we outline how Bleach could be incorporated into a 15-week undergraduate introductory Compilers course.
Palavras-chave: Teaching, Compilers

Referências

Alfred V. Aho. 2008. Teaching the compilers course. ACM SIGCSE Bulletin 40, 4 (2008), 6–8.

Alexander Aiken. 1996. Cool: A portable project for teaching compiler construction. ACM Sigplan Notices 31, 7 (1996), 19–24.

Andrew W. Appel and Jens Palsberg. 2002. Modern Compiler Implementation in Java, 2nd Edition. Cambridge University Press.

Keith D Cooper and Linda Torczon. 2022. Engineering a compiler. Morgan Kaufmann.

Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi. 2018. How to Design Programs: An Introduction to Programming and Computing (second ed.). MIT Press.

Python Software Foundation. 2024. Python Programming Language, Version 3.12.5. [link]. Accessed: 2024-09-02.

Tony Hoare. 2009. Null References: The Billion Dollar Mistake. [link] Presentation at QCon London 2009. Accessed 20 September 2024..

Christoph Kirsch. 2017. Selfie | Official GitHub Repository. [link]. Accessed: 2024-09-07.

Christoph M. Kirsch. 2017. Selfie and the Basics. In Proceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software. 198–213.

Divya Kundra and Ashish Sureka. 2016. An experience report on teaching compiler design concepts using case-based and project-based learning approaches. In 2016 IEEE Eighth International Conference on Technology for Education (T4E). IEEE, 216–219.

John HE Lasseter. 2015. The Interpreter In An Undergraduate Compilers Course. In Proceedings of the 46th ACM Technical Symposium on Computer Science Education. 168–173.

Benjamin S. Lerner, Joe Gibbs Politz, and Shriram Krishnamurthi. 2017. Pyret. [link]. Accessed: 2024-09-02.

Yukihiro Matsumoto. 2023. Ruby Programming Language. [link] Version 3.2.

Robert Nystrom. 2021. Crafting interpreters. Genever Benning.

University of Salzburg. 2017. Selfie | An educational software system of a tiny self-compiling C compiler, a tiny self-executing RISC-V emulator, and a tiny self-hosting RISC-V hypervisor. [link]. Accessed: 2024-09-07.

Rohan Padhye, Koushik Sen, and Paul N Hilfinger. 2019. Chocopy: A programming language for compilers courses. In Proceedings of the 2019 ACM SIGPLAN Symposium on SPLASH-E. 41–45.
Publicado
08/09/2026
COSTA, Victor; TEIXEIRA, Leopoldo. Bleach: A Programming Language for Teaching Compilers. In: SIMPÓSIO BRASILEIRO DE LINGUAGENS DE PROGRAMAÇÃO (SBLP), 30. , 2026, São Paulo/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2026 . p. 116-123. DOI: https://doi.org/10.5753/sblp.2026.28580.