Chapter 3: Programming Languages

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

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

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.

Describe the two levels of uses of operational semantics

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

What is the primary use of attribute grammars?

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

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

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

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

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.

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

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

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

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

Describe the operation of general language recognizer

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

Distinguish between static and dynamic semantics

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

Define syntax and semantics

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

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

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

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

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.

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

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

What purpose do predicates serve in an attribute grammar?

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

Define a left-recursive grammar rule

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

Describe the operation of a general language generator

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

Who are language descriptions for

initial evaluators, implementors, and users

On what branch of mathematics is denotational semantics based?

mathematical objects (called denotations)

On what branch of mathematics is axiomatic semantics based?

mathematics logic


Set pelajaran terkait

Chapter 10: Roosevelt and the New Deal

View Set

Write an equation of the line passing through the given points (3,−10) and (−1,6)

View Set

Computer Architecture midterm chapters 1-12

View Set

N321: Exam 2 - NCLEX-Style Questions (Renal/GU)

View Set