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
140
Cache em aplicações web
jcemer
0
270
Aplicações Web - um estudo sobre React
jcemer
1
170
Lapidando o Globo Play
jcemer
1
240
Desenvolvedor mobile precisa aprender Web
jcemer
1
96
Evolução e futuro do uso de paradigmas no JavaScript
jcemer
3
600
Tudo o que a web (podia ser) ainda será
jcemer
8
570
Embarque App
jcemer
0
470
Other Decks in Programming
See All in Programming
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
300
PEPCは何を変えようとしていたのか
ken7253
2
140
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
120
CDK開発におけるコーディング規約の運用
yamanashi_ren01
2
240
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
8
1.3k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
120
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
980
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
250
ソフトウェアエンジニアの成長
masuda220
PRO
12
2.1k
Rails アプリ地図考 Flush Cut
makicamel
1
130
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
910
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
210
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
570
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Visualization
eitanlees
146
15k
We Have a Design System, Now What?
morganepeng
51
7.4k
Done Done
chrislema
182
16k
The Cult of Friendly URLs
andyhume
78
6.2k
A designer walks into a library…
pauljervisheath
205
24k
Embracing the Ebb and Flow
colly
84
4.6k
Speed Design
sergeychernyshev
27
810
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
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! jeancarloemer@gmail.com inf.ufrgs.br/~jcemer @jcemer