SlideShare a Scribd company logo
1 of 15
CORE RUBY: HOW IT
WORKS
Back to Basics
A Success Story
Why Ruby?
A Journey To RUBY
My code’s journey through Ruby
Sample.r
b
Tokenize Parse Compile
YARV
instructio
ns
Tokens AST
Nodes
Your Code has a long road to take before
Ruby ever runs it.
- Pat Shaughnessy
Starter
Tokenization
1 0 . t i m e s d
o
| n |
. t i m e s d
o
| n |
tINTEG
ER
10
Tokenization (Cont.)
. t i m e s d
o
| n |
tINTEG
ER
10
t i m e s d
o
| n |
tINTEG
ER
10
.
tINTEG
ER
10
.
tIDENTIFIE
R
times
Keyword_do | |
tIDENTIFIE
R
n
Tokenization (Cont.)
Parsing
 Ruby uses a parse.c file, which is a parser
generator.
 It consists a parse.y file which contains
grammar rules
 Parser generator:
- input: tokens
- output: tokens that follow the grammar rules
 parse.c file uses LALR (Look-ahead Left
Reversed Rightmost Derivation) Algorithm
Parsing (Cont.)
Parsing (Cont.)
AST (Abstract Syntax Tree)
program
binary
Integer
5
plus
Integer
5
Compilation
 Before Ruby 1.9,
there was no
compiler.
 Using YARV, you
compile your code
into bytecode (like
JVM)
 JVM compiles the
bytecode with JIT
compiler, Ruby
interprets the
bytecode
Hey, Isn’t it too complex?
Compilation (Cont.)
 Why this extra compiler added from version
1.9?
 Answer: Speed. A compiled program with YARV is
much faster (~ 4.25 times) than traversing AST
nodes.
 Okay, Now what?
 Answer: Now let’s taste the magic of Ruby.
Thanks to “Matz”.
 Enough! Why do we need this actually?
 Isn’t it awesome to know how a language works
internally?
From, Dohatec
Thanks, I’m Imtiaz Hossain Emu

More Related Content

What's hot

오픈소스 라이브러리 개발기
오픈소스 라이브러리 개발기오픈소스 라이브러리 개발기
오픈소스 라이브러리 개발기겨울 정
 
Programming with Python - Basic
Programming with Python - BasicProgramming with Python - Basic
Programming with Python - BasicMosky Liu
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Python in real world.
Python in real world.Python in real world.
Python in real world.Alph@.M
 
Hacking the Python AST
Hacking the Python ASTHacking the Python AST
Hacking the Python ASTSuhas SG
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonDror Helper
 
C 檔案輸入與輸出
C 檔案輸入與輸出C 檔案輸入與輸出
C 檔案輸入與輸出PingLun Liao
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1Elaf A.Saeed
 
4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...PROIDEA
 

What's hot (15)

오픈소스 라이브러리 개발기
오픈소스 라이브러리 개발기오픈소스 라이브러리 개발기
오픈소스 라이브러리 개발기
 
Lets learn Python !
Lets learn Python !Lets learn Python !
Lets learn Python !
 
Python
PythonPython
Python
 
Programming with Python - Basic
Programming with Python - BasicProgramming with Python - Basic
Programming with Python - Basic
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Python in real world.
Python in real world.Python in real world.
Python in real world.
 
Python Workshop
Python WorkshopPython Workshop
Python Workshop
 
Introduction to c part 4
Introduction to c  part  4Introduction to c  part  4
Introduction to c part 4
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
 
Hacking the Python AST
Hacking the Python ASTHacking the Python AST
Hacking the Python AST
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPython
 
C 檔案輸入與輸出
C 檔案輸入與輸出C 檔案輸入與輸出
C 檔案輸入與輸出
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1
 
4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...
 

Similar to RubyConf Bangladesh 2017 - Core Ruby: How it works

Ruby formatters
Ruby formattersRuby formatters
Ruby formattersVisuality
 
Static analysis for perl
Static analysis for perlStatic analysis for perl
Static analysis for perlmoznion
 
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Ontico
 
Introduction to Python for Bioinformatics
Introduction to Python for BioinformaticsIntroduction to Python for Bioinformatics
Introduction to Python for BioinformaticsJosé Héctor Gálvez
 
Unitiv 111206005201-phpapp01
Unitiv 111206005201-phpapp01Unitiv 111206005201-phpapp01
Unitiv 111206005201-phpapp01riddhi viradiya
 
Pharo Quality Engine: The Last Strokes (esug2017)
Pharo Quality Engine: The Last Strokes (esug2017)Pharo Quality Engine: The Last Strokes (esug2017)
Pharo Quality Engine: The Last Strokes (esug2017)Yuriy Tymchuk
 
Pharo Quality Engine: The Last Strokes
Pharo Quality Engine: The Last StrokesPharo Quality Engine: The Last Strokes
Pharo Quality Engine: The Last StrokesESUG
 
Perl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code LinterPerl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code Lintermoznion
 
The ultimate guide for Elasticsearch plugins
The ultimate guide for Elasticsearch pluginsThe ultimate guide for Elasticsearch plugins
The ultimate guide for Elasticsearch pluginsItamar
 
Contribute to rails
Contribute to railsContribute to rails
Contribute to railsmartinsvalin
 
Os Worthington
Os WorthingtonOs Worthington
Os Worthingtonoscon2007
 
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesOptimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesHPCC Systems
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 

Similar to RubyConf Bangladesh 2017 - Core Ruby: How it works (20)

Ruby - The Hard Bits
Ruby - The Hard BitsRuby - The Hard Bits
Ruby - The Hard Bits
 
Ruby formatters
Ruby formattersRuby formatters
Ruby formatters
 
Digging into Ruby Guts
Digging into Ruby GutsDigging into Ruby Guts
Digging into Ruby Guts
 
Static analysis for perl
Static analysis for perlStatic analysis for perl
Static analysis for perl
 
Python redis talk
Python redis talkPython redis talk
Python redis talk
 
Php’s guts
Php’s gutsPhp’s guts
Php’s guts
 
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
 
Introduction to Python for Bioinformatics
Introduction to Python for BioinformaticsIntroduction to Python for Bioinformatics
Introduction to Python for Bioinformatics
 
Unitiv 111206005201-phpapp01
Unitiv 111206005201-phpapp01Unitiv 111206005201-phpapp01
Unitiv 111206005201-phpapp01
 
Ruby formatters 2019
Ruby formatters 2019Ruby formatters 2019
Ruby formatters 2019
 
Pharo Quality Engine: The Last Strokes (esug2017)
Pharo Quality Engine: The Last Strokes (esug2017)Pharo Quality Engine: The Last Strokes (esug2017)
Pharo Quality Engine: The Last Strokes (esug2017)
 
Pharo Quality Engine: The Last Strokes
Pharo Quality Engine: The Last StrokesPharo Quality Engine: The Last Strokes
Pharo Quality Engine: The Last Strokes
 
Perl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code LinterPerl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code Linter
 
The ultimate guide for Elasticsearch plugins
The ultimate guide for Elasticsearch pluginsThe ultimate guide for Elasticsearch plugins
The ultimate guide for Elasticsearch plugins
 
Snort IDS
Snort IDSSnort IDS
Snort IDS
 
Contribute to rails
Contribute to railsContribute to rails
Contribute to rails
 
Pcd question bank
Pcd question bank Pcd question bank
Pcd question bank
 
Os Worthington
Os WorthingtonOs Worthington
Os Worthington
 
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesOptimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 

More from Ruby Bangladesh

RubyConf Bangladesh 2017 - Introduction to Ruby on Rails
RubyConf Bangladesh 2017 - Introduction to Ruby on RailsRubyConf Bangladesh 2017 - Introduction to Ruby on Rails
RubyConf Bangladesh 2017 - Introduction to Ruby on RailsRuby Bangladesh
 
RubyConf Bangladesh 2017 - Speed up your API/backend
RubyConf Bangladesh 2017 - Speed up your API/backendRubyConf Bangladesh 2017 - Speed up your API/backend
RubyConf Bangladesh 2017 - Speed up your API/backendRuby Bangladesh
 
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSL
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSLRubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSL
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSLRuby Bangladesh
 
RubyConf Bangladesh 2017 - Which language should I choose
RubyConf Bangladesh 2017 - Which language should I chooseRubyConf Bangladesh 2017 - Which language should I choose
RubyConf Bangladesh 2017 - Which language should I chooseRuby Bangladesh
 
RubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRuby Bangladesh
 
RubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRuby Bangladesh
 
Rubyconf Bangladesh 2017 - Lets start coding in Ruby
Rubyconf Bangladesh 2017 - Lets start coding in RubyRubyconf Bangladesh 2017 - Lets start coding in Ruby
Rubyconf Bangladesh 2017 - Lets start coding in RubyRuby Bangladesh
 

More from Ruby Bangladesh (7)

RubyConf Bangladesh 2017 - Introduction to Ruby on Rails
RubyConf Bangladesh 2017 - Introduction to Ruby on RailsRubyConf Bangladesh 2017 - Introduction to Ruby on Rails
RubyConf Bangladesh 2017 - Introduction to Ruby on Rails
 
RubyConf Bangladesh 2017 - Speed up your API/backend
RubyConf Bangladesh 2017 - Speed up your API/backendRubyConf Bangladesh 2017 - Speed up your API/backend
RubyConf Bangladesh 2017 - Speed up your API/backend
 
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSL
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSLRubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSL
RubyConf Bangladesh 2017 - Craft beautiful code with Ruby DSL
 
RubyConf Bangladesh 2017 - Which language should I choose
RubyConf Bangladesh 2017 - Which language should I chooseRubyConf Bangladesh 2017 - Which language should I choose
RubyConf Bangladesh 2017 - Which language should I choose
 
RubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for Rubyists
 
RubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy codeRubyConf Bangladesh 2017 - Rails buggy code
RubyConf Bangladesh 2017 - Rails buggy code
 
Rubyconf Bangladesh 2017 - Lets start coding in Ruby
Rubyconf Bangladesh 2017 - Lets start coding in RubyRubyconf Bangladesh 2017 - Lets start coding in Ruby
Rubyconf Bangladesh 2017 - Lets start coding in Ruby
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 

RubyConf Bangladesh 2017 - Core Ruby: How it works

  • 1. CORE RUBY: HOW IT WORKS Back to Basics
  • 4. A Journey To RUBY My code’s journey through Ruby Sample.r b Tokenize Parse Compile YARV instructio ns Tokens AST Nodes
  • 5. Your Code has a long road to take before Ruby ever runs it. - Pat Shaughnessy Starter
  • 6. Tokenization 1 0 . t i m e s d o | n | . t i m e s d o | n | tINTEG ER 10
  • 7. Tokenization (Cont.) . t i m e s d o | n | tINTEG ER 10 t i m e s d o | n | tINTEG ER 10 . tINTEG ER 10 . tIDENTIFIE R times Keyword_do | | tIDENTIFIE R n
  • 9. Parsing  Ruby uses a parse.c file, which is a parser generator.  It consists a parse.y file which contains grammar rules  Parser generator: - input: tokens - output: tokens that follow the grammar rules  parse.c file uses LALR (Look-ahead Left Reversed Rightmost Derivation) Algorithm
  • 11. Parsing (Cont.) AST (Abstract Syntax Tree) program binary Integer 5 plus Integer 5
  • 12. Compilation  Before Ruby 1.9, there was no compiler.  Using YARV, you compile your code into bytecode (like JVM)  JVM compiles the bytecode with JIT compiler, Ruby interprets the bytecode
  • 13. Hey, Isn’t it too complex?
  • 14. Compilation (Cont.)  Why this extra compiler added from version 1.9?  Answer: Speed. A compiled program with YARV is much faster (~ 4.25 times) than traversing AST nodes.  Okay, Now what?  Answer: Now let’s taste the magic of Ruby. Thanks to “Matz”.  Enough! Why do we need this actually?  Isn’t it awesome to know how a language works internally?
  • 15. From, Dohatec Thanks, I’m Imtiaz Hossain Emu