Programming languages M01

Ace your homework & exams now with Quizwiz!

Explain the distinction between interpretation and compilation.

-Compilation is the translation of a high level source program into an equivalent target program usually in machine language. The is the locus of control during compilation; the target program is the locus of control during its own execution. -Interpretation implements a virtual machine whose "Machine language" is the high-level programming language. The interpreter is the locus of control during execution and it stays around.

What is a just-in-time compiler?

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

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.

Describe six kinds of tools that commonly support the work of a compiler within a larger programming environment.

Assemblers, debuggers, preprocessors, linkers, Editors, Style checkers. Editors are familiar to every programmer. They may be augmented with cross-referencing facilities that allow the programmer to find the point at which an object is defined, given a point at which it is used. Pretty printers help enforce formatting conventions. Style checkers enforce syntactic or semantic conventions that may be tighter than those enforced by the compiler (see Exploration 1.14). Configuration management tools help keep track of dependences among the (many versions of) separately compiled modules in a large software system. Perusal tools exist not only for text but also for intermediate languages that may be stored in binary. Profilers and other performance analysis tools often work in conjunction with debuggers to help identify the pieces of a program that consume the bulk of its computation time.

Name three von Neumann languages

C, Ada, Fortran

What distinguishes declarative languages from imperative languages?

Declarative languages hide implementation details (they are the WHAT). Imperative embraces them (they are the HOW).

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

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 are the comparative advantages and disadvantages of the compilation and interpretation?

Interpreted languages are usually smaller and skip the compile and link steps Compilation usually leads to faster more optimized programs

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.

Explain how an integrated development environment differs from a collection of command-line tools.

It separates the language from the command line tools

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 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, SQL

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)

List the phases that are also executed as part of interpretation

Scanner, parser, semantic analysis (Front-end)

Name three object-oriented languages

Smalltalk, C++, Java

Why aren't concurrent languages listed as a category ?

The distinction between concurrent and sequential execution is mostly independent of the classifications listed.

What was the intermediate form employed by the original AT&T C++ compiler?

The intermediate form produced by AT & T C++ compiler is "C".

What is the difference between static and dynamic semantics?

The static semantics of a language is only indirectly related to the meaning of programs during execution; rather, it has to do with the legal forms of programs (syntax rather than semantics). Many static semantic rules of a language state its type constraints. Static semantics is so named because the analysis required checking these specifications can be done at compile time.The dynamic semantics is the meaning, of expressions, statement, and program units. Because of the power of the naturalness of the available notation, describing syntax is a relatively simple matter. On the other hand, no universally accepted notation has been devised for dynamic semantics. The dynamic semantics approaches investigate how the interpretation of a natural language expression changes the context.

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

Briefly describe three "unconventional" compilers—compilers whose purpose is not to prepare a high-level program for execution on a processor

Two of these unconventional compilers are TEX and Troff, are compilers which translate documents of higher level into commands for either laser printer or typesetters using a text editor. The third one is Query language processor for database system, also considered compilers which translate language for example SQL into primitive operation on files.

What organization spearheaded the development of Ada?

U.S. Department of Defense

What is P-code?

a stack-based language similar to the byte code of modern Java compilers used for pascal compiler

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. -The front end consist of the first few phases and the back end consists of the last few phases


Related study sets

Chpater 11 Chemistry Study Guide

View Set

Chapter 2. The Internet, the Web, and Electronic Commerce

View Set

English Plus 1 second edition Unit 8

View Set