一款类C编译器的设计与实现毕业论文

 2021-04-12 04:04

摘 要

随着时代的高速发展,计算机已经广泛运用到了千家万户,在这个领域中计算机中的重要性更是不言而喻。从刚开始的时候程序员使用机器语言编写程序,到现在使用汇编语言以及更加高级的程序设计语言来编写程序。这其中就体现出了编译技术的重要性,可以这么说编译技术 是作为计算机发展语言的支柱而存在的,而使用编译语言制作出来的编译器更是作为人类与计算机交流不可或缺的一部分。

编译技术也可以算是计算机科学发展中发展的最为迅速,最为成熟的一个分支,在于它集中的体现了计算机发展的成果还有精华。它的核心思想也就是一种语言转化成另一种语言,只不过它们的逻辑结构和思想是同样的。从高级语言通过编译器编译成为机器语言,这之中的层层转化都涉及到了编译技术的应用。

编译器作为编译技术的体现者也有着不可忽略的重要性,作为人类与机器之间的桥梁它的重要性是不可言喻的,作为本次毕业设计的主要任务,本次实现的了类C编译器采用了C语言的一个子集,用类C语言来制作编译完成。

本次论文主要介绍了本课题的开发背景,所要完成的功能以及开发的过程。重点说明了类C编译器设计的重点,设计的思想,技术难点以及解决的方案。

关键词:编译技术; 编译原理; 类C语言; 类C编译器

Design and Implementation of a Mini C Compiler

ABSTRACT

With the rapid development of the times, the Computer has been widely used to millions of households, in this area the importanCe of the Computer is self-evident.From the beginning, programmers use maChine language to write programs, and now use assembly language and more advanCed programming language to write program. WhiCh refleCts the importanCe of Compiling teChnology, it Can be said that the Compiler teChnology as a pillar of Computer development language exists, And the use of Compiled language Compiler is made as an indispensable part of human and Computer CommuniCation.

Compilation teChnology Can also be regarded as the development of Computer sCienCe in the development of the most rapid and most mature one branCh, is that it embodies the CalCulation of the CalCulation MaChine development results are the essenCe. Its Core idea is that one language is transformed into another language, but their logiCal struCture and thought Is the same. From the high-level language Compiled by the Compiler into a maChine language,whiCh among the layers of Conversion are related to the appliCation of Compiler teChnology.

Compiler as a Compiler of the embodiment of the teChnology also has a non-negligible importanCe, as a bridge between man and the maChine his importanCe is not words Yu, as the main task of this graduation design, the realization of the mini C Compiler using a subset of C language, using C language to Compile and Complete.

This paper mainly introduCes the baCkground of the development of this subjeCt, the funCtions to be Completed and the development proCess. FoCusing on the foCus of mini C Compiler design, design ideas, teChniCal diffiCulties and solutions.

Key words: Compilation teChniques; Compilation prinCiples; mini C language; mini C Compiler

目 录

1 绪论 - 1 -

1.1 课题研究背景和意义 - 1 -

1.2 国内外研究现状 - 1 -

1.2.1 国内研究现状 - 1 -

1.2.2 国外研究现状 - 1 -

1.3 论文研究内容和结构 - 2 -

2 类C语言及编译器介绍 - 2 -

2.1 类C语言 - 3 -

2.1.1 类C语言的简介 - 3 -

2.2 编译器介绍 - 4 -

2.2.1 什么是编译器 - 4 -

2.2.2 为什么要用编译器 - 4 -

2.2.3 编译器的功能 - 4 -

3 C-编译器的整体构造 - 2 -

3.1 编译器的基本流程 - 6 -

3.1.1 扫描程序 - 4 -

3.1.2 语法分析程序 - 4 -

3.1.3 语义分析程序 - 4 -

3.1.4 源代码优化程序 - 4 -

3.1.5 代码生成器 - 4 -

3.1.6 目标代码优化程序 - 4 -

3.2 C-编译器中的主要数据结构 - 7 -

3.2.1 记号 - 4 -

3.2.2 语法树 - 4 -

3.2.3 符号表 - 4 -

3.2.4 常数表 - 4 -

3.2.5 中间代码 - 4 -

3.2.6 临时文件 - 4 -

4 C-编译器的设计 - 11 -

4.1 概要设计 - 11 -

4.1.1 C-编译器简介 - 11 -

4.1.2 C-编译器的开发环境 - 11 -

4.1.3 C-编译器开发使用环境 - 4 -

4.2 详细设计 - 12 -

4.2.1 C-编译器的整体框架 - 12 -

4.2.2 目标代码运行时的环境 - 20 -

5 C-编译器的测试及实现 - 22 -

5.1 编译器界面模块及编译运行模块 - 22 -

5.2 主要技术难题及解决方案 - 22 -

结 论 - 22 -

致 谢 - 28 -

参考文献 - 31 -

1 绪论

1.1 课题研究背景和意义

从现实情况来看,用类C语言编译出的类C编译器还是有着它自己独特的价值有着吸引别人的魅力,所以这就导致了一直以来国内外的专家们对这一方面的研究保持着很大的积极性,对这方面的探索和项目研究也是很热情。类C编译器这一研究在我们这一行还是保持着一定的神秘感,吸引着许多国内外学者的目光。[12]

1.2 国内外研究现状

您需要先支付 80元 才能查看全部内容!立即支付

课题毕业论文、开题报告、任务书、外文翻译、程序设计、图纸设计等资料可联系客服协助查找,优先添加企业微信。