Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UP Lecture 13
Search
Javier Gonzalez-Sanchez
PRO
December 16, 2023
Programming
0
120
UP Lecture 13
Compilers
Deriving Trees
(202503)
Javier Gonzalez-Sanchez
PRO
December 16, 2023
Tweet
Share
More Decks by Javier Gonzalez-Sanchez
See All by Javier Gonzalez-Sanchez
CSC509 Lecture 06
javiergs
PRO
0
250
CSC509 Lecture 05
javiergs
PRO
0
300
CSC305 Lecture 06
javiergs
PRO
0
210
CSC509 Lecture 04
javiergs
PRO
0
300
CSC305 Lecture 05
javiergs
PRO
0
210
CSC509 Lecture 03
javiergs
PRO
0
330
CSC305 Lecture 04
javiergs
PRO
0
260
CSC305 Lecture 03
javiergs
PRO
0
240
CSC305 Lecture 02
javiergs
PRO
1
260
Other Decks in Programming
See All in Programming
iOS 17で追加されたSubscriptionStoreView を利用して5分でサブスク実装チャレンジ
natmark
0
650
Reduxモダナイズ 〜コードのモダン化を通して、将来のライブラリ移行に備える〜
pvcresin
2
690
XP, Testing and ninja testing ZOZ5
m_seki
3
360
Model Pollution
hschwentner
1
190
SpecKitでどこまでできる? コストはどれくらい?
leveragestech
0
610
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
170
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
180
技術的負債の正体を知って向き合う / Facing Technical Debt
irof
0
110
Catch Up: Go Style Guide Update
andpad
0
200
dynamic!
moro
9
6.8k
uniqueパッケージの内部実装を支えるweak pointerの話
magavel
0
940
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
440
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Bash Introduction
62gerente
615
210k
Fireside Chat
paigeccino
40
3.7k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
The Invisible Side of Design
smashingmag
301
51k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
580
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Transcript
jgs Compilers Lecture 13: Deriving trees Dr. Javier Gonzalez-Sanchez
[email protected]
jgs Previously …
Dr. Javier Gonzalez-Sanchez | Compilers | 3 jgs Layering Rule
1 Rule 2 Rule 3 Rule 4 Rule 5 . . . . . Leaf (Terminals, i.e., Tokens) Root Start symbol Layers
Dr. Javier Gonzalez-Sanchez | Compilers | 4 jgs Precedence Precedence
of operators + - * / -
Dr. Javier Gonzalez-Sanchez | Compilers | 5 jgs Syntax Diagrams
E A B C
Dr. Javier Gonzalez-Sanchez | Compilers | 6 jgs Precedence Precedence
of operators + - * / - ( )
Dr. Javier Gonzalez-Sanchez | Compilers | 7 jgs Syntax Diagrams
E A B C
jgs Operators
Dr. Javier Gonzalez-Sanchez | Compilers | 9 jgs Exercise 4
Provide a Grammar with Precedence of operators and Associativity for this: 10 + 20 > 15 & -10 != 1 | 20 / ( 10 + 1) < 5
Dr. Javier Gonzalez-Sanchez | Compilers | 10 jgs Precedence Precedence
of operators | & ! < > == != <= >= + - * / - ( )
Dr. Javier Gonzalez-Sanchez | Compilers | 11 jgs Exercise 3
| Handwritten notes ...
Dr. Javier Gonzalez-Sanchez | Compilers | 12 jgs Exercise 4
R EXPRESSION X Y
Dr. Javier Gonzalez-Sanchez | Compilers | 13 jgs Exercise 4
E A B C
Dr. Javier Gonzalez-Sanchez | Compilers | 14 jgs Homework |
Derivation Tree x = ((3 + 5) * 2 > 10) && (8 / (4 + 1) == 1 || 7 - 3 < 2)
jgs Language
Dr. Javier Gonzalez-Sanchez | Compilers | 16 jgs Parser PROGRAM
Dr. Javier Gonzalez-Sanchez | Compilers | 17 jgs Parser PROGRAM
We have BODY. What about method definition? What about global variables? What about classes?
Dr. Javier Gonzalez-Sanchez | Compilers | 18 jgs Assignment 2
| Code BODY
Dr. Javier Gonzalez-Sanchez | Compilers | 19 jgs Assignment 2
| Code ASSIGNMENT
Dr. Javier Gonzalez-Sanchez | Compilers | 20 jgs Assignment 2
| Code VARIABLE
Dr. Javier Gonzalez-Sanchez | Compilers | 21 jgs Assignment 2
| Code VARIABLE What about int x = 2 + 2; ?
Dr. Javier Gonzalez-Sanchez | Compilers | 22 jgs Assignment 2
| Code WHILE
Dr. Javier Gonzalez-Sanchez | Compilers | 23 jgs Assignment 2
| Code WHILE What do/while ?
Dr. Javier Gonzalez-Sanchez | Compilers | 24 jgs Assignment 2
| Code IF
Dr. Javier Gonzalez-Sanchez | Compilers | 25 jgs Assignment 2
| Code IF What switch/case?
Dr. Javier Gonzalez-Sanchez | Compilers | 26 jgs Assignment 2
| Code RETURN What about return 2 + 2?
Dr. Javier Gonzalez-Sanchez | Compilers | 27 jgs Assignment 2
| Code PRINT
Dr. Javier Gonzalez-Sanchez | Compilers | 28 jgs Assignment 2
| Code PRINT What about calling a method (any method)?
Dr. Javier Gonzalez-Sanchez | Compilers | 29 jgs Parser EXPRESSION
Dr. Javier Gonzalez-Sanchez | Compilers | 30 jgs Parser X
Dr. Javier Gonzalez-Sanchez | Compilers | 31 jgs Parser Y
Dr. Javier Gonzalez-Sanchez | Compilers | 32 jgs Parser R
Dr. Javier Gonzalez-Sanchez | Compilers | 33 jgs Parser R
What about >= or <= ?
Dr. Javier Gonzalez-Sanchez | Compilers | 34 jgs Parser E
Dr. Javier Gonzalez-Sanchez | Compilers | 35 jgs Parser A
Dr. Javier Gonzalez-Sanchez | Compilers | 36 jgs Parser B
Dr. Javier Gonzalez-Sanchez | Compilers | 37 jgs Assignment 2
| Code C
Dr. Javier Gonzalez-Sanchez | Compilers | 38 jgs Assignment 2
| Code C What about 5 + calculate_xyz() ?
Dr. Javier Gonzalez-Sanchez | Compilers | 45 jgs Questions
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.