Chapter 3: Programming Languages

Chapter 3: Programming Languages

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

Distinguish between static and dynamic semantics

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (19)

Section 1

(19 cards)

Distinguish between static and dynamic semantics

Front

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) Static semantics is so named bc the analysis required to check these specifications can be done at compile time. Dynamic semantics is describing the meaning of the programs. Programmers need to know precisely what statements of a language do. Compile writers determine the semantics of a language for which they are writing compilers from English descriptions

Back

Describe the two levels of uses of operational semantics

Front

At highest level, the interest is in the final result of the execution of a complete program. This is sometimes called natural operational semantics. At lowest level, operational semantics can be used to determine the precise meaning of a program through an examination of the complete sequence of state changes that occur when the program is executed. This is sometimes called structural operational semantics

Back

Describe the operation of general language recognizer

Front

Recognition device capable of reading strings of characters from alphabet. Would analyze given string and either accept or reject based from language given. Devices like filters separating correct sentences from incorrect

Back

What is the problem with using a software pure interpreter for operational semantics?

Front

The detailed characteristics of the particular computer would make actions difficult to understand. Such a semantic definition would be machine-dependent.

Back

In denotational semantics, what are the syntactic and semantic domains?

Front

Domain is the collection of values that are legitimate parameters to the function; the range is the collection of objects to which the parameters are mapped. In denotational semantics, the domain is called syntactic domain, bc it is syntactic structures that are mapped. The range is called the semantic domain

Back

Who are language descriptions for

Front

initial evaluators, implementors, and users

Back

Define syntax and semantics

Front

Syntax of programming languages is the form of its expressions, statements, and program units. Its semantics is the meaning of those expressions, statements, and program units

Back

How is the order of evaluation of attributes determined for the trees of a given attribute grammar?

Front

The parse tree is evaluated based on its underlying BNF grammar, with a possibility of having empty set of attributes values attached to each node.

Back

What purpose do predicates serve in an attribute grammar?

Front

The use of predicates functions is to state the static semantic rules of the language.

Back

Describe the operation of a general language generator

Front

device that can be used to generate the sentences of the language. It generates predictable sentences which makes a generator to be a device of limited usefulness as language descriptor

Back

On what branch of mathematics is denotational semantics based?

Front

mathematical objects (called denotations)

Back

Explain what the preconditions and postconditions of a given statement mean in axiomatic semantics

Front

An assertion before a statement (a precondition) states the relationships and constraints among variables that are true at that point in execution. An assertion following a statement is a postcondition.

Back

What is the primary use of attribute grammars?

Front

Device used to describe more of the structure of a programming language than can be described with a context-free grammar.

Back

What is stored in the state of a program for denotational semantics?

Front

The state of a program for denotational semantics is the value of all its current variable.

Back

Explain the primary uses of a methodology and notation for describing the semantics of programming languages.

Front

Programmers obviously need to know precisely what the statements of a language do before they can use them effectively in their programs Compiler writers must know exactly what language constructs mean to design implementations for them correctly Language designers who would develop the semantic descriptions of their languages could in then process discover ambiguities and inconsistencies in their design

Back

Describe the approach of using axiomatic semantics to prove the correctness of a given program

Front

Rather than directly specifying the meaning of a program, axiomatic semantics specifies what can be proven about the program State precisely the meaning of statements and programs in terms of logic expressions

Back

Define a left-recursive grammar rule

Front

When a grammar rule has its LHS also appearing at the beginning of its RHS

Back

On what branch of mathematics is axiomatic semantics based?

Front

mathematics logic

Back

Why can machine languages not be used to define statements in operational semantics?

Front

First the individual steps in the execution of machine language and the resulting changes to the state of the machine are too small and too numerous. Second the storage of a real computer is too large and complex. There are usually several levels of memory devices, as well as connections to enumerable other computers and memory devices through networks.

Back