Compiler - 编译器
The first compiler was build by John Backum and his group between 1954 and 1957 at IBM.
编译器就是将高级语言翻译为低级语言的程序。
FORTRAN one was the first successful high level language
FORTRAN语言是Formula Translation的缩写,意为“公式翻译”。它是为科学、工程问题或企事业管理中的那些能够用数学公式表达的问题而设计的,其数值计算的功能较强。
FORTRAN语言是世界上第一个被正式推广使用的高级语言。它是1954年被提出来的,1956年开始正式使用,直到2021年已有六十年的历史,但仍历久不衰,它始终是数值计算领域所使用的主要语言。
1. What is a Compiler?
A compiler is a computer program which helps you transform source code written in a high-level language into low-level machine language. It translates the code written in one programming language to some other language without changing the meaning of the code. The compiler also makes the end code efficient which is optimized for execution time and memory space.
编译器是一种计算机程序,可以帮助你将以高级语言编写的源代码转换为低级机器语言。它将以一种编程语言编写的代码转换为另一种语言,而无需更改代码的含义。编译器对代码执行时间和存储空间进行优化,使最终代码高效率。
The compiling process includes basic translation mechanisms and error detection. Compiler process goes through lexical, syntax, and semantic analysis at the front end, and code generation and optimization at a back end.
编译过程包括基本的转换机制和错误检测。编译器过程在前端进行词法,语法和语义分析,在后端进行代码生成和优化。
front end: lexical, syntax, and semantic analysis
back end: code generation and optimization
lexical ['leksɪk(ə)l]:adj. 词汇的
syntax ['sɪntæks]:n. 句法,句法规则,语构
semantic [sə'mæntɪk]:adj. 语义的

2. 编译器类型
2.1 Single Pass Compilers

In single pass Compiler source code directly transforms into machine code. For example, Pascal language.
2.2 Two Pass Compilers

Two pass Compiler is divided into two sections, viz.
- Front end: It maps legal code into Intermediate Representation (IR).
- Back end: It maps IR onto the target machine
The Two pass compiler method also simplifies the retargeting process. It also allows multiple front ends.
videlicet [vɪ'deləsɪt]:adv. 即
viz. [vɪz]:adv. 即,就是
2.3 Multipass Compilers

The multipass compiler processes the source code or syntax tree of a program several times. It divided a large program into multiple small programs and process them. It develops multiple intermediate codes. All of these multipass take the output of the previous phase as an input. So it requires less memory. It is also known as ‘Wide Compiler’.
multipass compiler 会多次处理程序的源代码或语法树。它将一个大型程序划分为多个小型程序并进行处理。它开发了多个中间代码。所有这些多通道都将前一阶段的输出作为输入。因此,它需要更少的内存。它也被称为 Wide Compiler。
3. Language processing systems
源代码 (source code) -> 预处理器 (preprocessor) -> 编译器 (compiler) -> 目标代码 (object code) -> 链接器 (Linker) -> 可执行程序 (executables)

Preprocessor: The preprocessor is considered as a part of the Compiler. It is a tool which produces input for Compiler. It deals with macro processing, augmentation, language extension, etc.
预处理器被视为编译器的一部分。它是为编译器生成输入的工具。它处理宏处理,扩充,语言扩展等。
Interpreter: An interpreter is like Compiler which translates high-level language into low-level machine language. The main difference between both is that interpreter reads and transforms code line by line. Compiler reads the entire code at once and creates the machine code.
解释器就像编译器一样,可以将高级语言翻译成低级机器语言。两者之间的主要区别是解释器逐行读取和转换代码。编译器立即读取整个代码并创建机器代码。
Assembler: It translates assembly language code into machine understandable language. The output result of assembler is known as an object file which is a combination of machine instruction as well as the data required to store these instructions in memory.
它将汇编语言代码转换为机器可理解的语言。汇编器的输出结果称为目标文件,该文件是机器指令以及将这些指令存储在内存中所需的数据的组合。
Linker: The linker helps you to link and merge various object files to create an executable file. All these files might have been compiled with separate assemblers. The main task of a linker is to search for called modules in a program and to find out the memory location where all modules are stored.
链接器可帮助您链接和合并各种目标文件以创建可执行文件。所有这些文件可能都已使用单独的汇编器进行了编译。链接器的主要任务是在程序中搜索被调用的模块,并找出所有模块的存储位置。
Loader: The loader is a part of the OS, which performs the tasks of loading executable files into memory and run them. It also calculates the size of a program which creates additional memory space.
加载程序是操作系统的一部分,它执行将可执行文件加载到内存中并运行它们的任务。它还计算程序的大小,该程序将创建额外的内存空间。
Cross-compiler: A cross compiler is a platform which helps you to generate executable code.
交叉编译器是一个可帮助您生成可执行代码的平台。
Source-to-source Compiler: Source to source compiler is a term used when the source code of one programming language is translated into the source of another language.
源到源编译器是将一种编程语言的源代码转换为另一种语言的源时使用的术语。
4. Compiler Construction Tools
These tools use specific language or algorithm for specifying and implementing the component of the compiler.
这些工具使用特定的语言或算法来指定和实现编译器的组件。
Scanner generators: This tool takes regular expressions as input. For example LEX for Unix Operating System.
该工具将正则表达式作为输入。例如,用于 Unix 操作系统的 LEX。
Syntax-directed translation engines: These software tools offer an intermediate code by using the parse tree. It has a goal of associating one or more translations with each node of the parse tree.
这些软件工具通过使用解析树提供中间代码。它的目标是将一个或多个转换与解析树的每个节点相关联。
Parser generators: A parser generator takes a grammar as input and automatically generates source code which can parse streams of characters with the help of a grammar.
解析器生成器将语法作为输入,并自动生成可在语法帮助下解析字符流的源代码。
Automatic code generators: Takes intermediate code and converts them into Machine Language
接受中间代码并将其转换为机器语言。
Data-flow engines: This tool is helpful for code optimization. Here, information is supplied by user and intermediate code is compared to analyze any relation. It is also known as data-flow analysis. It helps you to find out how values are transmitted from one part of the program to another part.
该工具有助于代码优化。在此,信息由用户提供,并且将中间代码进行比较以分析任何关系。也称为数据流分析。它可以帮助您了解如何将值从程序的一个部分传输到另一部分。
intermediate representation,IR:中间表示
front end:前端
back end:后端
References
https://www.guru99.com/compiler-design-tutorial.html
http://personal.kent.edu/~rmuhamma/Compilers/MyCompiler/phase.htm
Compiler - 编译器的更多相关文章
- JSP编译成Servlet(五)JDT Compiler编译器
通过JSP编译器编译后生成了对应的java文件,接下去要把Java文件编译成class文件.对于这部分完全没有必要重新造轮子,常见的优秀编译工具有Eclipse JDT Java编译器和Ant编译器. ...
- 玩转轻巧型C/C++ IDE之C-Free(配置GCC、Visual C++、Borland C++编译器)
玩转轻巧型C/C++ IDE之C-Free(配置GCC.Visual C++.Borland C++编译器) 之前在写一点简单的C/C++代码时习惯了VC++6.0,但是由于在windows7下VC6 ...
- c 编译器大全
c 编译器大全 看了下nginx的auto/cc下的目录,nginx对多种c语言的编辑器都进行了支持.才知道c语言有那么多编辑器. 编译器原理 所谓编译器,就是执行下面的三步骤: 1 将目标语言转换为 ...
- 编译器与Debug的传奇:Grace Murray Hopper小传
摘要: 改变世界的程序员前辈. 来自:http://www.road2stat.com/cn/network_3c/grace_murray_hopper.html 这两天读<UNIX痛恨者手册 ...
- Windows下的Objective-C集成开发环境(IDE)(转)
Objective-C是苹果软件的编程语言,想要上机学习.调试,有一个集成开发环境(IDE)方便很多.有三类方法搭建Objective-C的集成开发环境: 1) 使用苹果的平台,集成开发环境使用X ...
- 75篇关于Tomcat源码和机制的文章
75篇关于Tomcat源码和机制的文章 标签: tomcat源码机制 2016-12-30 16:00 10083人阅读 评论(1) 收藏 举报 分类: tomcat内核(82) 版权声明:本文为 ...
- Java基础常见英语词汇
Java基础常见英语词汇(共70个) ['ɔbdʒekt] ['ɔ:rientid]导向的 ['prəʊɡræmɪŋ]编程 OO: object ...
- IT软件开发常用英语词汇
Aabstract 抽象的abstract base class (ABC)抽象基类abstract class 抽象类abstraction 抽象.抽象物.抽象性access 存取.访问access ...
- SQLite剖析之内核研究
先从全局的角度把握SQLite内核各个模块的设计和功能.SQLite采用了层次化.模块化的设计,而这些使得它的可扩展性和可移植性非常强.而且SQLite的架构与通用DBMS的结构差别不是很大,所以它对 ...
- jquery 中一些 特殊方法 的特殊使用 一览表
cnblogs的页面, 一种是管理页面, 是随笔的列表 a full list of essays. 另一种是 首页. 要搜索文档的话, 就使用 "首页"的那种方式. 一个jque ...
随机推荐
- anaconda 报错之Solving environment: failed
1问题: 在新电脑上重装了anaconda,发现创建一个新环境都报错"Solving environment: failed",已经添加了清华源,还是报错,查找了很多答案都不能解决 ...
- GStreamer开发笔记(四):ubuntu搭建GStreamer基础开发环境以及基础Demo
前言 本篇开始gstreamer的编程学习,先搭建基础的环境,跑通一个基础的Demo对GStreamer编程有个初步的了解. Demo GStreamer GStreame ...
- 腾讯IMA VS 飞书知识问答:谁才是2025最强AI知识库?
AI创业失败,可私聊经验教训分享... 前几天小伙伴在讨论我开发的一套社群运营AI分身,其本质其实是一套个人知识库的AI产品,其依赖的就是我过往发布的文章. 这类AI聊天分身,最简单.不考虑" ...
- L1-3、Promp常见任务类型与写法模板
--掌握任务类型,写 Prompt 就像套模板 想把 AI 当成好用的工具,第一步不是写 Prompt,而是识别任务类型.只有你先知道"我到底要它干嘛",才能说出"它该怎 ...
- ElasticSearch介绍及单机版安装
概述 ElasticSearch官网:https://www.elastic.co/cn/elasticsearch GitHub地址:https://github.com/elastic/elast ...
- 关于ant design pro的权限方案设计
访问控制(Access control)是指对访问者向受保护资源进行访问操作的控制管理.该控制管理保证被授权者可访问受保护资源,未被授权者不能访问受保护资源. 现实生活中的访问控制可以由付费或者认 ...
- java 获取访问的真实ip
request 是 javax.servlet.http.HttpServletRequest 获取其他机器访问自己服务时的真实ip public String getIP(HttpServletRe ...
- MeterSphere V2.x 添加数据库驱动
MeterSphere V2.x 添加数据库驱动 背景 在使用 MeterSphere 进行接口测试时,会遇到一些接口场景,需要先查询数据库获取特定数据,再将查询结果作为请求参数传递给后续接口.然而, ...
- HRC 003 T3 置换
题目链接 HRC 是啥 HZOI Regular Contest 前置知识 置换 轮换 \(60\space\text{pts}\) 解法 就像对于一个数,我们经常从素因子之积的角度看待它一样,在这道 ...
- CF650A 题解
Problem 原题链接 Meaning 求曼哈顿距离和欧氏距离相等的坐标组数量. Solution 这道题用枚举复杂度较高,我们考虑探究当两点的曼哈顿距离与欧氏距离相等时,它们横纵坐标的关系. 如下 ...