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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jean Carlo Emer
March 05, 2012
Programming
2
390
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
200
Lapidando o Globo Play
jcemer
1
270
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
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
170
AtCoder Conference 2025
shindannin
0
1.1k
Data-Centric Kaggle
isax1015
2
770
今から始めるClaude Code超入門
448jp
8
8.7k
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
610
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
700
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
Implementation Patterns
denyspoltorak
0
290
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
350
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
Producing Creativity
orderedlist
PRO
348
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
We Have a Design System, Now What?
morganepeng
54
8k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Building Applications with DynamoDB
mza
96
6.9k
The Curse of the Amulet
leimatthew05
1
8.5k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
49
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