Languages and Machines Unit one: Formal Languages.

Slides:



Advertisements
Similar presentations
Chapter 5: Languages and Grammar 1 Compiler Designs and Constructions ( Page ) Chapter 5: Languages and Grammar Objectives: Definition of Languages.
Advertisements

YES-NO machines Finite State Automata as language recognizers.
Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
CS5371 Theory of Computation
1 Languages and Finite Automata or how to talk to machines...
Normal forms for Context-Free Grammars
Chapter 3: Formal Translation Models
CS 3240 – Chuck Allison.  A model of computation  A very simple, manual computer (we draw pictures!)  Our machines: automata  1) Finite automata (“finite-state.
Topics Automata Theory Grammars and Languages Complexities
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
Grammars, Languages and Finite-state automata Languages are described by grammars We need an algorithm that takes as input grammar sentence And gives a.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
Languages and Machines Unit two: Regular languages and Finite State Automata.
Binary Numbers.
Regular Language & Expressions. Regular Language A regular language is one that a finite state machine (fsm) will accept. ‘Alphabet’: {a, b} ‘Rules’:
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 7 Mälardalen University 2010.
Grammars.
Lecture 21: Languages and Grammars. Natural Language vs. Formal Language.
Languages & Strings String Operations Language Definitions.
Week 14 - Friday.  What did we talk about last time?  Exam 3 post mortem  Finite state automata  Equivalence with regular expressions.
CSI 3120, Grammars, page 1 Language description methods Major topics in this part of the course: –Syntax and semantics –Grammars –Axiomatic semantics (next.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
CSC312 Automata Theory Lecture # 2 Languages.
Costas Busch - LSU1 Languages. Costas Busch - LSU2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat,
1 Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia.
Lecture Two: Formal Languages Formal Languages, Lecture 2, slide 1 Amjad Ali.
Definition A string is a sequence of symbols. Examples “Hi, Mom.” “YAK” “abbababba” Question In what ways do programmers use strings?
By: Er. Sukhwinder kaur.  What is Automata Theory? What is Automata Theory?  Alphabet and Strings Alphabet and Strings  Empty String Empty String 
1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4.
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
Grammars CPSC 5135.
1 Context-Free Languages. 2 Regular Languages 3 Context-Free Languages.
1 Introduction to Regular Expressions EELS Meeting, Dec Tom Horton Dept. of Computer Science Univ. of Virginia
1 Computability Five lectures. Slides available from my web page There is some formality, but it is gentle,
Copyright © Curt Hill Languages and Grammars This is not English Class. But there is a resemblance.
9.7: Chomsky Hierarchy.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Theory of Automata We will arrive at what we may believe to be the most powerful machine possible. When.
Exercise 1 Consider a language with the following tokens and token classes: ID ::= letter (letter|digit)* LT ::= " " shiftL ::= " >" dot ::= "." LP ::=
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
September1999 CMSC 203 / 0201 Fall 2002 Week #14 – 25/27 November 2002 Prof. Marie desJardins clip art courtesy of
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 10 Automata, Grammars and Languages.
Lecture 16: Modeling Computation Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Theory of computation Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software,
1 Course Overview Why this course “formal languages and automata theory?” What do computers really do? What are the practical benefits/application of formal.
C Sc 132 Computing Theory Professor Meiliu Lu Computer Science Department.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Formal grammars A formal grammar is a system for defining the syntax of a language by specifying sequences of symbols or sentences that are considered.
A Quick Review of Set Theory A set is a collection of objects. A B D E We can enumerate the “members” or “elements” of finite sets: { A, D, B, E }. There.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Week 14 - Friday.  What did we talk about last time?  Simplifying FSAs  Quotient automata.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
Chapter 2. Formal Languages Dept. of Computer Engineering, Hansung University, Sung-Dong Kim.
General Discussion of “Properties” The Pumping Lemma Membership, Emptiness, Etc.
Department of Software & Media Technology
Topic 3: Automata Theory 1. OutlineOutline Finite state machine, Regular expressions, DFA, NDFA, and their equivalence, Grammars and Chomsky hierarchy.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesAlgebraic.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS
Lecture 1 Theory of Automata
CIS Automata and Formal Languages – Pei Wang
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Natural Language Processing - Formal Language -
Formal Language Theory
Formal Methods in software development
Introduction Reading: Sections 1.5 – 1.7.
CSC312 Automata Theory Lecture # 2 Languages.
Languages Fall 2018.
Presentation transcript:

Languages and Machines Unit one: Formal Languages

2 What is a language? means of communication linear can translate between two languages has containment structure of symbols has atomic (terminal) symbols from which all others can be made

3 Hierarchy of structures Paragraph Sentence Word Letter 1..

4 What is a machine? a language* processor interprets a language translates one language to another modifies an expression in a language * a language can have graphical symbols

5 Examples of languages English German Java Mathematics UML

6 The cat sat on the mat. Example of language: English symbol string

7 Example of language: German Die Katze saß auf dem Teppich.

8 Example of language: Java while (sunny) mat.sitOn(myCat);

9 Example of language: Maths  c : Cat ● isOnMat(c)

10 Example of language: UML Note: this two-dimensional diagram could be translated to a one-dimensional string (e.g. XML) Cat feed stroke Mat sitOn(c : Cat)

11 UML in XML 'Cat' 'feed' 'stroke'...

12 UML in XML without layout 'Cat' 'feed' 'stroke'... no information lost a linear string of symbols

13 Activity write down an example of a language, and state what its symbols are

14 Formal language has a collection of symbols is this a set or sequence? a set is it a finite or infinite set? finite we call this set the alphabet

15 Activity Write down the alphabet for 1.the language of binary numbers 2.the language of ordinary decimal numbers 3.the language of traffic lights 4.the language of simple diagrams made up of circles, rectangles and straight lines

16 Suggested answer 1.{0,1} 2.{0,1,2,3,4,5,6,7,8,9} 3.{red, amber, green} 4.{circle, rectangle, line}

17 Formal language a formal language is just a set of strings is the set finite? maybe, it depends on the language e.g.1. the language consisting of all two-bit strings is finite: {00,01,10,11} e.g.2. the language consisting of all binary strings is infinite: given any finite set of strings, we can always add another string by taking the longest string and adding one more bit to it

18 Classes of formal language regular phrase structure context-free context-sensitive

19 Classes of language: examples The man bites the dog. (Context-free) ((5 + 3) / (5 – 1)) * (7 - 5) (Context-free) NUMBER_OF_PAWS(Regular)

20 Regular languages 1.the empty set is a regular language 2.the set consisting of the empty string (  ) is a regular language 3.the set consisting of a one-symbol string is a regular language 4.a new regular language can be made by taking a string from a regular language and concatenating it with a string from a regular language 5.a new regular language can be made by taking the union of two regular languages

21 Examples of regular languages 1.the set of all two-bit strings 2.the set of all English words 3.the set of all decimal integers 4.the set of Java identifiers You don't believe me?...

22 Activity How many strings do the following regular languages contain? 1.all the possible three-bit strings 2.all the single-digit decimal numbers 3.all the possible repetitions of the traffic-light sequence (red, amber, green, amber)

23 Suggested Answers infinite

24 Recognizing regular languages regular languages can be recognized and interpreted by a finite-state machine for example, here is a machine to recognize a two-bit string: acceptor states

25 Finite-state machines Here is a machine that recognizes a bit-string of any length: 0 1 can you simplify this machine?

26 Summary A language, formally speaking, is a set of strings. The set may be finite or infinite. A string is a finite sequence of symbols. The sequence has a minimal length of zero. A symbol is just a mark or shape that conveys meaning. It is a member of a finite alphabet.

27 Summary A regular language has very simple formation rules involving sequences, repetitions and alternatives. A context-free language is a language in which each kind of phrase has the same structure, irrespective of where it is in the string of phrases We speak in natural language, which are not strictly formal languages. The grammar rules of natural languages are more-or-less context free. We use computer languages. All the usual computer languages are context-free.