Regular Expressions, Grammars & Parsing Flashcards

(36 cards)

1
Q

Regular expressions

A

A sequence of characters that define a search pattern and a regular language

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

|symbol meaning

symbol meaning

A

Boolean OR

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

() symbol meaning

A

Grouping (equivalent to | symbol)

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

. symbol meaning

A

Wild card- can match any one character

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

[^a] symbol meaning

A

Negation

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

gray|grey

A

gray or grey

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

gr(a|e)y

A

gray|grey = gray or grey

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

gr.y

A

gray, grey, groy, grzy etc..

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

? symbol meaning

A

zero or one occurrences of the preceding element

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

zero or more occurrences of the preceding element

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

{n}

A

the preceding item is matched exactly n times

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

{min, }

A

the preceding item is matched min or more times

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

{min, max}

A

the preceding item is matched at least min times, but not more than max times

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

colou?r

A

color, colour

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

ab*c

A

ac, abc, abbc, abbbc etc..

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

ab+c

A

abc, abbc, abbbc etc..

17
Q

N is a set of

A

non-terminals

18
Q

What is a non-terminal symbol?

A

Those symbols that are in the generation of the sentence but not the component of the sentence

19
Q

Non-terminal examples

A

capital letters

20
Q

Grammar

A

A finite set of formal rules for generating correct sentences (N, T, P, S)

21
Q

Σ (or E) is a set of

22
Q

What is a terminal symbol?

A

The components of the sentences generated using a grammar

23
Q

Terminal symbol examples

A

lowercase letters

24
Q

What’s the relationship between N and Σ

A

They are disjoint meaning they have no members in common

25
P is a set of
production rules
26
What are production rules?
A rewrite rule specifying a symbol substitution than can recursively perform to generate new symbol sequences
27
S is a
starting non-terminal and is a member of N
28
Regular grammar
Is a mathematical object consisting of 4 components G = (N, E, P, S)
29
Right regular grammar
All the non-terminals on the right-hand side exist at the rightmost place
30
B -> a
B is a non-terminal in N and a is terminal in Σ
31
B -> aC
B and C are non-terminals in N and a is in Σ
32
B -> Ca
B and C are in N and a is in Σ
33
B -> ε
B is in N and ε is the empty string
34
Context free grammar
The syntax or structure of a formal language defined by (N, Σ, P, S)
35
CFG is defined where
an alphabet Σ of terminals, a set N of non-terminals, a finite set P of productions
36
::== meaning
may expand into or may get replaced with