

















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































































Token Sample Lexemes Informal Description of Pattern const if relation id num literal
const if <, <=, =, < >, >, >= pi, count, D 3.1416, 0, 6.02E “core dumped”
const if < or <= or = or < > or >= or > letter followed by letters and digits any numeric constant any characters between “ and “ except “ Classifies Pattern
Actual values are critical. Info is :
Alphabet Languages {0,1} {0,10,100,1000,100000…} {0,1,00,11,000,111,…} {a,b,c} {abc,aabbcc,aaabbbccc,…} {A, … ,Z} {TEE,FORE,BALL,…} {FOR,WHILE,GOTO,…} {A,…,Z,a,…,z,0,…9, { All legal PASCAL progs} +,-,…,<,>,…} { All grammatically correct English sentences } Special Languages: ∅ - EMPTY LANGUAGE ∈ - contains ∈ string only Docsity.com
L* = { All possible strings of L plus ∈ } L+^ = L* - ∈ L (L ∪ D ) = ?? L (L ∪ D )* = ??
AXIOM DESCRIPTION r | s = s | r r | (s | t) = (r | s) | t (r s) t = r (s t)
∈r = r r∈ = r r* = ( r | ∈ )*
r ( s | t ) = r s | r t ( s | t ) r = s r | t r
r** = r*
| is commutative | is associative concatenation is associative concatenation distributes over |
relation between * and ∈
∈ Is the identity element for concatenation
Finite Automata : A recognizer that takes an input string & determines whether it’s a valid sentence of the language Non-Deterministic : Has more than one alternative action for the same input symbol. Can’t utilize algorithm! Deterministic : Has at most one action for a given input symbol.
Both types are used to recognize regular expressions.
Non-Deterministic Finite Automata (NFAs) easily represent regular expression, but are somewhat less precise.
Deterministic Finite Automata (DFAs) require more complexity to represent regular expressions, but offer more precision.
We’ll discuss both plus conversion algorithms, i.e., NFA → DFA and DFA → NFA
S = { 0, 1, 2, 3 } s 0 = 0 F = { 3 } Σ = { a, b }
start (^0) a 1 b 2 b 3
a
b
s t a t e
i n p u t 0 1 2
a b { 0, 1 } -- { 2 } -- { 3 }
{ 0 }
∈ (null) moves possible i ∈ j Switch state but do not use any input symbol
start (^0) a 1 b 2 b 3
a
b
start (^0) a 1 b 2 b 3 b
a b
a a What Language is Accepted?
Recall the original NFA:
This construction allows us to take:
Construction Process : 1 st^ : Identify subexpressions of the regular expression ∈ Σ symbols r | s rs r*
2 nd^ : Characterize “pieces” of NFA for each subexpression
start (^) i^ a f (^) L(a)
start (^) i ∈ f L(∈)