Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
160
Cache em aplicações web
jcemer
0
290
Aplicações Web - um estudo sobre React
jcemer
1
190
Lapidando o Globo Play
jcemer
1
260
Desenvolvedor mobile precisa aprender Web
jcemer
1
110
Evolução e futuro do uso de paradigmas no JavaScript
jcemer
3
610
Tudo o que a web (podia ser) ainda será
jcemer
8
620
Embarque App
jcemer
0
480
Other Decks in Programming
See All in Programming
開発に寄りそう自動テストの実現
goyoki
1
490
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
19k
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
930
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
160
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
25
21k
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
2.9k
無秩序からの脱却 / Emergence from chaos
nrslib
2
12k
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
5
270
Developing static sites with Ruby
okuramasafumi
0
160
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
240
社内オペレーション改善のためのTypeScript / TSKaigi Hokuriku 2025
dachi023
1
510
NUMA環境とコンテナランタイム ― youki における Linux Memory Policy 実装
n4mlz
1
110
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Into the Great Unknown - MozCon
thekraken
40
2.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
How GitHub (no longer) Works
holman
316
140k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
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