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

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfOrtus Solutions, Corp
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024Ortus Solutions, Corp
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEJelle | Nordend
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageGlobus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptxGeorgi Kodinov
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILNatan Silnitsky
 

Recently uploaded (20)

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

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