cse 322
play

CSE 322 Exam Reviews Basic Concepts Formal Languages - PowerPoint PPT Presentation

CSE 322 Exam Reviews Basic Concepts Formal Languages Language/String Operations Alphabet ( ! ) String ( ! *) Regular Operations: Union ( $ ) Length (|x|) Concatenation ( ) Empty String ( " )


  1. CSE 322 Exam Reviews

  2. Basic Concepts • Formal Languages • Language/String Operations – Alphabet ( ! ) – String ( ! *) – “Regular” Operations: • Union ( $ ) – Length (|x|) • Concatenation ( • ) – Empty String ( " ) • (Kleene) Star (*) – Empty Language ( # ) – Other: • Intersection • Complement • Reversal • Shuffle • ...

  3. Finite Defns of Infinite Languages • English, mathematical • Nondeterminism • DFAs • NFAs – States – Transitions ( % relation) – Start states • Missing out-edges – Accept states • Multiple out-edges – Transitions ( % function) • " -moves – M accepts w & ! * – N accepts w & ! * – M recognizes L ' ! * – N recognizes L ' ! * • Regular Expressions – # , " , a & ! , $ , • , * , ( ) • GNFAs

  4. Key Results, Constructions, Methods • L is regular iff it is: • The class of regular languages is closed – Recognized by a DFA under: – Recognized by a NFA – Recognized by a GNFA – Regular ops: union, concatenation, star – Defined by a Regular Expr – Also: intersection, Proofs: complementation, GNFA ( Reg Expr (& reversal, prefix, (Kleene/Floyd/Warshall: R ik R kk * R kj ) no-prefix, … ) • NOT closed under ⊆ , ⊇ Reg Expr ( NFA (join NFAs w/ " -moves) • Also: Cross-product NFA ( DFA construction (union, …) (subset construction)

  5. Applications • “globbing” • Compilers: – Id ::= letter ( letter|digit )* – lpr *.txt – Int ::= digit digit* • pattern-match – Float ::= searching: d d* . d* ( " | E d d* ) – (but not, e.g. expressions – grep “Ruzzo.*terrific” *.txt with nested, balanced parens, or variable names matched to declarations) • Finite state models of circuits, control systems, network protocols, API’s, etc., etc.

  6. Non-Regular Languages • Key idea: once M is in • Cor: Pumping Lemma some state q, it doesn’t • Important examples: remember how it got L 1 = { a n b n | n >0 } there. L 2 = { w | # a (w) = # b (w) } E.g. “hybrids”: L 3 = { ww | w &! * } if xy & L(M) and L 4 = { ww R | w &! * } x, x’ both go to q, then L 5 = { balanced parens } x’y & L(M) too. • Also: closure under * , complementation E.g. “loops”: if xyz & L(M) and sometimes useful: x, xy both go to q, then – L 1 = L 2 * a*b* xy i z & L(M) for all i ) 0. • PS: don’t say “Irregular”

  7. Context-Free Grammars • Terminals, Variables/Non-Terminals • Start Symbol S • Rules ( • Derivations + , + * • Left/right-most derivations • Derivation trees/parse trees • Ambiguity, Inherent ambiguity • A key feature: recursion/nesting/matching, e.g. S ( (S)S | "

  8. Pushdown Automata • States, Start state, Final states, stack • Terminals ( ! ), Stack alphabet ( , ) • Configurations, Moves, |--, |--*, push/pop

  9. Main Results • Every regular language is a CFL • Closure: union, dot, *, (Reversal; ! w/ Reg) • Non-Closure: Intersection, complementation • Equivalence of CFG & PDA – CFG ' PDA : top-down(match/expand), bottom-up (shift/reduce) – PDA ' CFG: A pq • Pumping Lemma & non-CFL’s • Deterministic PDA != Nondeterministic PDA

  10. Important Examples • Some Context-Free Languages: – { a n b n | n > 0 } – { w | # a (w) = # b (w) } – { ww R | w & {a,b}* } – balanced parentheses – "C", Java, etc. • Some Non-Context-Free Languages: – { a n b n c n | n > 0 } Curiously, their – { w | # a (w) = # b (w) = # c (w) } complements are CFL’s – { ww | w & {a,b}* } – "C", Java, etc.

  11. Applications • Programming languages and compilers • Parsing other complex input languages – html, sql, … • Natural language processing/ Computational linguistics – Requires handling ambiguous grammars • Computational biology (RNA)

  12. The big picture Ability to specifiy and reason about abstract formal models of computational systems is an important life skill. Practice it.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend