SlideShare uma empresa Scribd logo
1 de 16
CSE340 - Principles of
Programming Languages
Lecture 06:
Closing with Lexical Analysis
Javier Gonzalez-Sanchez
javiergs@asu.edu
BYENG M1-38
Office Hours: By appointment
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4
Programming Assignment #1
?
70%
?
100%
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5
Programming Assignment #1
?
100%
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6
Programming Assignment #1
?
70%
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7
Programming Assignment #1
!  Firstname_Lastname_P1.zip
!  Compile and Run
!  Recognize BINARY
!  Recognize DELIMITER and OPERATOR
approx. 20%
!  Recognize INTEGER
!  Recognize OCTAL
!  Recognize HEXADECIMAL
!  Recognize IDENTIFIER
approx. 40%
!  Recognize STRING
!  Recognize CHAR
!  Recognize KEYWORD
!  Recognize FLOAT
approx. 40%
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8
Review | Lexical Analysis
Are the following STRINGS correct or not? Why?
!  000000005
!  000000009
!  000000009.1
!  000000005
!  000000005.1
!  0x0000002
!  0123456789
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9
Review | Lexical Analysis
Are the following STRINGS correct or not? Why?
!  1.2e---3++
!  $50
!  float ________________ = 5;
!  double x = 000000.1;
!  '''a'
!  '''b'
!  ''b'
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10
Review | Lexical Analysis
Are the following STRINGS correct or not? Why?
!  " a"
!  "Hello""world"
!  abc"Hello"
!  ''’
!  'x’
!  ’a'
!  ’w’
!  ""
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11
State Transition Table
for our Lexer
(step by step)
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 12
BINARY
INTEGER
OCTAL
HEXADECIMAL
IDENTIFIER
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 13
Lexer – Step by Step
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 14
Lexer – Step by Step
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 15
Lexer – Step by Step
1 = INTEGER
2 = INTEGER
3 = IDENTIFIER
5 = OCTAL
7 = INTEGER
8 = IDENTIFIER
9 = BINARY
10 = HEXADECIMAL
columns
[a-z] = [A] B [C-F] [G-W] X [Y-Z]
[a-f] = [A] B [C-F]
0
$
_
[1]
[2-7]
[8-9]
[A]
B
[C-F]
[G-W]
X
[Y-Z]
states
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 16
Lexer – Step by Step
0 $ _ [1] [2-7] [8-9] A B [C-F] [G-W] X [Y-Z] ... Delimiter, operator,
whitespace, quotation
mark
S0! S1$ S3$ S3$ S2$ S2$ S2$ S3$ S3$ S3$ S3$ S3$ S3$ SE! Stop!
S1! S5$ SE! SE! S5$ S5$ SE! SE! S4$ SE! SE! S6$ SE! SE! Stop!
S2! S7$ SE! SE! S7$ S7$ S7$ SE! SE! SE! SE! SE! SE! SE! Stop!
S3! S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ SE! Stop!
S4! S9$ SE! SE! S9$ SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop!
S5! S5$ SE! SE! S5$ S5$ SE! SE! SE! SE! SE! SE! SE! SE! Stop!
S6! S10$ SE! SE! S10$ S10$ S10$ S10$ S10$ S10$ SE! SE! SE! SE! Stop!
S7! S7$ SE! SE! S7$ S7$ S7$ SE! SE! SE! SE! SE! SE! SE! Stop!
S8! S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ SE! Stop!
S9! S9$ SE! SE! S9$ SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop!
S10! S10$ SE! SE! S10$ S10$ S10$ S10$ S10$ S10$ SE! SE! SE! SE! Stop!
SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop!
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 17
Homework
Review Recursion
Solve the Problem Set #1 in preparation for your exam
CSE340 - Principles of Programming Languages
Javier Gonzalez-Sanchez
javiergs@asu.edu
Summer 2015
Disclaimer. These slides can only be used as study material for the class CSE340 at ASU. They cannot be distributed or used for another purpose.

Mais conteúdo relacionado

Destaque

Destaque (20)

Heirloom Travel: Wine Country - Wineries
Heirloom Travel: Wine Country - WineriesHeirloom Travel: Wine Country - Wineries
Heirloom Travel: Wine Country - Wineries
 
Week7
Week7Week7
Week7
 
Eprotect
EprotectEprotect
Eprotect
 
Monaco 020909
Monaco 020909Monaco 020909
Monaco 020909
 
CQRS introduction
CQRS introductionCQRS introduction
CQRS introduction
 
201506 CSE340 Lecture 13
201506 CSE340 Lecture 13201506 CSE340 Lecture 13
201506 CSE340 Lecture 13
 
201506 CSE340 Lecture 14
201506 CSE340 Lecture 14201506 CSE340 Lecture 14
201506 CSE340 Lecture 14
 
RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009
 
200801 Generating OpenMP and Pthreads code
200801 Generating OpenMP and Pthreads code200801 Generating OpenMP and Pthreads code
200801 Generating OpenMP and Pthreads code
 
201505 CSE340 Lecture 03
201505 CSE340 Lecture 03201505 CSE340 Lecture 03
201505 CSE340 Lecture 03
 
RCMSL Phenomenal July 9, 2009
RCMSL Phenomenal July 9, 2009RCMSL Phenomenal July 9, 2009
RCMSL Phenomenal July 9, 2009
 
Mobile Social Media, Sept. 2010, Do You Want To Be Visible?, Marketing Club K...
Mobile Social Media, Sept. 2010, Do You Want To Be Visible?, Marketing Club K...Mobile Social Media, Sept. 2010, Do You Want To Be Visible?, Marketing Club K...
Mobile Social Media, Sept. 2010, Do You Want To Be Visible?, Marketing Club K...
 
RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009
 
201101 affective learning
201101 affective learning201101 affective learning
201101 affective learning
 
Medi Contention
Medi ContentionMedi Contention
Medi Contention
 
RCMSL Phenomenal Aug 13 And 20, 2009
RCMSL Phenomenal Aug 13 And 20, 2009RCMSL Phenomenal Aug 13 And 20, 2009
RCMSL Phenomenal Aug 13 And 20, 2009
 
簡介創用CC授權
簡介創用CC授權簡介創用CC授權
簡介創用CC授權
 
201003 Alice (part 1/15)
201003 Alice (part 1/15)201003 Alice (part 1/15)
201003 Alice (part 1/15)
 
Week9
Week9Week9
Week9
 
201006 its tutorial
201006 its tutorial201006 its tutorial
201006 its tutorial
 

Mais de Javier Gonzalez-Sanchez (20)

201804 SER332 Lecture 01
201804 SER332 Lecture 01201804 SER332 Lecture 01
201804 SER332 Lecture 01
 
201801 SER332 Lecture 03
201801 SER332 Lecture 03201801 SER332 Lecture 03
201801 SER332 Lecture 03
 
201801 SER332 Lecture 04
201801 SER332 Lecture 04201801 SER332 Lecture 04
201801 SER332 Lecture 04
 
201801 SER332 Lecture 02
201801 SER332 Lecture 02201801 SER332 Lecture 02
201801 SER332 Lecture 02
 
201801 CSE240 Lecture 26
201801 CSE240 Lecture 26201801 CSE240 Lecture 26
201801 CSE240 Lecture 26
 
201801 CSE240 Lecture 25
201801 CSE240 Lecture 25201801 CSE240 Lecture 25
201801 CSE240 Lecture 25
 
201801 CSE240 Lecture 24
201801 CSE240 Lecture 24201801 CSE240 Lecture 24
201801 CSE240 Lecture 24
 
201801 CSE240 Lecture 23
201801 CSE240 Lecture 23201801 CSE240 Lecture 23
201801 CSE240 Lecture 23
 
201801 CSE240 Lecture 22
201801 CSE240 Lecture 22201801 CSE240 Lecture 22
201801 CSE240 Lecture 22
 
201801 CSE240 Lecture 21
201801 CSE240 Lecture 21201801 CSE240 Lecture 21
201801 CSE240 Lecture 21
 
201801 CSE240 Lecture 20
201801 CSE240 Lecture 20201801 CSE240 Lecture 20
201801 CSE240 Lecture 20
 
201801 CSE240 Lecture 19
201801 CSE240 Lecture 19201801 CSE240 Lecture 19
201801 CSE240 Lecture 19
 
201801 CSE240 Lecture 18
201801 CSE240 Lecture 18201801 CSE240 Lecture 18
201801 CSE240 Lecture 18
 
201801 CSE240 Lecture 17
201801 CSE240 Lecture 17201801 CSE240 Lecture 17
201801 CSE240 Lecture 17
 
201801 CSE240 Lecture 16
201801 CSE240 Lecture 16201801 CSE240 Lecture 16
201801 CSE240 Lecture 16
 
201801 CSE240 Lecture 15
201801 CSE240 Lecture 15201801 CSE240 Lecture 15
201801 CSE240 Lecture 15
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
 
201801 CSE240 Lecture 13
201801 CSE240 Lecture 13201801 CSE240 Lecture 13
201801 CSE240 Lecture 13
 
201801 CSE240 Lecture 12
201801 CSE240 Lecture 12201801 CSE240 Lecture 12
201801 CSE240 Lecture 12
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
 

Último

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

201505 CSE340 Lecture 06

  • 1. CSE340 - Principles of Programming Languages Lecture 06: Closing with Lexical Analysis Javier Gonzalez-Sanchez javiergs@asu.edu BYENG M1-38 Office Hours: By appointment
  • 2. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4 Programming Assignment #1 ? 70% ? 100%
  • 3. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5 Programming Assignment #1 ? 100%
  • 4. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6 Programming Assignment #1 ? 70%
  • 5. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7 Programming Assignment #1 !  Firstname_Lastname_P1.zip !  Compile and Run !  Recognize BINARY !  Recognize DELIMITER and OPERATOR approx. 20% !  Recognize INTEGER !  Recognize OCTAL !  Recognize HEXADECIMAL !  Recognize IDENTIFIER approx. 40% !  Recognize STRING !  Recognize CHAR !  Recognize KEYWORD !  Recognize FLOAT approx. 40%
  • 6. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8 Review | Lexical Analysis Are the following STRINGS correct or not? Why? !  000000005 !  000000009 !  000000009.1 !  000000005 !  000000005.1 !  0x0000002 !  0123456789
  • 7. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9 Review | Lexical Analysis Are the following STRINGS correct or not? Why? !  1.2e---3++ !  $50 !  float ________________ = 5; !  double x = 000000.1; !  '''a' !  '''b' !  ''b'
  • 8. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10 Review | Lexical Analysis Are the following STRINGS correct or not? Why? !  " a" !  "Hello""world" !  abc"Hello" !  ''’ !  'x’ !  ’a' !  ’w’ !  ""
  • 9. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11 State Transition Table for our Lexer (step by step)
  • 10. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 12 BINARY INTEGER OCTAL HEXADECIMAL IDENTIFIER
  • 11. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 13 Lexer – Step by Step
  • 12. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 14 Lexer – Step by Step
  • 13. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 15 Lexer – Step by Step 1 = INTEGER 2 = INTEGER 3 = IDENTIFIER 5 = OCTAL 7 = INTEGER 8 = IDENTIFIER 9 = BINARY 10 = HEXADECIMAL columns [a-z] = [A] B [C-F] [G-W] X [Y-Z] [a-f] = [A] B [C-F] 0 $ _ [1] [2-7] [8-9] [A] B [C-F] [G-W] X [Y-Z] states
  • 14. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 16 Lexer – Step by Step 0 $ _ [1] [2-7] [8-9] A B [C-F] [G-W] X [Y-Z] ... Delimiter, operator, whitespace, quotation mark S0! S1$ S3$ S3$ S2$ S2$ S2$ S3$ S3$ S3$ S3$ S3$ S3$ SE! Stop! S1! S5$ SE! SE! S5$ S5$ SE! SE! S4$ SE! SE! S6$ SE! SE! Stop! S2! S7$ SE! SE! S7$ S7$ S7$ SE! SE! SE! SE! SE! SE! SE! Stop! S3! S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ SE! Stop! S4! S9$ SE! SE! S9$ SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop! S5! S5$ SE! SE! S5$ S5$ SE! SE! SE! SE! SE! SE! SE! SE! Stop! S6! S10$ SE! SE! S10$ S10$ S10$ S10$ S10$ S10$ SE! SE! SE! SE! Stop! S7! S7$ SE! SE! S7$ S7$ S7$ SE! SE! SE! SE! SE! SE! SE! Stop! S8! S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ S8$ SE! Stop! S9! S9$ SE! SE! S9$ SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop! S10! S10$ SE! SE! S10$ S10$ S10$ S10$ S10$ S10$ SE! SE! SE! SE! Stop! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! SE! Stop!
  • 15. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 17 Homework Review Recursion Solve the Problem Set #1 in preparation for your exam
  • 16. CSE340 - Principles of Programming Languages Javier Gonzalez-Sanchez javiergs@asu.edu Summer 2015 Disclaimer. These slides can only be used as study material for the class CSE340 at ASU. They cannot be distributed or used for another purpose.