CST229 Week 6 Questions or concerns? Homework #4 due Hand back Homework #3 Reading: Chapters 12&13 Quick note about Lab#1 Lab#1 due tomorrow at midnight via email Revised course schedule Quick look at Chapter 12 Test#1
Three main topics Languages Machines Grammar Notations for defining the language Set notation Recursive definitions Regular expressions (for a specific type of language – regular languages) Definitions serve as a recognizer or a generator Machines Recognizer – given a definition and a string, the machine can tell if the string is in the language Finite Automata - Deterministic Finite Automata (ch. 5) Nondeterministic Finite Automata (ch. 7) – optional Grammar Just another notation for defining languages. Unlike regular expressions which only define regular languages, grammar is more flexible and more general.
Grammar Language Hierarchy (Noam Chomsky) based on complexity of structure Regular – no nesting Context-Free – handles nesting structures. Syntax only, no meaning Context-Sensitive – adds semantic information Recursive enumerable – more complex, closer to natural languages
Recursive Enumerable Context-sensitive Context-Free Regular languages
Grammar Two different notations, developed independent of each other, but very similar Chomsky Backus / Naur (John Backus / Peter Naur) Form Notation for defining languages, particularly programming languages. Recursive by nature (similar to recursive definitions) Nondeterministic by nature We use grammar as a recognizer/generator just like other language definitions
Grammar Let’s start with a recursive definition Lp = string over {a,b} where w = wr Base: is in Lp, so is a & b Rec: if x is in Lp, then so is axa and bxb
Grammar Another notation S -> S -> a S -> b S -> aSa S -> bSb