COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

Slides:



Advertisements
Similar presentations
CS3012 Formal Languages and Compilers Frank Guerin Room 227 Lectures Monday11:00MT3 Tuesday9:00105 St. Marys Tutorials Thursday13:00 Thursday 14:00definitely.
Advertisements

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.
Properties of Regular Languages
1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
YES-NO machines Finite State Automata as language recognizers.
Strings and Languages Operations
CS 310 – Fall 2006 Pacific University CS310 Strings, String Operators, and Languages Sections: August 30, 2006.
1 Languages and Finite Automata or how to talk to machines...
Fall 2005 CSE 467/567 1 Formal languages regular expressions regular languages finite state machines.
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
Topics Automata Theory Grammars and Languages Complexities
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Languages & Strings String Operations Language Definitions.
Lexical Analysis CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
CS/IT 138 THEORY OF COMPUTATION Chapter 1 Introduction to the Theory of Computation.
CSC312 Automata Theory Lecture # 2 Languages.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
Lecture Two: Formal Languages Formal Languages, Lecture 2, slide 1 Amjad Ali.
1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,
1 Chapter 1 Introduction to the Theory of Computation.
Introduction to Language Theory
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
Recursive Definitions & Regular Expressions (RE)
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Mathematical Notions and Terminology Lecture 2 Section 0.2 Fri, Aug 24, 2007.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
CSC312 Automata Theory Lecture # 3 Languages-II. Formal Language A formal language is a set of words—that is, strings of symbols drawn from a common alphabet.
Recursive Definations Regular Expressions Ch # 4 by Cohen
Strings and Languages Denning, Section 2.7. Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object.
Lecture # 4.
Lecture 2 Theory of AUTOMATA
Introduction Why do we study Theory of Computation ?
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
1 Chapter 3 Regular Languages.  2 3.1: Regular Expressions (1)   Regular Expression (RE):   E is a regular expression over  if E is one of:
1 Strings and Languages Lecture 2-3 Ref. Handout p12-17.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Languages and Strings Chapter 2. (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2) Parsing: Create a tree.
Chapter 2. Formal Languages Dept. of Computer Engineering, Hansung University, Sung-Dong Kim.
Lecture #2 Advanced Theory of Computation. Languages & Grammar Before discussing languages & grammar let us deal with some related issues. Alphabet: is.
COP4620 – Programming Language Translators Dr. Manuel E. Bermudez
Theory of Computation Lecture #
Lecture # 2.
Language Theory Module 03.1 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
Languages.
Lexical Analysis CSE 340 – Principles of Programming Languages
Grammars Module 03.2 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Theory of Automata.
Natural Language Processing - Formal Language -
Languages, prefixes, sets, cardinality, functions
Mathematical Notions and Terminology
Formal Language Theory
Language and Automata Theory
REGULAR LANGUAGES AND REGULAR GRAMMARS
Review: Compiler Phases:
COSC 3340: Introduction to Theory of Computation
Languages, prefixes, sets, cardinality, functions
Introduction Reading: Sections 1.5 – 1.7.
Chapter 1 Introduction to the Theory of Computation
CSC312 Automata Theory Lecture # 3 Languages-II.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
LECTURE # 07.
Languages Fall 2018.
Presentation transcript:

COP4620 – Programming Language Translators Dr. Manuel E. Bermudez Language Theory COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

Language Theory We’ll Define Alphabet String Catenation Reflexive, Transitive Closure Language Language Constructor

Language Theory Definition: An alphabet (or vocabulary) Σ is a finite set of symbols. Example: Alphabet of C: + - * / < … (operators) while do if int (keywords) <identifier> (identifiers) <string> (strings) <integer> (integers) ; : , ( ) [ ] (punctuators) Note: All identifiers are represented by one symbol, because Σ must be finite.

Language Theory Definition: A sequence t = t1t2…tn of symbols from an alphabet Σ is a string. Definition: The length of a string t = t1t2…tn (denoted |t|) is n. If n = 0, the string is ε, the empty string. Definition: Given strings s = s1s2…sn and t = t1t2…tm, the concatenation of s and t, denoted st, is the string s1s2…snt1t2…tm. Note: εu = u = uε, uεv = uv, for any strings u,v (including ε)

Language Theory Definition: Σ* is the set of all strings of symbols from Σ. Σ* is called the reflexive, transitive closure of Σ. Σ* is described by a graph: (Σ*, ·), where “·” denotes concatenation, and there is a designated “start” node, namely ε.

Language Theory Example: Σ = {a, b}. (Σ*, ·) ε a b aa ab ba bb aba abb

Language Theory Example: Σ = C vocabulary. Then, Σ* = all possible alleged C programs, i.e. all possible inputs to the C compiler. Need to specify L ⊂ Σ*, the correct C programs. Definition: A language L over an alphabet Σ is a subset of Σ*.

Language Theory Example: Σ = {a, b}. L1 = ø is a language L3 = {a} is a language L4 = {a, ba, bbab} is a language L5 = {anbn / n >= 0}, where an = aa…a, n times, is a language L6 = {a, aa, aaa, …} is a language Note: L5 is an infinite language, but described finitely.

Language Theory THE MAIN GOALS OF LANGUAGE SPECIFICATION : Describe (infinite) programming languages finitely Provide corresponding finite inclusion-test algorithms. Will accomplish with grammars (soon)

Language Theory Definition: The catenation (or product) of two languages L1 and L2, denoted L1L2, is the set {uv | uL1, vL2}. Example: L1 = {ε, a, bb}, L2 = {ac, c} L1L2 = {ac, c, aac, ac, bbac, bbc} = {ac, c, aac, bbac, bbc}

Language Theory Definition: Ln = LL … L (n times), and L0 = {ε}. Example: L = {a, bb} L3 = {aaa, aabb, abba, abbbb, bbaa, bbabb, bbbba, bbbbbb}

Language Theory Definition: The union of two languages L1 and L2 is the set L1U L2 = {u | uL1} U { v | vL2} Definition: The Kleene star (L*) (reflexive, transitive closure) of a language is the set L* = ULn, n >0. Example: L = {a, bb} L* = {any string composed of a’s and bb’s}

Language Theory Definition: The Transitive Closure (L+) of a language L is the set L+ = U Ln, n > 1. Warning: In general, L* = L+ U {ε}, but L+ ≠ L* - {ε}. For example, consider L = {ε}. Then {ε} = L+ ≠ L* – {ε} = {ε} – {ε} = ø.

Language Theory We’ve Defined: Next: Grammars Alphabet, String, Catenation Reflexive, Transitive Closure Language, Language Constructors Catenation, Union, Kleene Star Next: Grammars