Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Smalltalk On Rubinius
Search
Konstantin Haase
September 17, 2011
Technology
1
38
Smalltalk On Rubinius
Konstantin Haase
September 17, 2011
Tweet
Share
More Decks by Konstantin Haase
See All by Konstantin Haase
RubyConf Philippines 2017: Magenta is a Lie
rkh
0
180
How We Replaced Salary Negotiations with a Sinatra App
rkh
17
4.1k
HTTP (RubyMonsters Edition)
rkh
5
1k
GCRC 2015: Abstract Thoughts on Abstract Things
rkh
1
340
Frozen Rails: Magenta - The Art Of Abstraction
rkh
3
280
RedDotRubyConf 2014: Magenta is a Lie - and other tales of abstraction
rkh
0
840
Ancient City Ruby: Hack me, if you can!
rkh
2
400
Boston I/O: Continuous Integration
rkh
3
300
Steel City Ruby: Architecting Chaos
rkh
4
890
Other Decks in Technology
See All in Technology
エンジニアが加速させるプロダクトディスカバリー 〜最速で価値ある機能を見つける方法〜 / product discovery accelerated by engineers
rince
4
530
大規模アジャイルフレームワークから学ぶエンジニアマネジメントの本質
staka121
PRO
3
160
エンジニアリング価値を黒字化する バリューベース戦略を用いた 技術戦略策定の道のり
kzkmaeda
6
1.5k
転生CISOサバイバル・ガイド / CISO Career Transition Survival Guide
kanny
3
1.2k
Exadata Database Service on Cloud@Customer セキュリティ、ネットワーク、および管理について
oracle4engineer
PRO
2
1.5k
Goで作って学ぶWebSocket
ryuichi1208
3
2.4k
わたしのOSS活動
kazupon
2
330
Helm , Kustomize に代わる !? 次世代 k8s パッケージマネージャー Glasskube 入門 / glasskube-entry
parupappa2929
0
290
Potential EM 制度を始めた理由、そして2年後にやめた理由 - EMConf JP 2025
hoyo
2
1.6k
Two Blades, One Journey: Engineering While Managing
ohbarye
3
790
AIエージェント時代のエンジニアになろう #jawsug #jawsdays2025 / 20250301 Agentic AI Engineering
yoshidashingo
1
110
利用終了したドメイン名の最強終活〜観測環境を育てて、分析・供養している件〜 / The Ultimate End-of-Life Preparation for Discontinued Domain Names
nttcom
2
360
Featured
See All Featured
Unsuck your backbone
ammeep
669
57k
Music & Morning Musume
bryan
46
6.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
How GitHub (no longer) Works
holman
314
140k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
360
Making the Leap to Tech Lead
cromwellryan
133
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Cult of Friendly URLs
andyhume
78
6.2k
Transcript
Smalltalk On Rubinius Konstantin Haase
None
None
None
None
None
None
None
None
Why implement Smalltalk on Rubinius?
Why create a programming language?
Why create?
"When you don't create things, you become defined by your
tastes rather than ability. Your tastes only narrow and exclude people. So create." why the lucky stiff
Why a programming language?
About programming languages: "I don’t like any of them, and
I don’t think any of them are suitable for the real programming problems of today, whether for systems or for end-users" Alan Kay
Problem Oriented Programming Languages Cairo (~120k SLOC in C) rewritten
in less than 400 lines
Why Smalltalk?
Why Rubinius?
None
1 + 1 1 + 1
this is it this.is.it
GoGaRuCo rock: #hard GoGaRuCo.rock :hard
doc convertFrom: #xml to: #yaml doc.convert(:xml, :ruby)
doc convertFrom: #xml to: #yaml doc.convert from: :xml, to: :ruby
[ 42 ] proc { 42 }
anArray do: [ :each | each doSomething ] an_array.each do
|element| element.do_something end
Textmate version = 2 ifTrue: [ 'no way' ] ifFalse:
[ 'thought so' ] if Textmate.version == 2 "no way" else "thought so" end
Storage current store: #foo; store: #bar storage = Storage.current storage.store
:foo storage.store :bar
Smalltalk claims to look like: 'English'. Judge yourself. Does it.
Ruby.claims.to.look. like "English" Judge.yourself; Does.it?
Reak github.com/rkh/Reak Like Squeak but with R File based (as
opposed to image based)
None
The Rubinius Compiler Pure Ruby Modular and Flexible lib/compiler
None
Parsing with KPeg github.com/evanphx/kpeg
" from Reak.AST.Self " grammar: g [ ^ g str:
'self' ] # from Reak::AST::Return def bootstrap_grammar(g) g.seq "^", :sp, g.t(:expression) end
Rubinius Bytecode
$ rbx compile -B -e 'puts "Hello World"' 0000: push_self
0001: push_literal "Hello World" 0003: allow_private 0004: send_stack :puts, 1
$ rbx compile -B -e 'puts "Hello World"' 0000: push_self
0001: push_literal "Hello World" 0003: allow_private 0004: send_stack :puts, 1
$ rbx compile -B -e 'puts "Hello World"' 0000: push_self
0001: push_literal "Hello World" 0003: allow_private 0004: send_stack :puts, 1
$ rbx compile -B -e 'puts "Hello World"' 0000: push_self
0001: push_literal "Hello World" 0003: allow_private 0004: send_stack :puts, 1
$ rbx compile -B -e 'puts "Hello World"' 0000: push_self
0001: push_literal "Hello World" 0003: allow_private 0004: send_stack :puts, 1
class Object dynamic_method(:display) do |g| g.push_self g.push_local(0) # first argument
g.send(:puts, 1, true) g.ret end end display "Hello World"
Reusing the Rubinius tool chain
None
class Reak::Compiler < Rubinius::Compiler class Parser < Stage stage :parser
next_stage Generator end end
class CustomNode < Reak::AST::Base def self.bootstrap_grammar(g) # grammar definition end
def bytecode(g) # bytecode definition end end
class ConstantAccess < Rubinius::AST::ConstantAccess include Reak::AST::Node Reak::AST::Primary.push self def self.bootstrap_grammar(g)
g.t /[A-Z][a-zA-Z0-9_]*/ end # no bytecode definition necessary end
Rubinius.AST.TrueLiteral subclass: #TrueLiteral [ Reak.AST.Primary push: self. self include: Reak.AST.Node.
self class >> grammar: g [ ^ g str: 'true' ]. ]
" Remember cascades? " g pushSelf; pushLocal: 0; send: #puts
args: 1 private: true; ret.
Reak.AST.Base subclass: #Cascade [ Reak.AST.Expression push: self. bytecode: g [
g pushSelf. cascadedSends do: [:send | g dup. send bytecode: g. g pop ]. lastSend bytecode: g. ] ]
Thanks! github.com / rkh / presentations