Akram Salah ISSR 2012. Basic Concepts Languages Grammar Automata (Automaton)

Slides:



Advertisements
Similar presentations
Formal Languages Languages: English, Spanish,... PASCAL, C,... Problem: How do we define a language? i.e. what sentences belong to a language? e.g.Large.
Advertisements

Finite-State Machines with No Output Ying Lu
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
YES-NO machines Finite State Automata as language recognizers.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
CS5371 Theory of Computation
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 Languages and Finite Automata or how to talk to machines...
Pushdown Automaton (PDA)
Normal forms for Context-Free Grammars
Finite Automata Chapter 5. Formal Language Definitions Why need formal definitions of language –Define a precise, unambiguous and uniform interpretation.
Topics Automata Theory Grammars and Languages Complexities
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
Finite Automata Costas Busch - RPI.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
CPSC 388 – Compiler Design and Construction
Languages & Strings String Operations Language Definitions.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
CS/IT 138 THEORY OF COMPUTATION Chapter 1 Introduction to the Theory of Computation.
Theory of Languages and Automata
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
Grammars CPSC 5135.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
CS 3813: Introduction to Formal Languages and Automata
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Regular Expressions CIS 361. Need finite descriptions of infinite sets of strings. Discover and specify “regularity”. The set of languages over a finite.
Overview of Previous Lesson(s) Over View  Symbol tables are data structures that are used by compilers to hold information about source-program constructs.
Chapter 7 Pushdown Automata
Three Basic Concepts Languages Grammars Automata.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
CS 154 Formal Languages and Computability February 4 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
1.2 Three Basic Concepts Languages start variables Grammars Let us see a grammar for English. Typically, we are told “a sentence can Consist.
using Deterministic Finite Automata & Nondeterministic Finite Automata
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Deterministic Finite Automata Nondeterministic Finite Automata.
Theory of Languages and Automata By: Mojtaba Khezrian.
1 Finite Automata. 2 Introductory Example An automaton that accepts all legal Pascal identifiers: Letter Digit Letter or Digit "yes" "no" 2.
Formal Languages and Automata FORMAL LANGUAGES FINITE STATE AUTOMATA.
Lecture #2 Advanced Theory of Computation. Languages & Grammar Before discussing languages & grammar let us deal with some related issues. Alphabet: is.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Chapter 1 INTRODUCTION TO THE THEORY OF COMPUTATION.
Topic 3: Automata Theory 1. OutlineOutline Finite state machine, Regular expressions, DFA, NDFA, and their equivalence, Grammars and Chomsky hierarchy.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Languages.
Formal Language & Automata Theory
CIS Automata and Formal Languages – Pei Wang
CS314 – Section 5 Recitation 3
Chapter 7 PUSHDOWN AUTOMATA.
Deterministic Finite Automata
Chapter 9 TURING MACHINES.
Chapter 2 FINITE AUTOMATA.
Deterministic Finite Automata
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
CSE322 Definition and description of finite Automata
Intro to Data Structures
Finite Automata.
Finite Automata.
What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled.
Presentation transcript:

Akram Salah ISSR 2012

Basic Concepts Languages Grammar Automata (Automaton)

Language A body of communicative symbols, whether it is made up of words, sounds, gestures, facial expressions, or visual signals that by long use by the population of a wide spread territory has became whereby the ideas or feelings of the individual members of that population are communicated or expressed. A system suitable for the expression of certain ideas, facts, concepts, including a set of symbols and rules for their manipulation.

Language Alphabet  : finite, non empty set of symbols String: finite sequence of symbols from   = {a, b}, abab, aaabbba are strings on  w = abaaa called a word A language is a set of words, each is a string, defined over 

Languages w = a 1 a 2 …a n and v = b 1 b 2 …b m Concatenate: wv = a 1 a 2.. a n b 1 b 2..b m Reverse: w R = a n.. a 2 a 1 If w = vu, v prefix of w u suffix of w

Languages Length of a string w, |w| The number of symbols in w Empty string  a string with no symbols |  | = 0  w = w  = w, for all w |uv| = |u| + |v|

Languages w is a string, w n is concatenating w with itself n times. w 0 =  If  is an alphabet,  * is the set of strings concatenating 0 or more elements of .  + is the set of strings concatenating 1 or more symbols.  + =  * - {  }.  * =  + U {  }

Languages A language, L, defined over an alphabet , is a subset of  * Any string w in a language L is called a word or a sentence. We can define more than one language over the same . Complement of a language L c =  * -L. Concatenation of two languages

Grammars A grammar for a language tells us whether a particular sentence is well formed or not. A set of rules. We need a precise non-ambiguous notation to describe the rules. The rules simply tells us which subset of L is accepted as a “legal” expression

Grammars ->, {“a”, “the”} {“boy”, “dog”} {“walks”, “runs”} “a boy runs”| Properly formed “the dog walks”|

Grammars A grammar G is a quadruple G = (V, T, S, P) Where: V finite set of objects called variables T finite set of objects called terminal symbols S  V is a special symbols called start variable P is a finite set of productions V  T are non-empty and disjoint

Grammars Production rules are the heart of a grammar They specify how the grammar transforms one string to another They define a language associated with G Production rule in the form: x -> y x  (V U T) + & y  (V U T) *

Grammars Given a string w = uxv, rule x -> y is applicable to w z = uyv. written as w => z, w derives z or z is driven from w

Grammars If w 1 => w 2 => … w n, we write w 1 = * > w n “*” indicates 0 or more steps to derive w n from w 1 w = * > w w= + > v

Grammars Applying productions in different order, a grammar generates many strings G = (V, T, S, P), L(G) ={ w  T * : S = * > w} L(G) is Language generated by G S => w 1 => w 2 => … => w n => w is derivation of w S, w 1, w 2, …, w n, sentential forms of the derivation

Grammars Example: Given G = ({S}, {a, b}, S, P) Where P S -> aSb, S ->  Then S => aSb=> aaSbb=>aabb

Grammars Given G = ({S}, {a, b}, S, P) Where P S -> aSb, S ->  Then S => aSb=> aaSbb=>aabb L(G) = {a n b n : n > 0}

Grammars Example: Find a grammar that generates L= {a n b n+1 : n > 0}

Grammars G ({S, A}, {a,b}, S, P) where P S -> Ab, A -> aAb, A -> . We can write P S -> Ab, A -> aAb | 

Automata An automaton is an abstract model of a digital computer. Includes: Input file: Read as a string One symbol at a time, left to right, EOF, no change Can produce output Has temporary storage Unlimited, one character, may change Control unit Finite number of internal states, may change

Control Unit Input file Storage Output

Automata Control unit is in an internal state. Input scans a symbol The control unit gets to a next-state through a transition function Transition function depends on Current state Current input symbol Information in the temporary storage Configuration: a state of CU, input file, temporary storage Move: the transition from one configuration to next

Automata An Automaton: Deterministic: each move is uniquely determined by the current configuration. Nondeterministic: An automaton : Acceptor: the output is limited to “yes” or “no” Either accepts (recognizes) or rejects an input string. Transducer: produces string of symbols as output.

Automata Pascal identifier: a letter followed by 0 or more letter or digit. Grammar: ->, -> | | ^, -> a | b | … -> 0 | 1 |.. A0 (derivation) => => A => Aa => A0

Automata Automaton 12 3 letter digit Letter or digit

Summary Language is a sequence of symbols from an alphabet Grammar is a set of rules to select well formed sequences Automata is computational model for well formed expressions (sequences)

Deterministic Finite Acceptors DFA is a type of automata, Deterministic: unique moves (function). Acceptor: has no output (yes/no)

Deterministic Finite Acceptor DFA is formally defined as: M = (Q, , , q 0, F) Where Q is a finite set of internal states  is a finite set of symbols, input alphabet  : Q x  -> Q is a total function, transition function q 0  Q is the initial state F (subset of Q) is a set final states

Deterministic Finite Acceptor Initially at q 0 Each step, consider, and consume, leftmost symbol Based on transition function, and the symbol read, it moves to the next state As the end of input string, EOF. If the automaton is at one of the final states, F, input string is accepted Otherwise, it is rejected.

Deterministic Finite Acceptor Given DFA: M = ({q 0, q 1, q 2 }, {0, 1}, , q 0, {q 1 }) where d is given by:  (q 0, 0) = q 0,  (q 0, 1) = q 1,  (q 1, 0) = q 0,  (q 1, 1) = q 2,  (q 2, 0) = q 2,  (q 2, 1) = q 1. Test 01, 00, 101, 100, 11001

Transition Graph A graph represents a DFA: Vertices represent states Edges represent transitions Vertices are labeled by state names Edges are labeled by current value of input symbol Initial state: incoming arrow with no origin Final states are double circle G M has exactly |Q| vertices G M has an edge for each transition rule in 