About SLangCC¶
Small Language Compiler for Classroom (SLangCC) is a small C-like language compiler for classroom use. It is implemented with Flex, Bison, and C++.
Pipeline¶
.sl source
→ lexer and Bison parser
→ abstract syntax tree
→ semantic analysis and symbol table
→ SLangIR
→ x86-64 assembly
→ GCC/Clang and the SLang runtime
→ native executable
The repository separates these stages into lexer/, parser/, semantic_analyzer/, SLangIR/, codegen/, and driver/. Optional compiler flags expose the AST, checked AST, IR, and assembly for study.
Teaching focus¶
The language is intentionally compact while covering a complete compilation workflow: tokenization, parsing, AST construction, name and type analysis, intermediate representation, control-flow lowering, machine-code generation, and native linking.
Current target¶
The generated assembly targets x86-64 Linux using the System V ABI. SLangCC uses GCC when available and otherwise tries Clang.