Professional Documents
Culture Documents
Tokens, Patterns
Lexemes
Identifiers
Use of Regular Expression in Lexical Analysis
Understanding related to
Tokens, Patterns, Lexemes, identifiers, Use of Regular Expression in Lexical
Analysis
Languages
Example of Languages
Alphabet = ASCII
Language = C++ programs,
Java, C#
Notation
Notation
Regular Languages
Regular Expression
Regular Expression
R|S = either R or S
RS = R followed by S
(concatenation)
R* = concatenation of R
zero or more times
(R*= e |R|RR|RRR...)
RE Extentions
R? = e | R (zero or one R)
R+ = RR* (one or more R)
(R) =R (grouping)
RE Extentions
Regular Expression
RE Strings in L(R)
a “a”
ab “ab”
a|b “a” “b”
(ab)* “” “ab” “abab” ...
(a|e)b “ab” “b”
Example: integers
Example: identifiers
identifier:
string or letters or digits starting with a letter
C identifier:
[a-zA-Z_][a-zA-Z0-9_]*
Specification:
Regular Expressions
Implementation:
Finite Automata
Finite Automata
Finite Automata
Q&A