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
180
Thinking metrics on React apps
jcemer
0
160
Cache em aplicações web
jcemer
0
280
Aplicações Web - um estudo sobre React
jcemer
1
180
Lapidando o Globo Play
jcemer
1
250
Desenvolvedor mobile precisa aprender Web
jcemer
1
110
Evolução e futuro do uso de paradigmas no JavaScript
jcemer
3
600
Tudo o que a web (podia ser) ainda será
jcemer
8
610
Embarque App
jcemer
0
470
Other Decks in Programming
See All in Programming
詳しくない分野でのVibe Codingで困ったことと学び/vibe-coding-in-unfamiliar-area
shibayu36
3
5.1k
Le côté obscur des IA génératives
pascallemerrer
0
150
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
260
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
520
monorepo の Go テストをはやくした〜い!~最小の依存解決への道のり~ / faster-testing-of-monorepos
convto
2
500
All About Angular's New Signal Forms
manfredsteyer
PRO
0
190
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
200
オープンソースソフトウェアへの解像度🔬
utam0k
16
3k
テーブル定義書の構造化抽出して、生成AIでDWH分析を試してみた / devio2025tokyo
kasacchiful
0
180
Software Architecture
hschwentner
6
2.3k
What's new in Spring Modulith?
olivergierke
1
160
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
5
2.2k
Featured
See All Featured
Scaling GitHub
holman
463
140k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
470
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Docker and Python
trallard
46
3.6k
It's Worth the Effort
3n
187
28k
Java REST API Framework Comparison - PWX 2021
mraible
34
8.9k
How to train your dragon (web standard)
notwaldorf
97
6.3k
How STYLIGHT went responsive
nonsquared
100
5.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Fireside Chat
paigeccino
40
3.7k
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