Chapter 2 (Paradigm) Flashcards

1
Q

What is a syntax?

A

Its a precise description of all its grammatically correct programs

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

With what program was precise syntax used?

A

Algol 60

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

Levels of syntax?

A

Lexical syntax
Concrete syntax
Abstract syntax

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

What is a lexical syntax?

A

all the basic symbols of the language (names, values, operators)

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

What is a concrete syntax?

A

rules for writing expressions, statements and programs.

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

What is an abstract syntax?

A

Internal representation of the program, favoring content over form

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

What is a metalanguage?

A

Its a language used to define other languages

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

What is a grammar?

A

Its a metalanguage used to define the syntax of language

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

What is a BNF? What does it do?

A

Backus-Naur Form
stylized version of a context-free grammar
First used to define syntax of Algol 60

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

What is a parse tree?

A

Parse tree is a graphical representation of derivation.

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

What does a parse tree do?

A

node of the tree corresponds to a step in derivation

each child of node represents a right-hand side of production

each leaf node represents a symbol of the derived string

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

How can a grammar be defined?

A

With associativity and precedence

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

When is grammar ambiguous?

A

When one of its strings has two or more different parse trees.

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

What is a lexer?

A

Its the process of converting a sequence of characters into a sequence.
Input: characters
Output: tokens

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

What is a parser?

A

Based on BNF/EBNF grammar.
Input: tokens
Output: parse tree.

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