SlideShare une entreprise Scribd logo
1  sur  20
Programming Languages
Building a Web Brower
Instructor : Westley Weimer
1
2
3
Interpreting
Finds the meaning of a program by traversing its parse tree
+
+ 3
1 2
Parse Tree
is means "6"
4
Interpreting
required to check the types
One goal of semantic analysis is to notice and rule out bad programs
1 +"hello"
+
1 "hello"
is means ?
5
HTML Interpreting
"<b>hello</b>"
Syntactical
Analysis
Lexical
Analysis
[('tag-element', 'b', [], [('word-element', 'hello')], 'b')]
6
HTML Interpreting
[('tag-element', 'b', [], [('word-element', 'hello')], 'b')]
tag-element
b word-element
hello
b
"<b>hello</b>"
7
HTML Interpreting
[('tag-element', 'b', [], [('word-element', 'hello')], 'b')]
tag-element
b word-element
hello
b
"<b>hello</b>"
8
HTML Interpreting
[('tag-element', 'b', [], [('word-element', 'hello')], 'b')]
tag-element
b word-element
hello
b
"<b>hello</b>"
9
HTML Interpreting
[('tag-element', 'b', [], [('word-element', 'hello')], 'b')]
tag-element
b word-element
hello
b
"<b>hello</b>"
10
HTML Interpreting
import graphics
def interpret(trees):
for tree in trees:
# ("word-element", "hello")
nodetype=tree[0]
if nodetype == "word-element":
graphics.word(tree[1])
# [("tag-element", "b", [], [("word-element", "hello")], "b")]
elif nodetype == "tag-element“:
tagname = tree[1]
tagargs = tree[2]
subtrees = tree[3]
closetagname = tree[4]
"<a href=‘www.codin.com’>codin9cafe</a>"
graphics.begintag(‘a’, {‘href’ : ’www.codin.com’})
graphics.word(‘codin9cafe’)
graphics.endtag()
codin9cafe
11
HTML Interpreting
if tagname != closetagname:
graphics.warning("mismatched tag")
else:
graphics.begintag(tagname,tagargs)
interpret(subtrees)
graphics.endtag()
graphics.initialize() # Enables display of output.
interpret([("word-element","Hello")])
interpret([("tag-element","a",[],[("word-element","Hello")],"b")])
graphics.finalize() # Disables display of output.
12
JS Interpreting
" x = 3 + 6"
Syntactical
Analysis
Lexical
Analysis
(‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0)))
13
JS Interpreting
(‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0)))
assign
x
+
"x = 3 + 6"
number number
3.0 6.0
binop
14
JS Interpreting
(‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0)))
assign
x
+
"x = 3 + 6"
number number
3.0 6.0
binop
15
JS Interpreting
(‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0)))
assign
x
+
"x = 3 + 6"
number number
3.0 6.0
binop
16
JS Interpreting
(‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘binop’, (‘number’, 6.0)))
assign
x
+
"x = 3 + 6"
number number
3.0 6.0
binop
17
JS Interpreting
def eval_stmts(tree, environment):
stmttype = tree[0]
if stmttype == "assign":
# ("assign", "x", ("binop", ..., "+", ...))
variable_name = tree[1]
right_child = tree[2]
new_value = eval_exp(right_child, environment)
env_update(environment, variable_name, new_value)
to know the current state
ex) env = { “x” : 3 }
x + 2 = 5
18
JS Interpreting
def eval_exp(tree, environment):
nodetype = tree[0]
if nodetype == "number":
return int(tree[1])
elif nodetype == "binop":
left_value = eval_exp(tree[1], environment)
operator = tree[2]
right_value = eval_exp(tree[3], environment)
if operator == "+":
return left_value + right_value
elif nodetype == "identifier":
# ("binop", ("identifier","x"), "+", ("number","2"))
identifier = tree[1]
return env_lookup(environment,identifier)
19
JS Interpreting
x = 1
y = 2
def myfun(x):
print x
print y
myfun(5)
x : 1 y : 2
Global Environment
x : 5
New Environment
env = (None, {"x":1, “y":1})
newenv = (env, {"x":5})
20

Contenu connexe

Tendances

Pymongo for the Clueless
Pymongo for the CluelessPymongo for the Clueless
Pymongo for the CluelessChee Leong Chow
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesomePiotr Miazga
 
MongoDB World 2019: Just-in-time Validation with JSON Schema
MongoDB World 2019: Just-in-time Validation with JSON SchemaMongoDB World 2019: Just-in-time Validation with JSON Schema
MongoDB World 2019: Just-in-time Validation with JSON SchemaMongoDB
 
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析Takashi Kitano
 
Visualization of Supervised Learning with {arules} + {arulesViz}
Visualization of Supervised Learning with {arules} + {arulesViz}Visualization of Supervised Learning with {arules} + {arulesViz}
Visualization of Supervised Learning with {arules} + {arulesViz}Takashi J OZAKI
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)Ankit Gupta
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Suyeol Jeon
 
How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6Maxime Beugnet
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)Ki Sung Bae
 
Being Google
Being GoogleBeing Google
Being GoogleTom Dyson
 
令和から本気出す
令和から本気出す令和から本気出す
令和から本気出すTakashi Kitano
 
Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)brian d foy
 
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver){tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)Takashi Kitano
 
Being! Black Hat with Drupal - Anand Toshniwal
Being! Black Hat with Drupal - Anand ToshniwalBeing! Black Hat with Drupal - Anand Toshniwal
Being! Black Hat with Drupal - Anand ToshniwalDrupalMumbai
 
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲Mohammad Reza Kamalifard
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 

Tendances (20)

Pymongo for the Clueless
Pymongo for the CluelessPymongo for the Clueless
Pymongo for the Clueless
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesome
 
MongoDB World 2019: Just-in-time Validation with JSON Schema
MongoDB World 2019: Just-in-time Validation with JSON SchemaMongoDB World 2019: Just-in-time Validation with JSON Schema
MongoDB World 2019: Just-in-time Validation with JSON Schema
 
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
 
Visualization of Supervised Learning with {arules} + {arulesViz}
Visualization of Supervised Learning with {arules} + {arulesViz}Visualization of Supervised Learning with {arules} + {arulesViz}
Visualization of Supervised Learning with {arules} + {arulesViz}
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
 
Lập trình Python cơ bản
Lập trình Python cơ bảnLập trình Python cơ bản
Lập trình Python cơ bản
 
LINQ
LINQLINQ
LINQ
 
Knockout
KnockoutKnockout
Knockout
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
 
How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)
 
Being Google
Being GoogleBeing Google
Being Google
 
令和から本気出す
令和から本気出す令和から本気出す
令和から本気出す
 
Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)Benchmarking Perl (Chicago UniForum 2006)
Benchmarking Perl (Chicago UniForum 2006)
 
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver){tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)
{tidygraph}と{ggraph}による モダンなネットワーク分析(未公開ver)
 
Being! Black Hat with Drupal - Anand Toshniwal
Being! Black Hat with Drupal - Anand ToshniwalBeing! Black Hat with Drupal - Anand Toshniwal
Being! Black Hat with Drupal - Anand Toshniwal
 
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 

Similaire à codin9cafe[2015.03.04]Open course(programming languages) - 장철호(Ch Jang)

Python tutorial
Python tutorialPython tutorial
Python tutorialRajiv Risi
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...amit kuraria
 
MongoDB for Analytics
MongoDB for AnalyticsMongoDB for Analytics
MongoDB for AnalyticsMongoDB
 
Python tutorial
Python tutorialPython tutorial
Python tutorialnazzf
 
Python tutorial
Python tutorialPython tutorial
Python tutorialShani729
 
Becoming a Pythonist
Becoming a PythonistBecoming a Pythonist
Becoming a PythonistRaji Engg
 
第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎juzihua1102
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎anzhong70
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
Chapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdfChapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdfMekiyaShigute1
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesMatt Harrison
 
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of Wrangling
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of WranglingPLOTCON NYC: Behind Every Great Plot There's a Great Deal of Wrangling
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of WranglingPlotly
 
DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)EMRE AKCAOGLU
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languagesArthur Xavier
 
Python and Data Analysis
Python and Data AnalysisPython and Data Analysis
Python and Data AnalysisPraveen Nair
 

Similaire à codin9cafe[2015.03.04]Open course(programming languages) - 장철호(Ch Jang) (20)

Python Puzzlers
Python PuzzlersPython Puzzlers
Python Puzzlers
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
 
MongoDB for Analytics
MongoDB for AnalyticsMongoDB for Analytics
MongoDB for Analytics
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Indexing
IndexingIndexing
Indexing
 
Becoming a Pythonist
Becoming a PythonistBecoming a Pythonist
Becoming a Pythonist
 
第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
Chapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdfChapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdf
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of Wrangling
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of WranglingPLOTCON NYC: Behind Every Great Plot There's a Great Deal of Wrangling
PLOTCON NYC: Behind Every Great Plot There's a Great Deal of Wrangling
 
DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languages
 
Python and Data Analysis
Python and Data AnalysisPython and Data Analysis
Python and Data Analysis
 
Ch04
Ch04Ch04
Ch04
 
Python slide
Python slidePython slide
Python slide
 

Plus de codin9cafe

codin9cafe[2015.05.20]Dom - 안민영
codin9cafe[2015.05.20]Dom - 안민영codin9cafe[2015.05.20]Dom - 안민영
codin9cafe[2015.05.20]Dom - 안민영codin9cafe
 
codin9cafe[2015.03. 18]Git 브랜치 - 김병수
codin9cafe[2015.03. 18]Git 브랜치 - 김병수codin9cafe[2015.03. 18]Git 브랜치 - 김병수
codin9cafe[2015.03. 18]Git 브랜치 - 김병수codin9cafe
 
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...codin9cafe
 
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)codin9cafe
 
Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211codin9cafe
 
codin9cafe[2015.02.04]Git의 기초(2) - 김병수
codin9cafe[2015.02.04]Git의 기초(2) - 김병수codin9cafe[2015.02.04]Git의 기초(2) - 김병수
codin9cafe[2015.02.04]Git의 기초(2) - 김병수codin9cafe
 
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)codin9cafe
 
codin9cafe[2015.01.22]Intro to computer science - 최지선
codin9cafe[2015.01.22]Intro to computer science - 최지선codin9cafe[2015.01.22]Intro to computer science - 최지선
codin9cafe[2015.01.22]Intro to computer science - 최지선codin9cafe
 
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수codin9cafe[2015.01.29]Interactive 3D graphics - 박희수
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수codin9cafe
 

Plus de codin9cafe (9)

codin9cafe[2015.05.20]Dom - 안민영
codin9cafe[2015.05.20]Dom - 안민영codin9cafe[2015.05.20]Dom - 안민영
codin9cafe[2015.05.20]Dom - 안민영
 
codin9cafe[2015.03. 18]Git 브랜치 - 김병수
codin9cafe[2015.03. 18]Git 브랜치 - 김병수codin9cafe[2015.03. 18]Git 브랜치 - 김병수
codin9cafe[2015.03. 18]Git 브랜치 - 김병수
 
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...
codin9cafe[2015.03. 18]Python learning for natural language processing - 홍은기(...
 
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.02.25]Open course(programming languages) - 장철호(Ch Jang)
 
Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211
 
codin9cafe[2015.02.04]Git의 기초(2) - 김병수
codin9cafe[2015.02.04]Git의 기초(2) - 김병수codin9cafe[2015.02.04]Git의 기초(2) - 김병수
codin9cafe[2015.02.04]Git의 기초(2) - 김병수
 
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)
codin9cafe[2015.01.28]Open course(programming languages) - 장철호(Ch Jang)
 
codin9cafe[2015.01.22]Intro to computer science - 최지선
codin9cafe[2015.01.22]Intro to computer science - 최지선codin9cafe[2015.01.22]Intro to computer science - 최지선
codin9cafe[2015.01.22]Intro to computer science - 최지선
 
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수codin9cafe[2015.01.29]Interactive 3D graphics - 박희수
codin9cafe[2015.01.29]Interactive 3D graphics - 박희수
 

Dernier

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

codin9cafe[2015.03.04]Open course(programming languages) - 장철호(Ch Jang)

  • 1. Programming Languages Building a Web Brower Instructor : Westley Weimer 1
  • 2. 2
  • 3. 3 Interpreting Finds the meaning of a program by traversing its parse tree + + 3 1 2 Parse Tree is means "6"
  • 4. 4 Interpreting required to check the types One goal of semantic analysis is to notice and rule out bad programs 1 +"hello" + 1 "hello" is means ?
  • 6. 6 HTML Interpreting [('tag-element', 'b', [], [('word-element', 'hello')], 'b')] tag-element b word-element hello b "<b>hello</b>"
  • 7. 7 HTML Interpreting [('tag-element', 'b', [], [('word-element', 'hello')], 'b')] tag-element b word-element hello b "<b>hello</b>"
  • 8. 8 HTML Interpreting [('tag-element', 'b', [], [('word-element', 'hello')], 'b')] tag-element b word-element hello b "<b>hello</b>"
  • 9. 9 HTML Interpreting [('tag-element', 'b', [], [('word-element', 'hello')], 'b')] tag-element b word-element hello b "<b>hello</b>"
  • 10. 10 HTML Interpreting import graphics def interpret(trees): for tree in trees: # ("word-element", "hello") nodetype=tree[0] if nodetype == "word-element": graphics.word(tree[1]) # [("tag-element", "b", [], [("word-element", "hello")], "b")] elif nodetype == "tag-element“: tagname = tree[1] tagargs = tree[2] subtrees = tree[3] closetagname = tree[4] "<a href=‘www.codin.com’>codin9cafe</a>" graphics.begintag(‘a’, {‘href’ : ’www.codin.com’}) graphics.word(‘codin9cafe’) graphics.endtag() codin9cafe
  • 11. 11 HTML Interpreting if tagname != closetagname: graphics.warning("mismatched tag") else: graphics.begintag(tagname,tagargs) interpret(subtrees) graphics.endtag() graphics.initialize() # Enables display of output. interpret([("word-element","Hello")]) interpret([("tag-element","a",[],[("word-element","Hello")],"b")]) graphics.finalize() # Disables display of output.
  • 12. 12 JS Interpreting " x = 3 + 6" Syntactical Analysis Lexical Analysis (‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0)))
  • 13. 13 JS Interpreting (‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0))) assign x + "x = 3 + 6" number number 3.0 6.0 binop
  • 14. 14 JS Interpreting (‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0))) assign x + "x = 3 + 6" number number 3.0 6.0 binop
  • 15. 15 JS Interpreting (‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘number’, 6.0))) assign x + "x = 3 + 6" number number 3.0 6.0 binop
  • 16. 16 JS Interpreting (‘assign’, ’x’, (‘binop’, (‘number’, 3.0), ‘+’, (‘binop’, (‘number’, 6.0))) assign x + "x = 3 + 6" number number 3.0 6.0 binop
  • 17. 17 JS Interpreting def eval_stmts(tree, environment): stmttype = tree[0] if stmttype == "assign": # ("assign", "x", ("binop", ..., "+", ...)) variable_name = tree[1] right_child = tree[2] new_value = eval_exp(right_child, environment) env_update(environment, variable_name, new_value) to know the current state ex) env = { “x” : 3 } x + 2 = 5
  • 18. 18 JS Interpreting def eval_exp(tree, environment): nodetype = tree[0] if nodetype == "number": return int(tree[1]) elif nodetype == "binop": left_value = eval_exp(tree[1], environment) operator = tree[2] right_value = eval_exp(tree[3], environment) if operator == "+": return left_value + right_value elif nodetype == "identifier": # ("binop", ("identifier","x"), "+", ("number","2")) identifier = tree[1] return env_lookup(environment,identifier)
  • 19. 19 JS Interpreting x = 1 y = 2 def myfun(x): print x print y myfun(5) x : 1 y : 2 Global Environment x : 5 New Environment env = (None, {"x":1, “y":1}) newenv = (env, {"x":5})
  • 20. 20