SlideShare a Scribd company logo
CSE340 - Principles of
Programming Languages
Lecture 02:
Introduction
Javier Gonzalez-Sanchez
javiergs@asu.edu
BYENG M1-38
Office Hours: By appointment
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 2
Keywords
Level
Paradigm
Language
Analysis
Lexical
Input:
Symbols
Output:
Words
Syntax
Input:
Words
Output:
Sentences
Semantic
Input:
Sentences
Translate or
Execute
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 3
Analysis
int x = 5;
float y = "hello;
String @z = "9.5";
int x = cse340;
if ( x > 14) while (5 == 5) if (int a) a = 1;
x = x; for ( ; ; );
y = 13.45.0;
int me = 99999000001111222000000111111222223443483045830948;
while { x != 9} ();
int {x} = 10;
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4
High-Level Languages
X,E,G,O,O
#e1,I,I,0,7
@
OPR 19, AX
STO x, AX
LIT 5, AX
OPR 21, AX
LOD #e1,AX
CAL 1, AX
OPR 0, AX
5
Virtual Machine
(interpreter)
// sorce code
int x;
int foo () {
read (x);
print (5);
}
main () {
foo ();
}
Lexer
Parser
Semantic Analyzer
Code Generation
01001010101000010
01010100101010010
10100100000011011
11010010110101111
00010010101010010
10101001010101011
Assembler
compilation execution
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5
Keywords
Lexical
Alphabet Symbol
String Word
Token
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6
Lexical Analysis
int x = 5;
float y = "hello;
String @z = "9.5";
int x = cse340;
if ( x > 14) while (5 == 5) if (int a) a = 1;
x = x; for ( ; ; );
y = 13.45.0;
int me = 99999000001111222000000111111222223443483045830948;
while { x != 9} ();
int {x} = 10;
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7
Lexical Analysis | Steps
a)  Read a text FILE line by line
b)  For each LINE:
•  Read character by character.
•  Create sets of consecutive characters (STRING). Try to
group the bigger amount of characters as possible.
•  Start a new set each time that you need. Take care of:
Whitespace, Delimiter, Operator, End of Line and others
special characters.
c) For each STRING: verify if it is a valid WORD.
d) Create a VECTOR and store the STRINGs and WORDs.
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8
Lexical Analysis
int x = 5; float y = "hello;
String@z="9.5”;intx=cse340;if(x>
14) while
(5 == 5) if (int a) a = 1; x = x;
for ( ; ; );y = 13.45.0;int me
=99999000001111222000000111111222
223443483045830948;while { x !=
9} ();int {x} = 10;
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9
Lexical Analysis
int x = 5; float y = "hello;
String@z="9.5”;intx=cse340;if(x>
14) while
(5 == 5) if (int a) a = 1; x = x;
for ( ; ; );y = 13.45.0;int me
=99999000001111222000000111111222
223443483045830948;while { x !=
9} ();int {x} = 10;
”hello "world" bye"
# of STRINGS
9
12
3
18
12
2
6
12
3
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10
Keywords
Lexical
Alphabet Symbol
String Word
Token Rules
Regular
Expression
Deterministic
Finite
Automata
Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11
Homework
Review the following topics:
Regular Expressions (Text Book: Chapter 6)
and Deterministic Finite Automata
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

PDF
201506 CSE340 Lecture 14
PDF
201505 - CSE340 Lecture 01
PDF
201506 CSE340 Lecture 10
PDF
201505 CSE340 Lecture 03
PDF
201505 CSE340 Lecture 04
PDF
201506 CSE340 Lecture 07
PPTX
Radix Sort
PDF
Data Structure Radix Sort
201506 CSE340 Lecture 14
201505 - CSE340 Lecture 01
201506 CSE340 Lecture 10
201505 CSE340 Lecture 03
201505 CSE340 Lecture 04
201506 CSE340 Lecture 07
Radix Sort
Data Structure Radix Sort

What's hot (20)

PPT
Tcs nqt 2019 p 1
PPT
Tcs nqt 2019 p 2
PPTX
Pa1 loops
PDF
Unsupervised program synthesis
DOCX
C programming Lab 1
PPT
PDF
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
PPTX
More on Data Types (Exponential and Scientific Notations)
PPT
test(3)arithmetic in c
PPTX
parallelizing Trapezoidal rule
PPS
C programming session 03
PPTX
Arithmetic and Logic instructions in Embedded C
DOCX
Programming fundamentals
PDF
Code quailty metrics demystified
PDF
LLVM Overview
PPTX
Data structures Lecture no. 4
PDF
Quantifying Information Leaks via Model Counting Modulo Theories
PPTX
A* algorithm
PPTX
Space complexity
PDF
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
Tcs nqt 2019 p 1
Tcs nqt 2019 p 2
Pa1 loops
Unsupervised program synthesis
C programming Lab 1
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
More on Data Types (Exponential and Scientific Notations)
test(3)arithmetic in c
parallelizing Trapezoidal rule
C programming session 03
Arithmetic and Logic instructions in Embedded C
Programming fundamentals
Code quailty metrics demystified
LLVM Overview
Data structures Lecture no. 4
Quantifying Information Leaks via Model Counting Modulo Theories
A* algorithm
Space complexity
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
Ad

Viewers also liked (20)

PDF
Thehub euromed
PDF
PDF
Developing distributed analysis pipelines with shared community resources usi...
PDF
RCMSL Phenomenal July 16, 2009
PPS
KANSAS CITY INVESTMENT PROPERTIES
PPT
Login Seminars Blackboard Directions 2009
PPT
Tax planning introduction fall 2012
PPT
Syndrome metabolique et maladies vasculaires s novo
PDF
201506 CSE340 Lecture 09
PDF
Practical Object-Oriented Back-in-Time Debugging
PDF
Laserendoveineux b anastasie 1 er partie
PDF
201101 mLearning
PDF
Angeiologie 4 2013 - 1-2014 livre des resumes
PPTX
Eeuwigblijvenleren
PDF
Thehub bocconi law
ODP
Diapositivas
PPTX
Huizenprijzen in Amsterdam
PPT
Itf ipp ch10_2012_final
PPS
Cluster 15
Thehub euromed
Developing distributed analysis pipelines with shared community resources usi...
RCMSL Phenomenal July 16, 2009
KANSAS CITY INVESTMENT PROPERTIES
Login Seminars Blackboard Directions 2009
Tax planning introduction fall 2012
Syndrome metabolique et maladies vasculaires s novo
201506 CSE340 Lecture 09
Practical Object-Oriented Back-in-Time Debugging
Laserendoveineux b anastasie 1 er partie
201101 mLearning
Angeiologie 4 2013 - 1-2014 livre des resumes
Eeuwigblijvenleren
Thehub bocconi law
Diapositivas
Huizenprijzen in Amsterdam
Itf ipp ch10_2012_final
Cluster 15
Ad

Similar to 201505 CSE340 Lecture 02 (20)

PDF
201506 CSE340 Lecture 20
PDF
201801 CSE240 Lecture 03
PDF
201506 CSE340 Lecture 21
PDF
201801 CSE240 Lecture 01
PDF
201505 CSE340 Lecture 06
PDF
Лексический анализ расмореные 3 различных способа
PPT
Compiler Design in Engineering for Designing
PDF
201801 CSE240 Lecture 26
PDF
Compiler worksheet
PDF
201506 CSE340 Lecture 23
PDF
C compiler(final)
PPT
Lesson 01.ppt theory of automata including basics of it
PPT
Lesson 01 for Computer Science Data Analysis
PPT
Theory of Automata - Power Point Slides Lecture 01).ppt
PPT
Compiler design.ppt
PDF
Compilers Design
PDF
201506 CSE340 Lecture 17
PPT
Theory of Automata Lesson 01
PPT
Lexical analysis, syntax analysis, semantic analysis. Ppt
PDF
201506 CSE340 Lecture 12
201506 CSE340 Lecture 20
201801 CSE240 Lecture 03
201506 CSE340 Lecture 21
201801 CSE240 Lecture 01
201505 CSE340 Lecture 06
Лексический анализ расмореные 3 различных способа
Compiler Design in Engineering for Designing
201801 CSE240 Lecture 26
Compiler worksheet
201506 CSE340 Lecture 23
C compiler(final)
Lesson 01.ppt theory of automata including basics of it
Lesson 01 for Computer Science Data Analysis
Theory of Automata - Power Point Slides Lecture 01).ppt
Compiler design.ppt
Compilers Design
201506 CSE340 Lecture 17
Theory of Automata Lesson 01
Lexical analysis, syntax analysis, semantic analysis. Ppt
201506 CSE340 Lecture 12

More from Javier Gonzalez-Sanchez (20)

PDF
201804 SER332 Lecture 01
PDF
201801 SER332 Lecture 03
PDF
201801 SER332 Lecture 04
PDF
201801 SER332 Lecture 02
PDF
201801 CSE240 Lecture 25
PDF
201801 CSE240 Lecture 24
PDF
201801 CSE240 Lecture 23
PDF
201801 CSE240 Lecture 22
PDF
201801 CSE240 Lecture 21
PDF
201801 CSE240 Lecture 20
PDF
201801 CSE240 Lecture 19
PDF
201801 CSE240 Lecture 18
PDF
201801 CSE240 Lecture 17
PDF
201801 CSE240 Lecture 16
PDF
201801 CSE240 Lecture 15
PDF
201801 CSE240 Lecture 14
PDF
201801 CSE240 Lecture 13
PDF
201801 CSE240 Lecture 12
PDF
201801 CSE240 Lecture 11
PDF
201801 CSE240 Lecture 10
201804 SER332 Lecture 01
201801 SER332 Lecture 03
201801 SER332 Lecture 04
201801 SER332 Lecture 02
201801 CSE240 Lecture 25
201801 CSE240 Lecture 24
201801 CSE240 Lecture 23
201801 CSE240 Lecture 22
201801 CSE240 Lecture 21
201801 CSE240 Lecture 20
201801 CSE240 Lecture 19
201801 CSE240 Lecture 18
201801 CSE240 Lecture 17
201801 CSE240 Lecture 16
201801 CSE240 Lecture 15
201801 CSE240 Lecture 14
201801 CSE240 Lecture 13
201801 CSE240 Lecture 12
201801 CSE240 Lecture 11
201801 CSE240 Lecture 10

Recently uploaded (20)

PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Introduction to Artificial Intelligence
PPTX
history of c programming in notes for students .pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
medical staffing services at VALiNTRY
PDF
System and Network Administration Chapter 2
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
CHAPTER 2 - PM Management and IT Context
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Reimagine Home Health with the Power of Agentic AI​
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Navsoft: AI-Powered Business Solutions & Custom Software Development
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Introduction to Artificial Intelligence
history of c programming in notes for students .pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
medical staffing services at VALiNTRY
System and Network Administration Chapter 2
Odoo Companies in India – Driving Business Transformation.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
CHAPTER 2 - PM Management and IT Context

201505 CSE340 Lecture 02

  • 1. CSE340 - Principles of Programming Languages Lecture 02: Introduction Javier Gonzalez-Sanchez javiergs@asu.edu BYENG M1-38 Office Hours: By appointment
  • 2. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 2 Keywords Level Paradigm Language Analysis Lexical Input: Symbols Output: Words Syntax Input: Words Output: Sentences Semantic Input: Sentences Translate or Execute
  • 3. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 3 Analysis int x = 5; float y = "hello; String @z = "9.5"; int x = cse340; if ( x > 14) while (5 == 5) if (int a) a = 1; x = x; for ( ; ; ); y = 13.45.0; int me = 99999000001111222000000111111222223443483045830948; while { x != 9} (); int {x} = 10;
  • 4. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 4 High-Level Languages X,E,G,O,O #e1,I,I,0,7 @ OPR 19, AX STO x, AX LIT 5, AX OPR 21, AX LOD #e1,AX CAL 1, AX OPR 0, AX 5 Virtual Machine (interpreter) // sorce code int x; int foo () { read (x); print (5); } main () { foo (); } Lexer Parser Semantic Analyzer Code Generation 01001010101000010 01010100101010010 10100100000011011 11010010110101111 00010010101010010 10101001010101011 Assembler compilation execution
  • 5. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 5 Keywords Lexical Alphabet Symbol String Word Token
  • 6. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 6 Lexical Analysis int x = 5; float y = "hello; String @z = "9.5"; int x = cse340; if ( x > 14) while (5 == 5) if (int a) a = 1; x = x; for ( ; ; ); y = 13.45.0; int me = 99999000001111222000000111111222223443483045830948; while { x != 9} (); int {x} = 10;
  • 7. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 7 Lexical Analysis | Steps a)  Read a text FILE line by line b)  For each LINE: •  Read character by character. •  Create sets of consecutive characters (STRING). Try to group the bigger amount of characters as possible. •  Start a new set each time that you need. Take care of: Whitespace, Delimiter, Operator, End of Line and others special characters. c) For each STRING: verify if it is a valid WORD. d) Create a VECTOR and store the STRINGs and WORDs.
  • 8. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 8 Lexical Analysis int x = 5; float y = "hello; String@z="9.5”;intx=cse340;if(x> 14) while (5 == 5) if (int a) a = 1; x = x; for ( ; ; );y = 13.45.0;int me =99999000001111222000000111111222 223443483045830948;while { x != 9} ();int {x} = 10;
  • 9. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 9 Lexical Analysis int x = 5; float y = "hello; String@z="9.5”;intx=cse340;if(x> 14) while (5 == 5) if (int a) a = 1; x = x; for ( ; ; );y = 13.45.0;int me =99999000001111222000000111111222 223443483045830948;while { x != 9} ();int {x} = 10; ”hello "world" bye" # of STRINGS 9 12 3 18 12 2 6 12 3
  • 10. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 10 Keywords Lexical Alphabet Symbol String Word Token Rules Regular Expression Deterministic Finite Automata
  • 11. Javier Gonzalez-Sanchez | CSE340 | Summer 2015 | 11 Homework Review the following topics: Regular Expressions (Text Book: Chapter 6) and Deterministic Finite Automata
  • 12. 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.