CH3 Flashcards
(51 cards)
what is the role of Regular expressions?
important notations for specifying lexeme patterns
a finite set of symbols
alphabet
what are symbols?
letter, digit , or punctuation mark .
What is ASCII?
an alphabet used in SW
A finite sequence of symbols drawn from an alphabet
String(Word)
number of occurrences of symbol in s
length of a string
how is a length of a string denoted
|s|
what is a language
a countable set of strings generated from a fixed alphabet
what is a formal language
all possible strings that can be generated from an alphabet.
In lexical analysis, the most important operations on languages are
Union
Concatenation
Closure(Kleene star, and Kleene +)
How do you represent a java identifier in the form of a regular expression?
L(L or D)*
in which letters include an underscore
It is used for describing all the languages that can be built from these operators (Union, concatenation, and Kleene closure), applied to the symbols of some alphabet.
Regular Expressions.
are used to describe tokens of a programming language
Regular expressions
What is a regular expression built from?
smaller regular expressions
True/False
All regular expressions denote the same language.
False.
Each regular expression denotes a language.
True/False
Regular expressions are widely used to specify patterns.
True
What is a regular set?
A language that is denoted by a regular expression
What are the rules of Regular expressions built from?
Union
Concatenation
Closure(Kleene star, and Kleene +)
Formally, the set of regular expressions can be defined by the following recursive rules:
- epsilon is a regular expression
- every symbol in the Language is a Regular expression
- if r1 and r2 are regular expressions then so are r1|r2, r1 r2 , r1*
- Nothing else is a Regular expression
How can we remove parentheses in Regular Expressions?
By using precedence rules
What are the precedence rules?
- closure(*)
- concatenation
- union
Describe the role of regular definitions.
Some regular expressions may be quite complex, so regular definitions are used to denote those complex regular expressions as symbols
What is a recognizer?
It is also called a program for a language, and it is also called a finite automata. It takes a string ‘x’ and tells whether this string belongs to the language or not. If it belongs, it answers ‘yes’ and if it doesn’t belong, it answers ‘no’. It is also a machine that has a finite number of states and transitions.
What are the types of finite automaton?
DFA and NFA