Chapter 1

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

Describe the form in which a program is passed from the scanner to the parser; from the parser to the semantic analyzer; from the semantic analyzer to the intermediate code generator.

Token stream, Parse tree, Abstract syntax tree or other intermediate form

What is P-code?

a stack-based language similar to the byte code of modern Java compilers

Name three von Neumann languages

C, Ada, Fortran

Explain the distinction between interpretation and compilation. What are the comparative advantages and disadvantages of the two approaches?

Compiler translates high level source program into a equivalent target program (machine language). An interpreter implements a virtual machine whose "machine language" is the high-level programming language. The interpreter reads statements in that language more or less one at a time, executing them as it goes along.

What distinguishes declarative languages from imperative languages?

Declarative languages hide implementation details. Imperative embraces them.

What is the difference between a phase and a pass of compilation? Under what circumstances does it make sense for a compiler to have multiple passes?

Each phase discovers information of use to later phases, or transforms the program into a form that is more useful to the subsequent phase. A pass is a phase or set of phases that is serialized with respect to the rest of compilation: it does not start until previous phases have completed, and it finishes before any subsequent phases start.

Why are there so many programming languages?

Evolution, Special Purposes, Personal Preference

What makes a programming language successful?

Expressive Power, Ease of Use for Novice, Ease of Implementation, Standardization, Open Source, Excellent Compilers, Economics, Patronage, Inertia

What is bootstrapping?

A method in which a simple implementation of an interpreter evolves to build more complex versions until the compiler has been built.

What is the difference between a compiler and a preprocessor?

A preprocessor is an initial translator that removes comments and white space, and groups characters together into tokens such as keywords, identifiers, numbers, and symbols, as well as simple analysis of syntactic structures. A compiler employs thorough analysis and nontrivial transformation.

What is the difference between machine language and assembly language?

Machine language is the sequence of bits that directly controls a processor. Assembly languages were invented to allow operations to be expressed with mnemonic abbreviations.

Name two logic languages.

Prolog, spreadsheets

List the principal phases of compilation

Scanner (lexical analysis), Parser (syntax analysis), Semantic analysis and intermediate code generation,Machine-independent code improvement (optional), Target code generation, Machine-specific code improvement (optional)

Name three object-oriented languages

Smalltalk, Eiffel, Java

What is a just-in-time compiler?

A compiler that translates byte code into machine language immediately before each execution of the program.

On modern machines, do assembly language programmers still tend to write better code than a good compiler can? Why or why not?

For modern microprocessor architectures, particularly those with so-called superscalar implementations (ones in which separate functional units can execute instructions simultaneously), compilers can usually generate better code than can human assembly language programmers.

What is generally considered the first high-level programming language?

Fortran

In what way(s) are high-level languages an improvement on assembly language? In what circumstances does it still make sense to program in assembler?

High level languages economizes the programmer effort in the construction and maintenance of programs. For performance centered tasks, assembly allows direct control for optimization.

What is the purpose of the compiler's symbol table?

It is a data structure that maps each identifier to the information known about it including the identifier's type, internal structure , and scope.

Name two widely used concurrent languages.

Java and C# have concurrent features

Is Java compiled or interpreted (or both)? How do you know?

Java could be considered either. It is possible for a compiler (complicated translator) to produce code that is then executed by a complicated virtual machine (interpreter)

What was the first functional language?

Lisp

Name two languages in which a program can write new pieces of itself "on the fly."

Lisp and Prolog

Name three functional languages

Lisp/Scheme, ML, Haskell

What distinguishes the front end of a compiler from the back end?

the front end may be shared by compilers for more than one machine (target language), and the back end may be shared by compilers for more than one source language.


Set pelajaran terkait

TIMS - NATIONAL TRAFFIC INCIDENT MANAGEMENT (TIM) RESPONDER TRAINING PROGRAM

View Set

Chapter 5 Learning Objectives Checkup

View Set

Senior Engineering Programming Quetsions

View Set

Unit 4: Types of Life Insurance Policies

View Set

IST 309 Chapter 11, IST 309 Chapter 10, IST 309 Chapter 8, Chapter 7

View Set

Med-Surg HESI EAQ - Heart Disease

View Set

psych 101 chapter 2: psychology's scientific method

View Set

Test 1 (Chapters 1, 2, & 3) FNBK 101

View Set