Font Size: a A A

The Design And Implementation Of C Complier Intermediate Code Generation And Backend

Posted on:2017-04-03Degree:MasterType:Thesis
Country:ChinaCandidate:L LiFull Text:PDF
GTID:2308330485986114Subject:Computer system architecture
Abstract/Summary:PDF Full Text Request
This thesis focuses on the implementation technique of C compiler. There have already been a variety of practical compilers for people to use currently. However, since the complier technique involves many underlying deals of computer technology which is hard to learn and manage, the vast majority of researchers are still not very clear of the internal implementation mechanism of compiler. More research on compiler technology, not only helps researchers design better software, but also contributes to developments of computer science. Therefore, designing and implementing a compiler which has clearly architecture and function is of great significance for revealing the principles of compiler implementation and helping researchers understand the nature of program running environment.This thesis analyzes the functions of different modules of compilers and remaining developing problems. For different processing modules of compliers, this thesis designs corresponding data structures and framework to describe basic implementation technology of compilers. To reveal the working process of compliers more clearly, there are many featuress on data structure design and algorithm implementation in this thesis:1. The implementation of LR parsing techniques. Unlike methods in existing complier tutorials which select production through computing items, the parser of this thesis is based on table-driven framework, which simplifies the implementation of LR parser.2. The design and implementation of intermediate code generator. In this thesis, the author designs data structure to describe the function of intermediate code generator, designs and implements main algorithm framework for intermediate code generation, translates expressions and statements of the source program into the appropriate intermediate code representations.3. The design and implementation of assembly code generator. In this thesis, the author designs data structure to describe the function of assembly code generator, designs and implements the main algorithm framework for assembly code output, translates source program into object code in the form of assembly code.4. The implementation of object code optimization. In this thesis, the author designs equivalent-classes table to optimize the object code in the form of assembly code generated, eliminating redundant instruction computing.Final experimental results indicate that the implemented C compiler can translate the source program into object code in the form of assembly code, and can be executed successfully and correctly. C compiler of this thesis has a clear architecture design for data structure and algorithm, which makes it easy to understand the basic principles of compiler technology and implementation. Based on this, we can also do further optimization.
Keywords/Search Tags:intermediate code generation, assembly code generation, optimization
PDF Full Text Request
Related items