SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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北京交流会)
 

Similar to 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
 

Similar to 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
 

More from 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
 

More from 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 - 박희수
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

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