SlideShare a Scribd company logo
CSE340 - Principles of
Programming Languages
Lecture 05:
Lexer Implementation 2
Javier Gonzalez-Sanchez
javiergs@asu.edu
BYENG M1-38
Office Hours: By appointment
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 2
Review
1.  how to exclude keywords from Identifiers?
2.  The dot:
foobar1 = .
foobar1 = .*
foobar1 = .+
foobar1 = .
3.  What is the problem here?
string = " .* "
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 3
Review
4.  Rules and Sub-rules
URL definition:
https?:// ([a – z]+ | [A – Z]+ | [0 – 9]+ | - | . | _ | ~ | %21
| %23 | %24 | %26 | %27 | %28 | %29 | %2A | %2B | %2C | %3A |
%3B | %3D | %3F | %40 | %5B | %5D )* %2F ([a – z]+ | [A – Z]+ |
[0 – 9]+ | - | . | _ | ~ | ! | # | $ | & | ‘ | ( | ) | * | +
| , | / | : | ; | = | ? | @ | [ | ] )+
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4
Review
5.  Making things shorter
ZIP definition:
[1-9][1-9][1-9][1-9][1-9](-[1-9][1-9][1-9][1-9])?
[0-9]{5}(-[0-9]{4})?
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5
Programming Assignment #1
•  Only BINARY, DELIMITER, and OPERATOR are implemented. You will implement the rest of the
required tokens (rules).
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6
Programming Assignment #1
* Lexer.java is the only file that you are allowed to modify
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7
Code | Token.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8
Code | Gui.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9
Code | Lexer.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10
Code | Lexer.java
{
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11
Code | Lexer.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 12
Code | Lexer.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 13
Code | Lexer.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 14
Code | Lexer.java
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 15
Code | input.txt
hello;world cse340 asu 2013/05/31 // end
boolean $xx= ((((((((23WE + 44 - 3 / 2 % 45 <=17) > 0xfffff.34.45;
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 16
Code | output.txt
IDENTIFIER hello
DELIMITER ;
IDENTIFIER world
IDENTIFIER cse340
IDENTIFIER asu
INTEGER 2013
OPERATOR /
OCTAL 05
OPERATOR /
INTEGER 31
OPERATOR /
OPERATOR /
IDENTIFIER end
KEYWORD boolean
IDENTIFIER $xx
OPERATOR =
DELIMITER (
DELIMITER (
DELIMITER (
DELIMITER (
DELIMITER (
DELIMITER (
DELIMITER (
DELIMITER (
ERROR 23WE
OPERATOR +
INTEGER 44
OPERATOR -
INTEGER 3
OPERATOR /
INTEGER 2
OPERATOR %
INTEGER 45
OPERATOR <
OPERATOR =
INTEGER 17
DELIMITER )
OPERATOR >
ERROR 0xfffff.34.45
DELIMITER ;
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 17
Homework
Programming Assignment #1
Develop a Lexical Analyzer by coding a DFA
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.

More Related Content

What's hot

201506 CSE340 Lecture 13
201506 CSE340 Lecture 13201506 CSE340 Lecture 13
201506 CSE340 Lecture 13
Javier Gonzalez-Sanchez
 
201505 CSE340 Lecture 02
201505 CSE340 Lecture 02201505 CSE340 Lecture 02
201505 CSE340 Lecture 02
Javier Gonzalez-Sanchez
 
201506 CSE340 Lecture 14
201506 CSE340 Lecture 14201506 CSE340 Lecture 14
201506 CSE340 Lecture 14
Javier Gonzalez-Sanchez
 
201506 CSE340 Lecture 15
201506 CSE340 Lecture 15201506 CSE340 Lecture 15
201506 CSE340 Lecture 15
Javier Gonzalez-Sanchez
 
201506 CSE340 Lecture 10
201506 CSE340 Lecture 10201506 CSE340 Lecture 10
201506 CSE340 Lecture 10
Javier Gonzalez-Sanchez
 
201506 CSE340 Lecture 11
201506 CSE340 Lecture 11201506 CSE340 Lecture 11
201506 CSE340 Lecture 11
Javier Gonzalez-Sanchez
 
201506 CSE340 Lecture 09
201506 CSE340 Lecture 09201506 CSE340 Lecture 09
201506 CSE340 Lecture 09
Javier Gonzalez-Sanchez
 
Gestione date in PL/SQL
Gestione date in PL/SQLGestione date in PL/SQL
Gestione date in PL/SQL
Sergio Porcu
 
201801 CSE240 Lecture 03
201801 CSE240 Lecture 03201801 CSE240 Lecture 03
201801 CSE240 Lecture 03
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 02
201801 CSE240 Lecture 02201801 CSE240 Lecture 02
201801 CSE240 Lecture 02
Javier Gonzalez-Sanchez
 

What's hot (10)

201506 CSE340 Lecture 13
201506 CSE340 Lecture 13201506 CSE340 Lecture 13
201506 CSE340 Lecture 13
 
201505 CSE340 Lecture 02
201505 CSE340 Lecture 02201505 CSE340 Lecture 02
201505 CSE340 Lecture 02
 
201506 CSE340 Lecture 14
201506 CSE340 Lecture 14201506 CSE340 Lecture 14
201506 CSE340 Lecture 14
 
201506 CSE340 Lecture 15
201506 CSE340 Lecture 15201506 CSE340 Lecture 15
201506 CSE340 Lecture 15
 
201506 CSE340 Lecture 10
201506 CSE340 Lecture 10201506 CSE340 Lecture 10
201506 CSE340 Lecture 10
 
201506 CSE340 Lecture 11
201506 CSE340 Lecture 11201506 CSE340 Lecture 11
201506 CSE340 Lecture 11
 
201506 CSE340 Lecture 09
201506 CSE340 Lecture 09201506 CSE340 Lecture 09
201506 CSE340 Lecture 09
 
Gestione date in PL/SQL
Gestione date in PL/SQLGestione date in PL/SQL
Gestione date in PL/SQL
 
201801 CSE240 Lecture 03
201801 CSE240 Lecture 03201801 CSE240 Lecture 03
201801 CSE240 Lecture 03
 
201801 CSE240 Lecture 02
201801 CSE240 Lecture 02201801 CSE240 Lecture 02
201801 CSE240 Lecture 02
 

Viewers also liked

Mote Mote Radio Communication
Mote Mote Radio CommunicationMote Mote Radio Communication
Mote Mote Radio Communication
Ankit Singh
 
Amigos de verdad
Amigos de verdadAmigos de verdad
Amigos de verdad
erickadomi
 
漫谈php和java
漫谈php和java漫谈php和java
漫谈php和javasulong
 
Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugging
lienhard
 
LiveOffice Email Archiving & Compliance 301
LiveOffice Email Archiving & Compliance 301LiveOffice Email Archiving & Compliance 301
LiveOffice Email Archiving & Compliance 301
Veritas Technologies LLC
 
Technologische trends voor journalistiek
Technologische trends voor journalistiekTechnologische trends voor journalistiek
Technologische trends voor journalistiek
Bart Van Belle
 
Thehub bocconi law
Thehub   bocconi lawThehub   bocconi law
Thehub bocconi law
The Hub Milan
 
Paul Pangaro
Paul PangaroPaul Pangaro
Itf ipp ch10_2012_final
Itf ipp ch10_2012_finalItf ipp ch10_2012_final
Itf ipp ch10_2012_final
dphil002
 
Jay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final CorrigidaJay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final Corrigida
Luis Fernando Guggenberger
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
dphil002
 
Syndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculairesSyndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculaires
sfa_angeiologie
 
Uzbekistan caving 2011
Uzbekistan caving 2011Uzbekistan caving 2011
Uzbekistan caving 2011Yura Taras
 
How new technologies affect the art of contesting
How new technologies affect the art of contestingHow new technologies affect the art of contesting
How new technologies affect the art of contesting
Tobias Wellnitz
 
Wiseman Jack
Wiseman JackWiseman Jack
Urban Cottage + IceMilk Aprons
Urban Cottage + IceMilk ApronsUrban Cottage + IceMilk Aprons
Urban Cottage + IceMilk Aprons
IceMilk Aprons
 
Pachin
PachinPachin
Cluster 15
Cluster 15Cluster 15
Cluster 15
etalcomendras
 

Viewers also liked (20)

Mote Mote Radio Communication
Mote Mote Radio CommunicationMote Mote Radio Communication
Mote Mote Radio Communication
 
Amigos de verdad
Amigos de verdadAmigos de verdad
Amigos de verdad
 
漫谈php和java
漫谈php和java漫谈php和java
漫谈php和java
 
Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugging
 
LiveOffice Email Archiving & Compliance 301
LiveOffice Email Archiving & Compliance 301LiveOffice Email Archiving & Compliance 301
LiveOffice Email Archiving & Compliance 301
 
Technologische trends voor journalistiek
Technologische trends voor journalistiekTechnologische trends voor journalistiek
Technologische trends voor journalistiek
 
Thehub bocconi law
Thehub   bocconi lawThehub   bocconi law
Thehub bocconi law
 
Paul Pangaro
Paul PangaroPaul Pangaro
Paul Pangaro
 
Itf ipp ch10_2012_final
Itf ipp ch10_2012_finalItf ipp ch10_2012_final
Itf ipp ch10_2012_final
 
Jay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final CorrigidaJay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final Corrigida
 
Eeuwigblijvenleren2
Eeuwigblijvenleren2Eeuwigblijvenleren2
Eeuwigblijvenleren2
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
Syndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculairesSyndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculaires
 
Windowsxp
WindowsxpWindowsxp
Windowsxp
 
Uzbekistan caving 2011
Uzbekistan caving 2011Uzbekistan caving 2011
Uzbekistan caving 2011
 
How new technologies affect the art of contesting
How new technologies affect the art of contestingHow new technologies affect the art of contesting
How new technologies affect the art of contesting
 
Wiseman Jack
Wiseman JackWiseman Jack
Wiseman Jack
 
Urban Cottage + IceMilk Aprons
Urban Cottage + IceMilk ApronsUrban Cottage + IceMilk Aprons
Urban Cottage + IceMilk Aprons
 
Pachin
PachinPachin
Pachin
 
Cluster 15
Cluster 15Cluster 15
Cluster 15
 

Similar to 201505 CSE340 Lecture 05

201506 CSE340 Lecture 12
201506 CSE340 Lecture 12201506 CSE340 Lecture 12
201506 CSE340 Lecture 12
Javier Gonzalez-Sanchez
 
201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01
Javier Gonzalez-Sanchez
 
201505 CSE340 Lecture 03
201505 CSE340 Lecture 03201505 CSE340 Lecture 03
201505 CSE340 Lecture 03
Javier Gonzalez-Sanchez
 
201505 CSE340 Lecture 04
201505 CSE340 Lecture 04201505 CSE340 Lecture 04
201505 CSE340 Lecture 04
Javier Gonzalez-Sanchez
 
Dutch Specflow Users Meetup - Shared understanding
Dutch Specflow Users Meetup - Shared understandingDutch Specflow Users Meetup - Shared understanding
Dutch Specflow Users Meetup - Shared understanding
Mark Taling
 
Real
RealReal
201801 CSE240 Lecture 16
201801 CSE240 Lecture 16201801 CSE240 Lecture 16
201801 CSE240 Lecture 16
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 07
201801 CSE240 Lecture 07201801 CSE240 Lecture 07
201801 CSE240 Lecture 07
Javier Gonzalez-Sanchez
 
201506 - CSE340 Lecture 08
201506 - CSE340 Lecture 08201506 - CSE340 Lecture 08
201506 - CSE340 Lecture 08
Javier Gonzalez-Sanchez
 
20150423 m3
20150423 m320150423 m3
20150423 m3
Kazuaki Matsuo
 
201801 CSE240 Lecture 23
201801 CSE240 Lecture 23201801 CSE240 Lecture 23
201801 CSE240 Lecture 23
Javier Gonzalez-Sanchez
 
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
Salesforce Developers Japan
 
Catalogmakr teaser
Catalogmakr teaserCatalogmakr teaser
Catalogmakr teaser
catalogmakr
 
Effective Java with Groovy - How Language can Influence Good Practices
Effective Java with Groovy - How Language can Influence Good PracticesEffective Java with Groovy - How Language can Influence Good Practices
Effective Java with Groovy - How Language can Influence Good Practices
Naresha K
 
Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)
Sam Livingston-Gray
 
Intro to HTML + CSS
Intro to HTML + CSSIntro to HTML + CSS
Intro to HTML + CSS
Jamal Sinclair O'Garro
 
201707 CSE110 Lecture 05
201707 CSE110 Lecture 05   201707 CSE110 Lecture 05
201707 CSE110 Lecture 05
Javier Gonzalez-Sanchez
 
Html5
Html5Html5

Similar to 201505 CSE340 Lecture 05 (18)

201506 CSE340 Lecture 12
201506 CSE340 Lecture 12201506 CSE340 Lecture 12
201506 CSE340 Lecture 12
 
201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01
 
201505 CSE340 Lecture 03
201505 CSE340 Lecture 03201505 CSE340 Lecture 03
201505 CSE340 Lecture 03
 
201505 CSE340 Lecture 04
201505 CSE340 Lecture 04201505 CSE340 Lecture 04
201505 CSE340 Lecture 04
 
Dutch Specflow Users Meetup - Shared understanding
Dutch Specflow Users Meetup - Shared understandingDutch Specflow Users Meetup - Shared understanding
Dutch Specflow Users Meetup - Shared understanding
 
Real
RealReal
Real
 
201801 CSE240 Lecture 16
201801 CSE240 Lecture 16201801 CSE240 Lecture 16
201801 CSE240 Lecture 16
 
201801 CSE240 Lecture 07
201801 CSE240 Lecture 07201801 CSE240 Lecture 07
201801 CSE240 Lecture 07
 
201506 - CSE340 Lecture 08
201506 - CSE340 Lecture 08201506 - CSE340 Lecture 08
201506 - CSE340 Lecture 08
 
20150423 m3
20150423 m320150423 m3
20150423 m3
 
201801 CSE240 Lecture 23
201801 CSE240 Lecture 23201801 CSE240 Lecture 23
201801 CSE240 Lecture 23
 
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
 
Catalogmakr teaser
Catalogmakr teaserCatalogmakr teaser
Catalogmakr teaser
 
Effective Java with Groovy - How Language can Influence Good Practices
Effective Java with Groovy - How Language can Influence Good PracticesEffective Java with Groovy - How Language can Influence Good Practices
Effective Java with Groovy - How Language can Influence Good Practices
 
Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)
 
Intro to HTML + CSS
Intro to HTML + CSSIntro to HTML + CSS
Intro to HTML + CSS
 
201707 CSE110 Lecture 05
201707 CSE110 Lecture 05   201707 CSE110 Lecture 05
201707 CSE110 Lecture 05
 
Html5
Html5Html5
Html5
 

More from Javier Gonzalez-Sanchez

201804 SER332 Lecture 01
201804 SER332 Lecture 01201804 SER332 Lecture 01
201804 SER332 Lecture 01
Javier Gonzalez-Sanchez
 
201801 SER332 Lecture 03
201801 SER332 Lecture 03201801 SER332 Lecture 03
201801 SER332 Lecture 03
Javier Gonzalez-Sanchez
 
201801 SER332 Lecture 04
201801 SER332 Lecture 04201801 SER332 Lecture 04
201801 SER332 Lecture 04
Javier Gonzalez-Sanchez
 
201801 SER332 Lecture 02
201801 SER332 Lecture 02201801 SER332 Lecture 02
201801 SER332 Lecture 02
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 26
201801 CSE240 Lecture 26201801 CSE240 Lecture 26
201801 CSE240 Lecture 26
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 25
201801 CSE240 Lecture 25201801 CSE240 Lecture 25
201801 CSE240 Lecture 25
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 24
201801 CSE240 Lecture 24201801 CSE240 Lecture 24
201801 CSE240 Lecture 24
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 22
201801 CSE240 Lecture 22201801 CSE240 Lecture 22
201801 CSE240 Lecture 22
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 21
201801 CSE240 Lecture 21201801 CSE240 Lecture 21
201801 CSE240 Lecture 21
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 20
201801 CSE240 Lecture 20201801 CSE240 Lecture 20
201801 CSE240 Lecture 20
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 19
201801 CSE240 Lecture 19201801 CSE240 Lecture 19
201801 CSE240 Lecture 19
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 18
201801 CSE240 Lecture 18201801 CSE240 Lecture 18
201801 CSE240 Lecture 18
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 17
201801 CSE240 Lecture 17201801 CSE240 Lecture 17
201801 CSE240 Lecture 17
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 15
201801 CSE240 Lecture 15201801 CSE240 Lecture 15
201801 CSE240 Lecture 15
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 13
201801 CSE240 Lecture 13201801 CSE240 Lecture 13
201801 CSE240 Lecture 13
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 12
201801 CSE240 Lecture 12201801 CSE240 Lecture 12
201801 CSE240 Lecture 12
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 10
201801 CSE240 Lecture 10201801 CSE240 Lecture 10
201801 CSE240 Lecture 10
Javier Gonzalez-Sanchez
 
201801 CSE240 Lecture 09
201801 CSE240 Lecture 09201801 CSE240 Lecture 09
201801 CSE240 Lecture 09
Javier Gonzalez-Sanchez
 

More from 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 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 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
 
201801 CSE240 Lecture 10
201801 CSE240 Lecture 10201801 CSE240 Lecture 10
201801 CSE240 Lecture 10
 
201801 CSE240 Lecture 09
201801 CSE240 Lecture 09201801 CSE240 Lecture 09
201801 CSE240 Lecture 09
 

Recently uploaded

What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
Envertis Software Solutions
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 

Recently uploaded (20)

What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 

201505 CSE340 Lecture 05

  • 1. CSE340 - Principles of Programming Languages Lecture 05: Lexer Implementation 2 Javier Gonzalez-Sanchez javiergs@asu.edu BYENG M1-38 Office Hours: By appointment
  • 2. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 2 Review 1.  how to exclude keywords from Identifiers? 2.  The dot: foobar1 = . foobar1 = .* foobar1 = .+ foobar1 = . 3.  What is the problem here? string = " .* "
  • 3. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 3 Review 4.  Rules and Sub-rules URL definition: https?:// ([a – z]+ | [A – Z]+ | [0 – 9]+ | - | . | _ | ~ | %21 | %23 | %24 | %26 | %27 | %28 | %29 | %2A | %2B | %2C | %3A | %3B | %3D | %3F | %40 | %5B | %5D )* %2F ([a – z]+ | [A – Z]+ | [0 – 9]+ | - | . | _ | ~ | ! | # | $ | & | ‘ | ( | ) | * | + | , | / | : | ; | = | ? | @ | [ | ] )+
  • 4. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4 Review 5.  Making things shorter ZIP definition: [1-9][1-9][1-9][1-9][1-9](-[1-9][1-9][1-9][1-9])? [0-9]{5}(-[0-9]{4})?
  • 5. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5 Programming Assignment #1 •  Only BINARY, DELIMITER, and OPERATOR are implemented. You will implement the rest of the required tokens (rules).
  • 6. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6 Programming Assignment #1 * Lexer.java is the only file that you are allowed to modify
  • 7. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7 Code | Token.java
  • 8. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8 Code | Gui.java
  • 9. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9 Code | Lexer.java
  • 10. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10 Code | Lexer.java {
  • 11. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11 Code | Lexer.java
  • 12. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 12 Code | Lexer.java
  • 13. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 13 Code | Lexer.java
  • 14. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 14 Code | Lexer.java
  • 15. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 15 Code | input.txt hello;world cse340 asu 2013/05/31 // end boolean $xx= ((((((((23WE + 44 - 3 / 2 % 45 <=17) > 0xfffff.34.45;
  • 16. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 16 Code | output.txt IDENTIFIER hello DELIMITER ; IDENTIFIER world IDENTIFIER cse340 IDENTIFIER asu INTEGER 2013 OPERATOR / OCTAL 05 OPERATOR / INTEGER 31 OPERATOR / OPERATOR / IDENTIFIER end KEYWORD boolean IDENTIFIER $xx OPERATOR = DELIMITER ( DELIMITER ( DELIMITER ( DELIMITER ( DELIMITER ( DELIMITER ( DELIMITER ( DELIMITER ( ERROR 23WE OPERATOR + INTEGER 44 OPERATOR - INTEGER 3 OPERATOR / INTEGER 2 OPERATOR % INTEGER 45 OPERATOR < OPERATOR = INTEGER 17 DELIMITER ) OPERATOR > ERROR 0xfffff.34.45 DELIMITER ;
  • 17. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 17 Homework Programming Assignment #1 Develop a Lexical Analyzer by coding a DFA
  • 18. 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.