This slide contains,
1) Some terminologies like yields, derives, word, derivation
2) Leftmost and Rightmost derivation
3) Ambiguity checking
4) Parse tree generation and ambiguity checking
This is the lecture slide contains:
- CFG definition
- Designing CFG from DFA
- Designing CFG from RE
- Designing CFG for linked terminals typed languages
- Union of CFGs
This lecture slide contains:
- Difference between FA, PDA and TM
- Formal definition of TM
- TM transition function and configuration
- Designing TM for different languages
- Simulating TM for different strings
This lecture covers:
1. Regular Language and Regular Operations
2. Closure properties of DFAs
3. Union of 2 DFA machines
4. Intersection of 2 DFA machines
5. Complement of DFA machines
This lecture slide contains:
1. Regular Languages
2. Regular Operations
3. Closure of regular languages
4. Regular expression
5. Precedence of regular operations
6. RE for different languages
7. RE to NFA conversion
8. DFA to GNFA to RE conversion
This is the lecture slide contains:
- CFG definition
- Designing CFG from DFA
- Designing CFG from RE
- Designing CFG for linked terminals typed languages
- Union of CFGs
This lecture slide contains:
- Difference between FA, PDA and TM
- Formal definition of TM
- TM transition function and configuration
- Designing TM for different languages
- Simulating TM for different strings
This lecture covers:
1. Regular Language and Regular Operations
2. Closure properties of DFAs
3. Union of 2 DFA machines
4. Intersection of 2 DFA machines
5. Complement of DFA machines
This lecture slide contains:
1. Regular Languages
2. Regular Operations
3. Closure of regular languages
4. Regular expression
5. Precedence of regular operations
6. RE for different languages
7. RE to NFA conversion
8. DFA to GNFA to RE conversion
This Lecture Note discusses the followings:
- What is NFA
- DFA vs NFA
- How does NFA compute
- Designing different NFA machines
- Regular operations on NFAs
- Conversion from NFA to DFA
This presentation contains:
1. Language, Regular Language
2. DFA vs. NFA
3. Components of DFA
4. Acceptability checking
5. Group-wise designing different types of DFA machines
---TABLE OF CONTENT---
Introduction
Differences between crisp sets & Fuzzy sets
Operations on Fuzzy Sets
Properties
MF formulation and parameterization
Fuzzy rules and Fuzzy reasoning
Fuzzy interface systems
Introduction to genetic algorithm
Using Cauchy Inequality to Find Function ExtremumsYogeshIJTSRD
The article explains the relationships between the mean values using triangles. Here are some ways to determine the extreme values of some functions using the Cauchy inequality, which represents the relationship between arithmetic mean and geometric mean. G. A. Akhmedova | O. Yu. Makhmudova "Using Cauchy Inequality to Find Function Extremums" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Special Issue | International Research Development and Scientific Excellence in Academic Life , March 2021, URL: https://www.ijtsrd.com/papers/ijtsrd38751.pdf Paper Url: https://www.ijtsrd.com/mathemetics/other/38751/using-cauchy-inequality-to-find-function-extremums/g-a-akhmedova
This Lecture Note discusses the followings:
- What is NFA
- DFA vs NFA
- How does NFA compute
- Designing different NFA machines
- Regular operations on NFAs
- Conversion from NFA to DFA
This presentation contains:
1. Language, Regular Language
2. DFA vs. NFA
3. Components of DFA
4. Acceptability checking
5. Group-wise designing different types of DFA machines
---TABLE OF CONTENT---
Introduction
Differences between crisp sets & Fuzzy sets
Operations on Fuzzy Sets
Properties
MF formulation and parameterization
Fuzzy rules and Fuzzy reasoning
Fuzzy interface systems
Introduction to genetic algorithm
Using Cauchy Inequality to Find Function ExtremumsYogeshIJTSRD
The article explains the relationships between the mean values using triangles. Here are some ways to determine the extreme values of some functions using the Cauchy inequality, which represents the relationship between arithmetic mean and geometric mean. G. A. Akhmedova | O. Yu. Makhmudova "Using Cauchy Inequality to Find Function Extremums" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Special Issue | International Research Development and Scientific Excellence in Academic Life , March 2021, URL: https://www.ijtsrd.com/papers/ijtsrd38751.pdf Paper Url: https://www.ijtsrd.com/mathemetics/other/38751/using-cauchy-inequality-to-find-function-extremums/g-a-akhmedova
The International Journal of Engineering & Science is aimed at providing a platform for researchers, engineers, scientists, or educators to publish their original research results, to exchange new ideas, to disseminate information in innovative designs, engineering experiences and technological skills. It is also the Journal's objective to promote engineering and technology education. All papers submitted to the Journal will be blind peer-reviewed. Only original articles will be published.
ABSTRACT: In this paper, we construct new classes of derivative-free of tenth-order iterative methods for solving nonlinear equations. The new methods of tenth-order convergence derived by combining of theSteffensen's method, the Kung and Traub’s of optimal fourth-order and the Al-Subaihi's method. Several examples to compare of other existing methods and the results of new iterative methods are given the encouraging results and have definite practical utility.
The International Journal of Engineering & Science is aimed at providing a platform for researchers, engineers, scientists, or educators to publish their original research results, to exchange new ideas, to disseminate information in innovative designs, engineering experiences and technological skills. It is also the Journal's objective to promote engineering and technology education. All papers submitted to the Journal will be blind peer-reviewed. Only original articles will be published.
The International Journal of Engineering & Science is aimed at providing a platform for researchers, engineers, scientists, or educators to publish their original research results, to exchange new ideas, to disseminate information in innovative designs, engineering experiences and technological skills. It is also the Journal's objective to promote engineering and technology education. All papers submitted to the Journal will be blind peer-reviewed. Only original articles will be published.
The papers for publication in The International Journal of Engineering& Science are selected through rigorous peer reviews to ensure originality, timeliness, relevance, and readability.
On ranges and null spaces of a special type of operator named 𝝀 − 𝒋𝒆𝒄𝒕𝒊𝒐𝒏. – ...IJMER
In this article, 𝜆 − 𝑗𝑒𝑐𝑡𝑖𝑜𝑛 has been introduced which is a generalization of trijection
operator as introduced in P.Chandra’s Ph. D. thesis titled “Investigation into the theory of operators
and linear spaces” (Patna University,1977). We obtain relation between ranges and null spaces of two
given 𝜆 − 𝑗𝑒𝑐𝑡𝑖𝑜𝑛𝑠 under suitable conditions.
This slide explains the conversion procedure from ER Diagram to Relational Schema.
1. Entity set to Relation
2. Relationship set to Relation
3. Attributes to Columns, Primary key, Foreign Keys
1. What is Entity Relationship Model
2. Entity and Entity Set
3. Relationship and Relationship Set
4. Attributes and it's kinds
5. Participation Constraints and Mapping Cardinality
6. Aggregation, Specialization, and Generalization
7. Some Sample ERD models
This note includes the followings:
- Database Create, Drop Operations
- Database Table Create, Drop Operations
- Database Table Alter Operation
- Data insertion
- Data deletion
- Existing data update
- Searching data from data table (showing all record, specific columns, specific rows, column aliasing, sorting data, limiting data, distinct data)
- Aggregate functions
- Group by clause
- Having clause
- Types of table joins
- Table aliasing, Inner Join, Left/Right Join, Self Join
- Subquery operation (scalar subquery, column subquery, row subquery, correlated subquery, derived table)
This note contains some sample MySQL query practices based on the HR Schema database. The practice sections are from the following categories:
- DDL statements
- Basic Select statements
- Aggregate operations
- Join operations
This presentation contains:
1. Introduction
2. Central areas of TOC
3. Complexity theory
4. Computability theory
5. Automata theory
6. Related terminologies
7. Strings
8. Languages
9. Proof, Theorem, Lemma, Corollaries
Contents:
1. Direct Address Table
2. Hashing
3. Characteristics of a good hash function
4. Collision Resolution using Chaining and Probing
5. Static vs Dynamic Hashing
6. Extendible Hashing
7. B+ tree vs Hashing
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
2. CFG – Context-free Grammar
2
A Context-free Grammar is a 4 tuple (V, 𝛴, R, S), where
▸ V is a finite set called the variables
▸ Σ is a finite set, disjoint from V, called the terminals
▸ R is a finite set of rules, with each rule being a variable and a string of variables and terminals
▸ S ϵ V is the start variable
Example:
Grammar, G1 = ( { S }, { a, b }, R, S )
V = { S }
Σ = { a, b }
R is,
S → aSb | SS | ε
Example:
Grammar, G2 = ( V, Σ, R, <EXPR> )
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R is,
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
3. CFL – Context-free Language
3
Context-free Language:
– The collection of languages generated by some context-free grammars are called Context-free Languages.
– They include all the regular languages and many additional(recursive structure) languages.
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
4. CFG >> Terminologies – yields, derives, derivation
4
▸ If u, v, w are strings of variables and terminals, and A → w is a rule of the grammar, we say that
uAv ⟹ uwv i.e. uAv yields uwv
▸ We say u derives v, written as
- if u = v or
- if a sequence u1, u2, u3, … … … , uk exists for k >= 0 and u ⟹ u1 ⟹ u2 ⟹ u3 ⟹ … … ⟹ uk ⟹ v
▸ A word is a string of terminals and the language of the grammar is { w ∈ 𝛴* | S =*> w }
▸ A derivation of a word w from a CFG G = ( V, 𝛴, R, S ) is a sequence of strings over V U 𝛴 ,
S = s0 => s1 => s2 => … … … => sk = w
where
- s0 = S is the start variable of G
- For each 1 <= i <= k,
si is obtained by activating a single production rule of G on one of the variables of si-1
vu
*
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
5. CFG >> Derivation
5
Derivation – you can apply rules to any variables, no order is maintained. [single rules at a time]
For example, a + a x a
<EXPR>
⇒ <EXPR> + <TERM>
⇒ <TERM> + <TERM>
⇒ <TERM> + <TERM> x <FACTOR>
⇒ <TERM> + <TERM> x a
⇒ <FACTOR>+ <TERM> x a
⇒ a + <TERM> x a
⇒ a + <FACTOR> x a
⇒ a + a x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
6. CFG >> Leftmost Derivation
6
Leftmost Derivation – A derivation of a string w in a grammar G is a leftmost derivation
if at every step the leftmost remaining variable is the one replaced.
For example, a + a x a
<EXPR>
⇒ <EXPR> + <TERM>
⇒ <TERM> + <TERM>
⇒ <FACTOR> + <TERM>
⇒ a + <TERM>
⇒ a + <TERM> x <FACTOR>
⇒ a + <FACTOR> x <FACTOR>
⇒ a + a x <FACTOR>
⇒ a + a x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
7. CFG >> Rightmost Derivation
7
Rightmost Derivation – A derivation of a string w in a grammar G is a rightmost derivation
if at every step the rightmost remaining variable is the one replaced.
For example, a + a x a
<EXPR>
⇒ <EXPR> + <TERM>
⇒ <EXPR> + <TERM> x <FACTOR>
⇒ <EXPR> + <TERM> x a
⇒ <EXPR> + <FACTOR> x a
⇒ <EXPR> + a X a
⇒ <TERM> + a X a
⇒ <FACTOR> + a X a
⇒ a + a X a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
8. CFG >> Leftmost vs Rightmost Derivation
8
G = ( V, Σ, R, S )
Where,
V = { S }
Σ = { (, ) }
R={
S → SS | ( S ) | 𝜀
}
Leftmost derivation of “( ) ( )”: S ⇒ SS ⇒ ( S ) S ⇒ ( ) S ⇒ ( ) ( S ) ⇒ ( ) ( )
Rightmost derivation of “( ) ( )”: S => SS => S ( S ) => S ( ) => ( S ) ( ) => ( ) ( )
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
9. CFG >> Parse Tree
9
Root – must be labeled by the start variable
Leaves – labeled by a terminal or 𝜀
Interior nodes – labeled by a variable
Yield – the concatenation of the labels of the leaves in left to right order
For example, S → SS | ( S ) | ( )
yields ( ( ) ) ( )
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
10. CFG >> Example 1
10
▸ Let, CFG G = ( V, Σ, R, <EXPR> )
where V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
▸ Derive the following strings
- a + a x a
- ( a + a ) x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
11. CFG >> “a+ a x a” Leftmost Derivation
11
<EXPR>
⇒ <EXPR> + <TERM>
⇒ <TERM> + <TERM>
⇒ <FACTOR> + <TERM>
⇒ a + <TERM>
⇒ a + <TERM> x <FACTOR>
⇒ a + <FACTOR> x <FACTOR>
⇒ a + a x <FACTOR>
⇒ a + a x a
So, <EXPR> derives a + a x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Practice the rightmost derivation.
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
12. CFG >> “a+ a x a” Parse Tree
12
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
Is there any leftmost/rightmost version of parse tree??
13. CFG >> “( a+ a ) x a” Leftmost Derivation
13
<EXPR>
⇒ <TERM>
⇒ <TERM> x <FACTOR>
⇒ <FACTOR> x <FACTOR>
⇒ ( <EXPR> ) x <FACTOR>
⇒ ( <EXPR> + <TERM> ) x <FACTOR>
⇒ ( <TERM> + <TERM> ) x <FACTOR>
⇒ ( <FACTOR> + <TERM> ) x <FACTOR>
⇒ ( a + <TERM> ) x <FACTOR>
⇒ ( a + <FACTOR> ) x <FACTOR>
⇒ ( a + a ) x <FACTOR>
⇒ ( a + a ) x a
So, <EXPR> derives ( a + a ) x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
14. CFG >> “( a+ a ) x a” Parse Tree
14
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a
}
15. CFG >> Practice 1
15
▸ Let, CFG G = ( V, Σ, R, <EXPR> )
where V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, b, +, x, (, ) }
R={
<EXPR> → <EXPR> + <TERM> | <TERM>
<TERM> → <TERM> x <FACTOR> | <FACTOR>
<FACTOR> → ( <EXPR> ) | a | b
}
▸ Derive the following strings:
- ( a + b ) x a
- a + b x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
16. CFG >> Practice 2
16
▸ Let us consider a CFG with the following production rules,
<SENTENCE> → <NOUN-PHRASE> <VERB-PHRASE>
<NOUN-PHRASE> → <CMPLX-NOUN> | <CMPLX-NOUN> <PREP-PHRASE>
<VERB-PHRASE> → <CMPLX-VERB> | <CMPLX-VERB> <PREP-PHRASE>
<PREP-PHRASE> → <PREP> <CMPLX-NOUN>
<CMPLX-NOUN> → <ARTICLE> <NOUN>
<CMPLX-VERB> → <VERB> | <VERB> <NOUN-PHRASE>
<ARTICLE> → a | the
<NOUN> → boy | girl | flower
<VERB> → touches | likes | sees
<PREP> → with
▸ Now derive the following strings:
- a boy sees
- The boy sees a flower
- a girl with a flower likes the boy
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
17. CFG >> Ambiguity
17
▸ Grammar G is ambiguous if it generates some string ambiguously.
▸ A string w is derived ambiguously in context-free grammar G if it has two or more different leftmost derivations.
▸ A Context Free Grammar G = ( V, 𝛴, R, S ) is ambiguous if there is some string w ∈ 𝛴* such that there are two distinct parse
trees T1 and T2 having S at the root and having yield w.
[ Note: Two parse trees are equal if they are equal as trees and if all productions corresponding to inner nodes are also equal ]
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
18. CFG >> Ambiguity – Example 1
18
CFG G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR> }
Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <EXPR> | <EXPR> X <EXPR> | ( <EXPR> ) | a
}
Now derive the string : a + a x a
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
19. CFG >> Ambiguity – a + a x a Derivation
19
CFG G = ( V, Σ, R, <EXPR> ) where, V = { <EXPR> } and Σ = { a, +, x, (, ) }
R={
<EXPR> → <EXPR> + <EXPR> | <EXPR> X <EXPR> | ( <EXPR> ) | a
}
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Parse Tree 1 Parse Tree 2
20. CFG >> Ambiguity – Practice 1
20
CFG G = ( V, Σ, R, <EXPR> )
Where,
V = { <EXPR>, <TERM>, <FACTOR> }
Σ = { a, b, +, x }
R={
<EXPR> → <EXPR> + <EXPR> | <EXPR> X <EXPR> | a | b
}
Does the grammar generate the string “a + b x a” ambiguously???
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
21. CFG >> Ambiguity – Practice 2
21
CFG G = ( V, Σ, R, S )
Where,
V = { S }
Σ = { (, ) }
R={
S → SS | ( S ) | ( )
}
Does the grammar generate the string “( )( )( )” ambiguously???
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
22. CFG >> Ambiguity – Practice 3
22
CFG G = ( V, Σ, R, S )
Where,
V = { S, A, B, C, D }
Σ = { 0, 1, 2 }
R={
S → AB | CD
A → 0A1 | 01
B → 2B | 2
C → 0C | 0
D → 1D2 | 12
}
Does the grammar generate the string “012” or, “001122” ambiguously???
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
23. a)
S → AB | C
A → aAb | ab
B → cBd | cd
C → aCd | aD
D → bDc | bc
b)
S → ABA
A → Aa | eps
B → bB | eps
CFG >> Ambiguity – Practice 4
23
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
▪ Can the string ‘aabbccdd’ be derived from the above CFG? If yes, show the
leftmost and rightmost derivation.
▪ Is the leftmost derivation unique? If not, show the other leftmost derivation.
▪ Is the grammar ambiguous? Justify your answer with a suitable example.
24. a)
E → E + T | T
T → T x F | F
F → (E) | a
b)
S → S + S | S * S | A | B
A → aA | 1
B → bB | 2
CFG >> Ambiguity – Practice 5
24
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Now give parse trees and elft-most derivations for each of the following:
▪ a + a
▪ a x a + a
▪ ((a))
▪ Show a leftmost derivation of the string: aa1 + bb2 * a1
▪ Show whether the string, bbb2 + aa1 + b2, makes the grammar ambiguous
25. a)
E → E + E | E – E | ( E ) | V
V → x | y | z | A
A → A * A | A % A | C
C → 0 | 1
b)
E → E + E | E * E | ( E ) | N
N → 0N | 1N | 0 | 1
CFG >> Ambiguity – Practice 6
25
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
▪ Find out if the following grammar is ambiguous or not, using the string
x+(0*1%0).
▪ If the grammar is ambiguous, show two different parse trees for this string.
▪ Show a leftmost derivation and rightmost derivation for the string:
( 1 + 10 ) * 1
26. a)
E → E + E | E * E | ( E ) | a | b | c
b)
S → WX | Y
W → aWb | ab
X → cXd | cd
Y → aYd | aZc
Z → aZb | bb
CFG >> Ambiguity – Practice 7
26
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
▪ Show the rightmost derivation and the leftmost derivation for the input string
a + ( b + c ) * c
▪ Determine whether the following CFG is ambiguous or not with the help of
following input string ‘aabbcd’
27. 27
References:
Chapter 2(section 2.1), Introduction to the Theory of Computation, 3rd Edition by Michael Sipser
THANKS!
Any questions?
You can find me at imam@cse.uiu.ac.bd