您的位置:首页 > 其它

编译原理 Chapter1 Introduction 第一章 简介

2016-01-18 22:16 483 查看
本博客为博主阅读Alfred V. Aho 等所著 编译原理(英文版)过程中所记录的摘要;

Start date and time of this blog: Mon Jan 18, 2015 22:24

End date and time of this blog: to be updated

Main Part of this Blog

What is a compiler briefly?

A software system for translating a program language into a form in which can be executed by a computer.

Two basic types of language translators:

1. Compiler:

A compiler translates the source language into an equivalent program, usually known as a target language. It is the compiler’s job to report any errors in the source program that it detects during the translation process.



(Why this picture is so big here on the CSDN page? It’s annoying. If you know why, plz comment bellow to help me get rid of this problem. Thx a lot.)

If a target program is generated, than we can feed the target program with inputs and it would not be long before target program creates outputs



2. Interpreter:

Directly executes the operations specified in the source program on inputs supplied by the user, and gives out outputs.



Contrasts:

The machine language target program produced by a compiler is usually much faster than an interpreter at mapping inputs to outputs.

However, an interpreter can usually give better error diagnostics than a compiler, because it executes the source program statement by statement.

3. A hybrid type

Some translator combines compilation and interpretation in one system, such as Java language.

A java source language program first be compiled into an intermediate form called bytecodes, which can then be interpreted by a virtual machine later. One of the advantages by doing this way is that the bytecodes can be reusable, which means you can interprete the bytecodes on any machines as long as they are installed with a java virtual machine, sometimes even through a network.

To speed up processing of inputs to outputs, some java compilers, called just-in-time compilers, translate the bytecodes into machine language immediately before they run the intermediate program to process the input.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  编译原理 compiler