The document discusses syntax-directed translation of code into three-address code. It defines semantic rules for generating three-address code for expressions, boolean expressions, and control flow statements. Temporary variables are generated for subexpressions and intermediate values. The semantic rules specify generating three-address code statements using temporary variables. Backpatching is also discussed as a technique to replace symbolic names in goto statements with actual addresses after code generation.
Directed Acyclic Graph Representation of basic blocks is the most important topic of compiler design.This will help for student studying in master degree in computer science.
Control Strategies
Control Strategy in Artificial Intelligence
scenario is a technique or strategy, tells us about which rule has to be applied next while searching for the solution of a problem within problem space.
It helps us to decide which rule has to apply next without getting stuck at any point.
Characteristics of Control Strategies
A good Control strategy has two main
characteristics:
Control Strategy should cause Motion
Control strategy should be Systematic
Co ntrol Strategy should cause Motion
Each rule or strategy applied should cause the motion because if there will be no motion than such control strategy will never lead to a solution. Motion states about the change of state and if a state will not change then there be no movement from an initial state and we would never solve the problem.
Co ntrol Strategy should be Systematic
Though the strategy applied should create the
motion but if do not follow some systematic
strategy than we are likely to reach the same state
number of times before reaching the solution
which increases the number of steps. Taking care of only first strategy we may go through particular useless sequences of operators several times. Control Strategy should be systematic implies a need for global motion as well as for local motion.
Directed Acyclic Graph Representation of basic blocks is the most important topic of compiler design.This will help for student studying in master degree in computer science.
Control Strategies
Control Strategy in Artificial Intelligence
scenario is a technique or strategy, tells us about which rule has to be applied next while searching for the solution of a problem within problem space.
It helps us to decide which rule has to apply next without getting stuck at any point.
Characteristics of Control Strategies
A good Control strategy has two main
characteristics:
Control Strategy should cause Motion
Control strategy should be Systematic
Co ntrol Strategy should cause Motion
Each rule or strategy applied should cause the motion because if there will be no motion than such control strategy will never lead to a solution. Motion states about the change of state and if a state will not change then there be no movement from an initial state and we would never solve the problem.
Co ntrol Strategy should be Systematic
Though the strategy applied should create the
motion but if do not follow some systematic
strategy than we are likely to reach the same state
number of times before reaching the solution
which increases the number of steps. Taking care of only first strategy we may go through particular useless sequences of operators several times. Control Strategy should be systematic implies a need for global motion as well as for local motion.
FellowBuddy.com is an innovative platform that brings students together to share notes, exam papers, study guides, project reports and presentation for upcoming exams.
We connect Students who have an understanding of course material with Students who need help.
Benefits:-
# Students can catch up on notes they missed because of an absence.
# Underachievers can find peer developed notes that break down lecture and study material in a way that they can understand
# Students can earn better grades, save time and study effectively
Our Vision & Mission – Simplifying Students Life
Our Belief – “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”
Like Us - https://www.facebook.com/FellowBuddycom
Artificial Intelligence: Introduction, Typical Applications. State Space Search: Depth Bounded
DFS, Depth First Iterative Deepening. Heuristic Search: Heuristic Functions, Best First Search,
Hill Climbing, Variable Neighborhood Descent, Beam Search, Tabu Search. Optimal Search: A
*
algorithm, Iterative Deepening A*
, Recursive Best First Search, Pruning the CLOSED and OPEN
Lists
Artificial Intelligence: Introduction, Typical Applications. State Space Search: Depth Bounded
DFS, Depth First Iterative Deepening. Heuristic Search: Heuristic Functions, Best First Search,
Hill Climbing, Variable Neighborhood Descent, Beam Search, Tabu Search. Optimal Search: A
*
algorithm, Iterative Deepening A*
, Recursive Best First Search, Pruning the CLOSED and OPEN
Lists
THIS DESCRIBES VARIOUS ELEMENTS OF TRANSPORT PROTOCOL IN TRANSPORT LAYER OF COMPUTER NETWORKS
THERE ARE SIX ELEMENTS OF TRANSPORT PROTOCOL NAMELY
1. ADDRESSING
2. CONNECTION ESTABLISHMENT
3.CONNECTION REFUSE
4.FLOW CONTROL AND BUFFERS
5.MULTIPLEXING
6.CRASH RECOVERY
FellowBuddy.com is an innovative platform that brings students together to share notes, exam papers, study guides, project reports and presentation for upcoming exams.
We connect Students who have an understanding of course material with Students who need help.
Benefits:-
# Students can catch up on notes they missed because of an absence.
# Underachievers can find peer developed notes that break down lecture and study material in a way that they can understand
# Students can earn better grades, save time and study effectively
Our Vision & Mission – Simplifying Students Life
Our Belief – “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”
Like Us - https://www.facebook.com/FellowBuddycom
Artificial Intelligence: Introduction, Typical Applications. State Space Search: Depth Bounded
DFS, Depth First Iterative Deepening. Heuristic Search: Heuristic Functions, Best First Search,
Hill Climbing, Variable Neighborhood Descent, Beam Search, Tabu Search. Optimal Search: A
*
algorithm, Iterative Deepening A*
, Recursive Best First Search, Pruning the CLOSED and OPEN
Lists
Artificial Intelligence: Introduction, Typical Applications. State Space Search: Depth Bounded
DFS, Depth First Iterative Deepening. Heuristic Search: Heuristic Functions, Best First Search,
Hill Climbing, Variable Neighborhood Descent, Beam Search, Tabu Search. Optimal Search: A
*
algorithm, Iterative Deepening A*
, Recursive Best First Search, Pruning the CLOSED and OPEN
Lists
THIS DESCRIBES VARIOUS ELEMENTS OF TRANSPORT PROTOCOL IN TRANSPORT LAYER OF COMPUTER NETWORKS
THERE ARE SIX ELEMENTS OF TRANSPORT PROTOCOL NAMELY
1. ADDRESSING
2. CONNECTION ESTABLISHMENT
3.CONNECTION REFUSE
4.FLOW CONTROL AND BUFFERS
5.MULTIPLEXING
6.CRASH RECOVERY
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Syntax-Directed Translation into Three Address Code
1.
2. Syntax-Directed Translation into Three
Address Code
Syntax-directed translation rules can be defined to
generate the three address code while parsing the
input. It may be required to generate temporary names
for interior nodes which are assigned to non-terminal
E on the left side of the production E→E1 op E2. we
associate two attributes place and code associated with
each non-terminal.
E.place, the name that will hold the value of E.
E.code, the sequence of three-address statements
evaluating E.
3. Syntax-Directed Translation into
Three Address Code
To generate intermediate code for SDD, first searching
is applied to get the information of the identifier from
the symbol table. After searching, the three address
code is generated for the program statement. Function
lookup will search the symbol table for the lexeme and
store it in id.place.
Function newtemp is defined to return a new
temporary variable when invoked and
gen function generates the three address statement in
one of the above standard forms depending on the
arguments passed to it.
6. Translation of Boolean Expression
Boolean Expression have 2 primary purpose.
1. Used to computing logical values.
2. Used to computing conditional expression using
if then else or while-do.
E → E1 or E2
E → E1 and E2
E → not E1
E → id1 relop id2
E → (E1)
E → true
E → false
7. Boolean Expression: Grammar and Actions
Production Semantic Rule
E → E1 or E2
{E.place = newtemp();
gen(E.place "=" E1.place "or" E2.place)}
E → E1 and E2 {E.place = newtemp();
gen(E.place "=" E1.place "and" E2.place)}
E → not E1 {E.place = newtemp();
gen(E.place "=" "not" E1.place)}
E → (E1) {E.place = E1.place}
E → id1 relop id2 {E.place = newtemp();
gen( "if" id1.place relop.op id2.place "goto" nextstat + 3)
gen(E.place "=" "0")
gen("goto" nextstat + 2)
gen(E.place "=" "1")}
E → true {E.place = newtemp();
gen(E.place "=" "1")}
E → false {E.place = newtemp();
gen(E.place "=" "0")}
8. Boolean Expression: Example
Example1 :-
Given Boolean Expression
if x < y then 1 else 0
The address code for the
above expression is
1. if x < y go to 3
2. t1 = 0
3. go to 4
4. t1 = 1
Production Semantic Rule
E → E1 or E2
{E.place = newtemp();
gen(E.place "=" E1.place "or" E2.place)}
E → E1 and E2 {E.place = newtemp();
gen(E.place "=" E1.place "and" E2.place)}
E → not E1 {E.place = newtemp();
gen(E.place "=" "not" E1.place)}
E → (E1) {E.place = E1.place}
E → id1 relop id2 {E.place = newtemp();
gen( "if" id1.place relop.op id2.place "goto" nextstat + 3)
gen(E.place "=" "0")
gen("goto" nextstat + 2)
gen(E.place "=" "1")}
E → true {E.place = newtemp();
gen(E.place "=" "1")}
E → false {E.place = newtemp();
gen(E.place "=" "0")}
9. Boolean Expression: Example
Example 2 :-
Given Boolean Expression
x or y and not z
The address code for
the above expression is
t1 = not z
t2 = y and t1
t3 = x or t2
Production Semantic Rule
E → E1 or E2
{E.place = newtemp();
gen(E.place "=" E1.place "or" E2.place)}
E → E1 and E2 {E.place = newtemp();
gen(E.place "=" E1.place "and" E2.place)}
E → not E1 {E.place = newtemp();
gen(E.place "=" "not" E1.place)}
E → (E1) {E.place = E1.place}
E → id1 relop id2 {E.place = newtemp();
gen( "if" id1.place relop.op id2.place "goto" nextstat + 3)
gen(E.place "=" "0")
gen("goto" nextstat + 2)
gen(E.place "=" "1")}
E → true {E.place = newtemp();
gen(E.place "=" "1")}
E → false {E.place = newtemp();
gen(E.place "=" "0")}
10. Boolean Expression: Example
Example : Give three address code for the
following: while(P < Q)do
if(R < S) then a = b + c;
Solution 1. if P < Q goto (3)
2. goto (8)
3. if R < S goto (5)
4. goto (1)
5. t1: = b + c
6. a: = t1
7. goto (1)
8. Next
11. Control Statements
Flow of control statements can be shown pictorially as
Control low for if-then-else statement Control low for while statement
12. Translation of Control Flow Statements
Production Semantic Rule
S → if E then S1 {E.true = newlabel();
E.false = S.next;
S1.next = S.next;
S.code = E.code | | gen(E.true,":") | | S1.code}
S → if E then S1 else
S2
{E.true = newlabel();
E.false = newlabel();
S1next = S.next;
S2.next = S.next;
S.code = E.code | | gen(E.true,":") | | S1.code | | gen("
GOTO ", S.next) | | gen(E.false, " :") | | S2.code}
S → while E do S1 {S.begin = newlabel();
E.true = newlabel();
E.false = S.next;
S1.next = S.next;
S.code = gen(S.begin":") | | E.code | | gen(E.true,":") | |
S1..code | | gen("GOTO",S.begin)}
13. Control Flow Statements
Example : Give three address code for the following:
While (a < 5) do a: = b + 2
Solution:-
L1:
If a < 5 goto L2
goto last
L2:
t1 = b + 2
a = t1
goto L1
last:
14. Control Flow Statements
Example : Give three address code for
the following:
while a<b
do
if c < d then
x = y + z
else
x = y - z
done
Solution:-
L1. if a<b then GOTO L2
GOTO LNEXT
L2. if c<d then GOTO L3
GOTO L4
L3. tl = y + z
x = tl
GOTO L1
L4. tl= y - z
x = tl
GOTO L1
LNEXT.
15. Backpatching
Back patching is a technique to solve the problem
of replacing symbolic names into the goto
statements by the actual target addresses. Some
languages do not permit to use symbolic names in
the branches, for this we maintain a list of
branches that have the same target labels and then
replace them once they are defined. To manipulate
the lists of jumps.
16. Backpatching
To perform backpatching the following three functions are
used:
makelist(i): This function creates a new list containing an
index i into the array of statements and then returns a
pointer pointing to the newly created list.
merge(p1, p2): This function concatenates the two lists
pointed to by the pointers p1 and p2 respectively, and then
returns a pointer to the concatenated list.
backpatch(p, i): This function inserts i as the target labels
for each of the statements on the list pointed by p.
18. Backpatching for Boolean Expressions
Annotated parse tree for x < 100 || x > 200 && x ! = y
100 if x < 100 then 106
101 goto 102
102 if x>200 then 104
103 goto 107
104 if x ! = y then 106
105 goto 107
106 true
107 false