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
190
Thinking metrics on React apps
jcemer
0
170
Cache em aplicações web
jcemer
0
300
Aplicações Web - um estudo sobre React
jcemer
1
190
Lapidando o Globo Play
jcemer
1
260
Desenvolvedor mobile precisa aprender Web
jcemer
1
120
Evolução e futuro do uso de paradigmas no JavaScript
jcemer
3
610
Tudo o que a web (podia ser) ainda será
jcemer
8
630
Embarque App
jcemer
0
490
Other Decks in Programming
See All in Programming
CSC307 Lecture 04
javiergs
PRO
0
630
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
160
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
150
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
140
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
640
ThorVG Viewer In VS Code
nors
0
670
チームをチームにするEM
hitode909
0
450
Deno Tunnel を使ってみた話
kamekyame
0
320
Cap'n Webについて
yusukebe
0
160
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
180
ゆくKotlin くるRust
exoego
1
200
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Ruling the World: When Life Gets Gamed
codingconduct
0
120
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
270
Thoughts on Productivity
jonyablonski
74
5k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
200
GitHub's CSS Performance
jonrohan
1032
470k
Exploring anti-patterns in Rails
aemeredith
2
230
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
55
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.9k
Writing Fast Ruby
sferik
630
62k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
41
Building Adaptive Systems
keathley
44
2.9k
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