Optimalizace frontendu překladače

Abstract

This bachelor thesis focuses on the optimization of a C language compiler frontend. The thesis analyzes compiler architecture, formal language theory, and existing compiler implementations (GCC, Clang/LLVM, TCC). Based on this analysis, a compiler called cppliator is designed and implemented in C++23, with a backend utilizing the LLVM library. Key optimization techniques include data-oriented design with a flat array representation of the abstract syntax tree, an explicit state machine instead of recursive descent parsing, a Pratt parser for operator-precedence expression parsing, extensive use of constexpr lookup tables, and support for parallel parsing. The resulting compiler achieves an 10x throughput improvement compared to gcc.

Description

Delayed publication

Available after

Subject(s)

compiler, frontend, optimization, C~language, parsing, lexical analysis, data-oriented design, abstract syntax tree, Pratt parser, parallel parsing

Citation