Developing a C compiler

The compiler is an essential tool in the software development process, and the development of a compiler encapsulates many advanced concepts in the realm of computer science. In this project, a C compiler is developed from scratch. The compiler is capable of translating C11-compliant source code int...

Full description

Saved in:
Bibliographic Details
Main Author: Zhong, Ruoyu
Other Authors: Huang Shell Ying
Format: Final Year Project
Language:English
Published: Nanyang Technological University 2024
Subjects:
C
Online Access:https://hdl.handle.net/10356/175271
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Nanyang Technological University
Language: English
Description
Summary:The compiler is an essential tool in the software development process, and the development of a compiler encapsulates many advanced concepts in the realm of computer science. In this project, a C compiler is developed from scratch. The compiler is capable of translating C11-compliant source code into the target machine's native code. It is designed with a modern, modular architecture with seven major components, including the lexer, the parser, the semantic analyser, the intermediate code generator, the target-independent optimiser, the target-specific optimiser, and the code generator. LLVM Core libraries are used to support the code generation and optimisation stages. Special techniques are employed to address the implementation challenges, which include recovery of symbol table state in backtracking, disambiguation of typedef names with identifiers, and inference of complex type names.