Slide 1

Slide 1 text

jgs Compilers Lecture 08: First Partial Exam Review Dr. Javier Gonzalez-Sanchez [email protected]

Slide 2

Slide 2 text

jgs Announcements

Slide 3

Slide 3 text

Dr. Javier Gonzalez-Sanchez | Compilers | 3 jgs Do not forget 2 students without GitHub Classroom 2 teams without trying a submission

Slide 4

Slide 4 text

Dr. Javier Gonzalez-Sanchez | Compilers | 4 jgs Exam 01 Tuesday Feb 18 (5 to 6.30 pm) Blackboard – Online but Synchronous No lecture; solve your exam.

Slide 5

Slide 5 text

Dr. Javier Gonzalez-Sanchez | Compilers | 5 jgs Disclaimer ▪ The exam will include material from Lectures 01 to 07. ▪ This is NOT an exhaustive list of exam topics. ▪ This review covers only a subset of the material. ▪ The following slides provide examples related to selected topics. ▪ Be sure to review all lecture slides and course materials thoroughly.

Slide 6

Slide 6 text

jgs Review for the First Partial Exam

Slide 7

Slide 7 text

Dr. Javier Gonzalez-Sanchez | Compilers | 7 jgs Question

Slide 8

Slide 8 text

Dr. Javier Gonzalez-Sanchez | Compilers | 8 jgs Question

Slide 9

Slide 9 text

Dr. Javier Gonzalez-Sanchez | Compilers | 9 jgs Question

Slide 10

Slide 10 text

Dr. Javier Gonzalez-Sanchez | Compilers | 10 jgs Question

Slide 11

Slide 11 text

Dr. Javier Gonzalez-Sanchez | Compilers | 11 jgs Question

Slide 12

Slide 12 text

Dr. Javier Gonzalez-Sanchez | Compilers | 12 jgs Question

Slide 13

Slide 13 text

Dr. Javier Gonzalez-Sanchez | Compilers | 13 jgs Question For each case, indicate whether it is possible to generate a Deterministic Finite Automaton (DFA). 1. Can a DFA detect the balance of N parentheses in a string that contains N nested parentheses with any characters in between? 2. Is it possible for a DFA to recognize binary strings that contain an equal number of 0s and 1s, regardless of their order or sequence?

Slide 14

Slide 14 text

Dr. Javier Gonzalez-Sanchez | Compilers | 14 jgs Homework Finish Your Lexer (Try the new test cases)

Slide 15

Slide 15 text

jgs Next

Slide 16

Slide 16 text

Dr. Javier Gonzalez-Sanchez | Compilers | 16 jgs Where are we now? After lexical analysis, we have a series of tokens. But we can not: I. define a DFA matching all expressions with properly balanced parentheses. II. i.e., define a DFA matching all functions with properly nested block structure. void a () { b (c); for (;;) {a=(-(1+2)+5); } }

Slide 17

Slide 17 text

Dr. Javier Gonzalez-Sanchez | Compilers | 17 jgs Next Step  Lexical Analysis ☐ Syntactic Analysis

Slide 18

Slide 18 text

Dr. Javier Gonzalez-Sanchez | Compilers | 18 jgs Questions

Slide 19

Slide 19 text

jgs Compilers Javier Gonzalez-Sanchez, Ph.D. [email protected] Spring 2025 Copyright. These slides can only be used as study material for the Compilers course at Universidad Panamericana. They cannot be distributed or used for another purpose.