Syntax Flashcards

1
Q

syntax

A

the form or structure of the expressions, statements and program units (formal method to describe how to determine a statement’s set membership in a Language)

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

semantics

A

the meaning of the expressions, statements, and program units

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

grammar

A

formal description of a Language

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

sentence

A

a string of characters over some alphabet

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

language

A

a set of sentences (characterized by the set of all valid statements / strings in that language.
The cardinality of this set is potentially infinite)

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

lexeme

A

lowest level syntactic unit of a language

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

token

A

category of lexemes

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

recognizers; generators

A

grammars can be formally utilized in two distinct ways: for ____ and for ___. (two approaches to describing syntax)

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

Recognition device

A

___ device reads input strings over the alphabet of the language and decides whether the input strings belong to the language (i.e.syntax analysis part of a compiler)

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

Generators

A

A device that generates sentences of a language (one can determine if the syntax of a particular sentence is syntactically correct by comparing it to the structure of the generator

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

grammars

A

what is the formal language-generation mechanism commonly used to describe the syntax of programming languages

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

Backus-Naur Form (BNF) is equivalent to

A

Context-Free Grammars

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

Context Free Grammar syntax

A

Grammar = (Start symbol, set of Non-terminals, set of Terminals, set of Production Rules)

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

define non-terminal symbols

A

abstractions are used to represent classes of syntactic structures; they act like syntactic variables (often enclosed in angle brackets <>)

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

define terminal symbols

A

they are lexemes

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

Each Production Rule has:
•a left-hand side (LHS), which is a ___ ___, and
•a right-hand side (RHS), which is a ___ of ___ and/or ___

A

single non-terminal; string of terminals and/or non-terminals

17
Q

define derivation (given a set of grammar rules know how to give derivation)

A

determines the order that nodes of a parse tree are built

repeated application of rules, starting with the start symbol and ending with a sentence with all terminal symbol

18
Q

define sentential form

A

every string of symbols in a derivation

19
Q

valid sentence

A

a sentential form that as only terminal symbols

20
Q

define leftmost derivation

A

derivation in which the leftmost nonterminal in each sentential form is the one that is expanded
(expand leftmost nonterminal first)

21
Q

define rightmost derivation

A

expand rightmost nonterminal first

22
Q

define parse tree

A

hierarchical representation of a derivation

23
Q

a grammar is ambiguous if and only if:

A

it generates a sentential form that has two or more distinct parse tree

24
Q

which language has grammar based on predicate logic

A

LOGLAN (logical languages, also include Lojban and Ceqli)

25
how can we eliminate ambiguity?
if we use the parse tree to indicate precedence levels of the operators
26
Be able to use recursive BNF rules to describe lists of arbitrary length means:
be able to describe the list of potential sentences in the language generated by a particular grammar
27
Explain what deep syntax structure and surface syntax structure are
Sentences can be either passive or active and that difference lies in their surface structure. But their deep structure may be the same, for example NP+V+NP
28
What is structural ambiguity?
Sentences that can be understood in more than one way.
29
What are "recursive rules"?
Syntactic rules that can be applied more than once in generating a structure.
30
Why Semantic roles
Some words may be more difficult to find the semantic meaning for than table horse etc. Words as warning, advice, threat. If we look at words as having roles in a sentence instead of containers of meaning this becomes easier.