Chapt 3: Syntax & Semantics Flashcards

Describing Syntax & Semantics (61 cards)

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
A grammar that generates a sentential form for which there are two or more distinct parse trees is said to be ___.
ambiguous
26
When a grammar rule has its LHS also appearing at the beginning of its RHS, the rule is said to be ___ ___.
left recursive
27
Left recursion specifies ___ ___.
left associativity
28
Left recursion of the rules of grammar causes it to make both addition and multiplication left associative which is in conflict with ___ ___ of ___.
mathematical order of precedence
29
A grammar rule is ___ ___ if the LHS appears at the right end of the RHS.
right recursive
30
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.
static semantics
31
___, which are associated with grammar symbols, are similar to variables in the sense that they can have values assigned to them.
Attributes
32
___ ___ ___, sometimes called semantic functions, are associated with grammar rules and.
Attribute computation functions
33
___ ___ ___ are used to specify how attribute values are computed.
Attribute computation funcitons
34
___ ___, which state the static semantic rules of the language, are associated with grammar rules.
Predicate functions
35
___ ___ are used to pass semantic information up a parse tree
synthesized attributes
36
___ ___ pass semantic information down and across a parse tree.
inherited attributes
37
If all attribute values in a parse tree have been computed, the ree is said to be ___ ___.
fully attributed.
38
___ ___ are synthesized attributes of leaf nodes whose values are determined outside the parse tree.
Intrinsic attributes
39
___ ___ is the meaning of the expressions, statements and program units of a programming language.
Dynamic semantics
40
The idea behind ___ ___ is to describe the meaning of a statement or program by specifying the effects of running it on a machine.
operational semantics
41
Sometimes called ___ ___ semantics; the highest level where the interest is in the final result of the execution of a complete program.
natural operational
42
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.
structural operational
43
___ ___ is the most rigorous and most widely known formal method for describing the meaning of programs.
Denotational semantics
44
In denotational semantics, the domain is called the ___ domain and the range is called the ___ domain.
syntactic, semantic
45
___ semantics, is the most abstract approach to semantics specification.
Axiomatic
46
The logical expressions used in axiomatic semantics are called predicates or____.
assertions
47
___ is the process of repeating items in a self-similar way.
Recursion
48
___ semantics is meant for describing the meaning of program code.
Dynamic
49
___ 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.
Static
50
___ grammar is a device used to describe more of the structure of a programming language than can be described with a context-free grammar.
Attribute
51
___ grammar allows certain language rules to be conveniently described, such as type compatibility.
Attribute
52
The ___ precondition is the least restrictive precondition that will guarantee the validity of the associated post condition.
weakest
53
An ___ ___ is a method of inferring the truth of one assertion on the basis of the values of other assertions.
inference rule
54
An ___ is a logical statement that is assumed to be true.
Axiom
55
The ___ of ___ says that a post-condition can always be weakened and a precondition can always be strengthened.
Rule of Consequence
56
__ and __ are equivalent ___ that are well suited for the task of describing the syntax of programming languages.
BNF, context-free, metalanguages
57
An ___ grammar is a descriptive formalism that can describe both the syntax and static semantics of a language.
attribute
58
What are the three mothods of semantic description
operational, denotational, and exiomatic
59
___ semantics is a method of describing themeaning of language constructs in terms of their effects on and ideal machine.
Operational
60
In ___ semantics, mathematical objects are used to represent the meanings of language constructs.
denotational
61
___ semantics, which is based on formal logic, was devised as a tool for proving the correctness of programs.
Axiomatic