Compiler Theory and Design - Chapter 1: Introduction

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is Intermediate Code Generation?

The program is translated to a simple machine-independent intermediate language.

What is Register Allocation?

The symbolic variable names used in the intermediate code are translated into numbers, each of which corresponds to a register in the targer machine code.

What is an advantage of using an interpreter?

They are often simpler to write than compilers

What are three ways in which using high-level programming languages such as Java or C++ positively impacts software development?

1. Compared to machine language, the notation used by programming languages is closer to the way humans think about problems 2. The compiler can spot some obvious programming mistakes 3. Programs written in a high-level programming language tend to be shorter than equivalent programs written in machine language.

In order, what is the common division of phases with a compiler? (There are seven phases)

1. Lexical Analysis 2. Syntax Analysis 3. Type Checking 4. Intermediate code generation 5. Register Allocation 6. Machine code generation 7. Assembly and Linking

What is the difference between a compiler and an interpreter?

While the front end of both systems are typically identical, the syntax tree generated in the Syntax analysis phase is never made into an intermediate code. Meaning that expressions of the syntax tree are evaluated and processed directly. This means that interpreters may have to traverse certain parts of a syntax tree many times, ultimately resulting in slower run times.

What is Type-Checking?

this phase analyzes the syntax tree to determine if the program violates certain consistency requirements. For example- if a variable is used but not declared or if it is used in a context that does not make sense given the type of the variable, such as trying to use a boolean value as a function pointer.

What is Syntax Analysis?

this phase takes the list of tokens generated by the lexical analysis and arranges them in a tree structure (called a syntax tree) that reflects the structure of the program. This phase is often called parsing.

What is a compiler?

A compiler translates (or compiles) a program written in a high-level programming language that is suitable for human programmers into low-level machine language that is required by computers.

What is a shortcoming of most high-level languages (in the context of compilation and run-time)

High-level programming languages universally run slower than code hand-written into machine language.

What is Assembly and Linking?

The assembly-language code is translated into binary representation and addresses of variables, functions, etc. are now determined.

What are the last three phases of compilation often referred to as?

The back end

What are the first three phases of compilation often referred to as?

The front end

What is Lexical Analysis?

the initial part of reading and analyzing the program text. The text is read and divided into tokens, each of which corresponds to a symbol in the programming language (variable name, keyword, or number).

What is Machine Code Generation?

the intermediate language is translated into assemby language (a textural representation of machine code) for a specific machine architecture.


Set pelajaran terkait

Chapter 21 FRL common final review

View Set

Chapter 1: Geometry Notation- Anderson

View Set

Physical Development In Early Childhood

View Set