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
DSL - Domain Specific Languages
Search
Jean Carlo Emer
March 05, 2012
Programming
2
380
DSL - Domain Specific Languages
Gerenciamento de métodos, operadores e ações para construção de linguagens no escopo do programa.
Jean Carlo Emer
March 05, 2012
Tweet
Share
More Decks by Jean Carlo Emer
See All by Jean Carlo Emer
Web & Mobile
jcemer
1
170
Thinking metrics on React apps
jcemer
0
150
Cache em aplicações web
jcemer
0
270
Aplicações Web - um estudo sobre React
jcemer
1
180
Lapidando o Globo Play
jcemer
1
240
Desenvolvedor mobile precisa aprender Web
jcemer
1
100
Evolução e futuro do uso de paradigmas no JavaScript
jcemer
3
600
Tudo o que a web (podia ser) ainda será
jcemer
8
590
Embarque App
jcemer
0
470
Other Decks in Programming
See All in Programming
Sharing features among Android applications: experience feedback
jbvincey
0
110
Thank you <💅>, What's the Next?
ahoxa
1
470
Vibe Codingをせずに Clineを使っている
watany
17
6.3k
新しいPHP拡張モジュールインストール方法「PHP Installer for Extensions (PIE)」を使ってみよう!
cocoeyes02
0
400
gen_statem - OTP's Unsung Hero
whatyouhide
1
210
Exit 8 for SwiftUI
ojun9
0
130
[NG India] Event-Based State Management with NgRx SignalStore
markostanimirovic
1
160
ComposeでWebアプリを作る技術
tbsten
0
110
スモールスタートで始めるためのLambda×モノリス(Lambdalith)
akihisaikeda
2
290
Strategic Design (DDD)for the Frontend @DDD Meetup Stuttgart
manfredsteyer
PRO
0
160
プロダクト横断分析に役立つ、事前集計しないサマリーテーブル設計
hanon52_
2
450
リストビュー画面UX改善の振り返り
splcywolf
0
140
Featured
See All Featured
Statistics for Hackers
jakevdp
798
220k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
13
1.4k
Making the Leap to Tech Lead
cromwellryan
133
9.2k
Docker and Python
trallard
44
3.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
23
2.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Speed Design
sergeychernyshev
29
900
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
30k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Transcript
DSL Domain Specific Languages Jean Carlo Emer
Linguagem que se presta a resolver um problema específico.
Muitas já não são? Ruby, PHP, JavaScript, XSL, PostScript, Emacs
Lisp...
1.Invente uma sintaxe DSL e construa um interpretador ou compilador.
2.Molde uma linguagem existente adicionando ou alterand o métodos, operadores, e ações padrões.
LISP "permite criar" DSL Construção da linguagem no escopo do
programa.
with Employee "123-45-6789" do salary -1000 warn :misconduct end
• 100% objetos / não, não é a OO de
Java • 100% aberto / DSL? • Indicadores de Métodos / ? ! = []= • Parênteses podem ser omitidos
• Numeric 1, 2, 3.1 • String "String" • Symbol
:Symbol • Array [1, 'string', 3, [], {}, "oi"] • Hash {'tabela' => 'valor'} • Regexp /regexp/
class Pessoa attr_reader :nome, :idade def initialize(nome, idade) @nome, @idade
= nome, idade end end
class Pessoa def >(pessoa) self.idade > pessoa.idade end end puts
Pessoa.new("-", 22) > Pessoa.new("--", 44)
4.months + 3.weeks + 2.days
4.months() + 3.weeks() + 2.days()
4.months()+(3.weeks()+(2.days())) Faz sentido? A propósito, é nome de filme, assistam!
class Fixnum def impar? self%2 == 1 end end 0.impar?
class Tabuleiro def [](lin, col) col *= 2 (@linhas[lin] &
(Peca::Qualquer << col)) >> col end end t[0,1] = Peca::Branca
class Pessoa def method_missing(m, *args, &block) puts "Ninguém chamado #{m}
por aqui " end end Pessoa.new.jeancarloemer @variable ||= "valor padrão"
class String def *(s) ... end end "a" * "ba"
Já existe "a"*3 que resulta em "aaa"
Fim!
[email protected]
inf.ufrgs.br/~jcemer @jcemer