2-10 Grammars Flashcards

1
Q

Syntax

A

the form or structure of the code (expressions, statements, program units)

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

Semantics:

A

the meaning of the code (what does each statement do?)

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

Alphabet:

A

What characters can constitute a program (C++: letters, numbers,
symbols: ()[]{}.,;+=-*/, whitespace: space, tab, return, eof)

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

Sentence

A

: string of characters from the alphabet

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

Language

A

: set of sentences

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

Lexeme

A

: the lowest level syntactic unit of a language (if, (, continue, ), etc.)

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

Token

A

category of lexeme: (keyword, punctuation, identifier, punctuation,
punctuation, identifier, operator, integer literal, punctuation, etc.)

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

DFA’s and NFA’s

A

recognize a language

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

Grammars

A

define the rules of a language

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

Regular Grammars

A
  • Can be right-linear or left-linear
  • Generate regular languages
  • Accepted by DFA’s
  • Some computer languages are regular like when you use regular expressions for pattern matching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Context-Free Grammars

A
  • Generate context-free languages
  • Accepted by push-down automata
  • Programming languages are context free
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Context-Sensitive Grammars (Unrestricted Grammars)

A
  • Generate recursively enumerable languages
  • Accepted by Turing Machines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

BNF grammars are a form of

A

context-free grammars

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

Grammar is ambiguous if

A

It can generate multiple parse trees

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

Grammar is unambiguous if

A

it generates a single parse tree

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