Compiler Construction

Slides:



Advertisements
Similar presentations
The Important Thing About By. The Important Thing About ******** The important thing about ***** is *****. It is true s/he can *****, *****, and *****.
Advertisements

Compiler Construction Sohail Aslam Lecture StackInput ¤0¤0 id – id  id $ s4 ¤0 id 4 – id  id $ r6 F → id ¤0F3¤0F3 – id  id $ r5 T → F ¤0T2¤0T2.
Compiler Construction Sohail Aslam Lecture ExampleExample a = b + c t1 = a * a b = t1 + a c = t1 * b t2 = c + b a = t2 + t2.
Compiler Construction Sohail Aslam Lecture Finite Automaton of Items Then for every item A →  X  we must add an  -transition for every production.
Compiler Construction Sohail Aslam Lecture Number Sign List Bit – 1 List Bit 1 0 Parse tree for – 101.
Compiler Construction Sohail Aslam Lecture Boolean Expressions E → E 1 and M E 2 {backpatch(E 1.truelist, M.quad); E.truelist = E 2.truelist; E.falselist.
True/False. False True Subject May Go Here True / False ? Type correct answer here. Type incorrect answer here.
1 CS 201 Compiler Construction Lecture 6 Code Optimizations: Constant Propagation & Folding.
 x (x 2  0) 1. True2. False.  x (3x + 2 = 12) 1. True2. False.
Compiler Construction CS 606 Sohail Aslam Lecture 2.
Determine whether each curve below is the graph of a function of x. Select all answers that are graphs of functions of x:
Compiler Construction Sohail Aslam Lecture Beyond Syntax  These questions are part of context-sensitive analysis  Answers depend on values, not.
Generalized De Morgan’s Theorem Lecture L5.4 Section 5.1.
Compiler Construction Sohail Aslam Lecture LL(1) Table Construction For each production A →  1.for each terminal a in FIRST(  ), add A →  to.
Compiler Construction Dr. Naveed Ejaz Lecture 5. Lexical Analysis.
Compiler Construction Sohail Aslam Lecture 9. 2 DFA Minimization  The generated DFA may have a large number of states.  Hopcroft’s algorithm: minimizes.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
Title Category #1 Category #2 Category #3Category #
Lecture No.08 Data Structures Dr. Sohail Aslam. Converting Infix to Postfix  Example: (A + B) * C symbpostfixstack( AA( +A( + BAB( + )AB + *AB +* CAB.
Compiler Construction Sohail Aslam Lecture Parser Generators  YACC – Yet Another Compiler Compiler appeared in 1975 as a Unix application.  The.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Lecture No.03 Data Structures Dr. Sohail Aslam
Compiler Construction
Parsing Techniques.
Factors, multiple, primes: Factors from prime factors
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
Lecture No.07 Data Structures Dr. Sohail Aslam
البرمجة بلغة الفيجول بيسك ستوديو
Name Not Precise Enough
Compiler Construction
Compiler Construction
Compiler Construction
Compiler Construction
True or False: {image} is one-to-one function.
Algorithms Lecture #21 Dr.Sohail Aslam.
Algorithms Lecture # 30 Dr. Sohail Aslam.
Algorithms Lecture #37 Dr. Sohail Aslam.
Compiler Construction
Compiler Construction
Data Structures Lecture 29 Sohail Aslam.
Algorithms Lecture # 29 Dr. Sohail Aslam.

Compiler Construction
Compiler Construction
Compiler Construction
Data Structures Lecture 21 Sohail Aslam.
Compiler Construction
Compiler Construction
Nonrecursive Predictive Parsing
Compiler Construction
Lecture No.02 Data Structures Dr. Sohail Aslam
Compiler Construction
Compiler Construction
Algorithms Lecture #19 Dr.Sohail Aslam.
Compiler Construction
Algorithms Lecture # 27 Dr. Sohail Aslam.
Algorithms Lecture # 01 Dr. Sohail Aslam.
Compiler Construction
Composition & Inverses Review
Algorithms Lecture # 02 Dr. Sohail Aslam.
Chapter 2 Sets Active Learning Lecture Slides
Factors, multiple, primes: Multiples
Standard Form: Multiplying powers of 10
If there is any case in which true premises lead to a false conclusion, the argument is invalid. Therefore this argument is INVALID.
Standard form: In standard form?
True or False True or False
Algorithms Lecture #42 Dr. Sohail Aslam.
If there is any case in which true premises lead to a false conclusion, the argument is invalid. Therefore this argument is INVALID.
Algorithms Lecture # 26 Dr. Sohail Aslam.
Algorithms Lecture # 25 Dr. Sohail Aslam.
Presentation transcript:

Compiler Construction Sohail Aslam Lecture 16 compiler: intro

Example: 2+4*6 >> Expr::isPresent() >> Term::isPresent() >> Factor::isPresent() token: 2 (257) << Factor::isPresent() return true >> Tprime::isPresent() token: + (267) << Tprime::isPresent() return false << Term::isPresent() return true end of lec 15 compiler: intro

Example: 2+4*6 >> Eprime::isPresent() token: + (267) >> Term::isPresent() >> Factor::isPresent() token: 4 (257) << Factor::isPresent() return true >> Tprime::isPresent() token: * (269) token: 6 (257)

Example: 2+4*6 >> Tprime::isPresent() token: (0) << Tprime::isPresent() return false << Tprime::isPresent() return true << Term::isPresent() return true >> Eprime::isPresent() << Eprime::isPresent() return false << Eprime::isPresent() return true << Expr::isPresent() return true

Example: 2+4*6 ** AST ** (2+(4*6)) + 2 * 4 6