Chapt 3: Syntax & Semantics Flashcards

Describing Syntax & Semantics

1
Q

The ___ of a programming language is the form of its expressions, statements, and program units

A

Syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The ___ of a programming language is the meaning of its expressions, statements, and program untis.

A

Semantics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

___ ___ are the syntax and semantics of a language for all those potential users & evaluators, who are interested in learning a& building skills in a specific language.

A

Language Descriptions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A ___ ___ can be defined as a setup which can be used to generate sentences of a language. The setup can be made to work & produce a sentence as per the requirement as in input and output.

A

language generator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

the operation of a general ___ ___ is to aid compiler (of a language) by helping it in analyzing the syntax of the program code.

A

language recognizer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The strings of a language are called ___ or statements.

A

sentences

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The ___ of a programming language include its numeric literals, operators, and special words among others.

A

lexemes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A ___ represents a lexeme group; a category of its lexemes.

A

token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Give the token for the example lexemes:

  • index
  • =
  • 2
  • +
  • count
A
  • identifier
  • equal_sign
  • int_literal
  • plus_op
  • identifier
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

__ __ are literal symbols that can appear in the inputs to or outputs from the creation rules of a grammar.

A

terminal symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A ___ is a sentential form that has only terminal symbols.

A

sentence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

___ form of a grammar G can be any sequence of grammar symbols (terminal or nonterminal) derived in 0 or more steps from the start symbol of G.

A

Sentential

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

__ __, a noted linguist, described four classes of grammars of which two are useful in describing the syntax of programming languages.

A

Noam Chomsky

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The two classes used for describing the syntax of programming languages, that are also used in describing natural languages are ___ & ___.

A

context free, regular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

___ is a natural notation for describing syntax; introduced in 1959 to describe ALGOL 58 and modified for the description of ALGOL 60

A

BNF, Backus-Naur Form

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

BNF is a ___ for describing programming languages.

A

metatlanguage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

All things on the RHS combine to make the ___, or ___.

A

rule, production

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The abstractions in a BNF description are often called ___.

A

nonterminals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The lexemes and tokens of BNF of the rules are called ___.

A

terminals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A rule is ___ if its LHS appears in its RHS.

A

recursive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The sentences of the language are generated through a sequence of application of the rules, beginning with a special nonterminal of the grammar called the ___ ___.

A

start symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The sequence of rule applications is called a ___.

A

derivation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The symbol => is read “___”.

A

derives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

One of the most attractive features of grammars is that they naturally describe the hierarchical syntactic structure, or ___ ___, of the sentences of languages they define.

A

parse trees

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

A grammar that generates a sentential form for which there are two or more distinct parse trees is said to be ___.

A

ambiguous

26
Q

When a grammar rule has its LHS also appearing at the beginning of its RHS, the rule is said to be ___ ___.

A

left recursive

27
Q

Left recursion specifies ___ ___.

A

left associativity

28
Q

Left recursion of the rules of grammar causes it to make both addition and multiplication left associative which is in conflict with ___ ___ of ___.

A

mathematical order of precedence

29
Q

A grammar rule is ___ ___ if the LHS appears at the right end of the RHS.

A

right recursive

30
Q

The ___ ___ 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.

A

static semantics

31
Q

___, which are associated with grammar symbols, are similar to variables in the sense that they can have values assigned to them.

A

Attributes

32
Q

___ ___ ___, sometimes called semantic functions, are associated with grammar rules and.

A

Attribute computation functions

33
Q

___ ___ ___ are used to specify how attribute values are computed.

A

Attribute computation funcitons

34
Q

___ ___, which state the static semantic rules of the language, are associated with grammar rules.

A

Predicate functions

35
Q

___ ___ are used to pass semantic information up a parse tree

A

synthesized attributes

36
Q

___ ___ pass semantic information down and across a parse tree.

A

inherited attributes

37
Q

If all attribute values in a parse tree have been computed, the ree is said to be ___ ___.

A

fully attributed.

38
Q

___ ___ are synthesized attributes of leaf nodes whose values are determined outside the parse tree.

A

Intrinsic attributes

39
Q

___ ___ is the meaning of the expressions, statements and program units of a programming language.

A

Dynamic semantics

40
Q

The idea behind ___ ___ is to describe the meaning of a statement or program by specifying the effects of running it on a machine.

A

operational semantics

41
Q

Sometimes called ___ ___ semantics; the highest level where the interest is in the final result of the execution of a complete program.

A

natural operational

42
Q

At the lowest level, ___ ___ 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.

A

structural operational

43
Q

___ ___ is the most rigorous and most widely known formal method for describing the meaning of programs.

A

Denotational semantics

44
Q

In denotational semantics, the domain is called the ___ domain and the range is called the ___ domain.

A

syntactic, semantic

45
Q

___ semantics, is the most abstract approach to semantics specification.

A

Axiomatic

46
Q

The logical expressions used in axiomatic semantics are called predicates or____.

A

assertions

47
Q

___ is the process of repeating items in a self-similar way.

A

Recursion

48
Q

___ semantics is meant for describing the meaning of program code.

A

Dynamic

49
Q

___ semantics is basically confined to token, or syntax, part of the program and is only indirectly related to the meaning of the program during execution.

A

Static

50
Q

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

A

Attribute

51
Q

___ grammar allows certain language rules to be conveniently described, such as type compatibility.

A

Attribute

52
Q

The ___ precondition is the least restrictive precondition that will guarantee the validity of the associated post condition.

A

weakest

53
Q

An ___ ___ is a method of inferring the truth of one assertion on the basis of the values of other assertions.

A

inference rule

54
Q

An ___ is a logical statement that is assumed to be true.

A

Axiom

55
Q

The ___ of ___ says that a post-condition can always be weakened and a precondition can always be strengthened.

A

Rule of Consequence

56
Q

__ and __ are equivalent ___ that are well suited for the task of describing the syntax of programming languages.

A

BNF, context-free, metalanguages

57
Q

An ___ grammar is a descriptive formalism that can describe both the syntax and static semantics of a language.

A

attribute

58
Q

What are the three mothods of semantic description

A

operational, denotational, and exiomatic

59
Q

___ semantics is a method of describing themeaning of language constructs in terms of their effects on and ideal machine.

A

Operational

60
Q

In ___ semantics, mathematical objects are used to represent the meanings of language constructs.

A

denotational

61
Q

___ semantics, which is based on formal logic, was devised as a tool for proving the correctness of programs.

A

Axiomatic