SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
@yuya_takeyama
Domain Specific
    Languages
    (Martin Fowler)
[
	 	 "foo",
	 	 "bar",
	 	 "hoge"	 =>	 "piyo"
]
array(3)	 {
	 	 [0]=>
	 	 string(3)	 "foo"
	 	 [1]=>
	 	 string(3)	 "bar"
	 	 ["hoge"]=>
	 	 string(4)	 "piyo"
}
public	 $id	 =	 array(
	 	 'type'	 	 	 	 =>	 'int',
	 	 'primary'	 =>	 true,	 
	 	 'serial'	 	 =>	 true
);
public	 $name	 =	 array(
	 	 'type'	 	 	 	 	 =>'string',
	 	 'required'	 =>	 true,
	 	 'unique'	 	 	 =>	 true
);
public	 $birthday	 =	 array(
	 	 'type'	 =>	 'date');
public	 $id	 =	 [
	 	 'int',
	 	 'primary'	 =>	 true,	 
	 	 'serial'	 	 =>	 true
];
public	 $name	 =	 [
	 	 'string',
	 	 'required'	 =>	 true,
	 	 'unique'	 	 	 =>	 true
];
public	 $birthday	 =	 ['date'];
['begin',
	 	 ['define',
	 	 	 	 'fib',
	 	 	 	 ['lambda',
	 	 	 	 	 	 ['x'],
	 	 	 	 	 	 ['if',
	 	 	 	 	 	 	 	 ['<',	 ':x',	 2],
	 	 	 	 	 	 	 	 ':x',
	 	 	 	 	 	 	 	 ['+',
	 	 	 	 	 	 	 	 	 	 ['fib',	 ['-',	 ':x',	 2]],
	 	 	 	 	 	 	 	 	 	 ['fib',	 ['-',	 ':x',	 1]]]]]],
	 	 ['print',	 'fib(10)	 =	 '],
	 	 ['println',	 ['fib',	 10]]]
	 	 =>	 fib(10)	 =	 55
Making DSL with []

Contenu connexe

Plus de Yuya Takeyama

5分でわかる? 関数型 PHP の潮流
5分でわかる? 関数型 PHP の潮流5分でわかる? 関数型 PHP の潮流
5分でわかる? 関数型 PHP の潮流Yuya Takeyama
 
Good Parts of PHP and the UNIX Philosophy
Good Parts of PHP and the UNIX PhilosophyGood Parts of PHP and the UNIX Philosophy
Good Parts of PHP and the UNIX PhilosophyYuya Takeyama
 
Reactor Pattern and React
Reactor Pattern and ReactReactor Pattern and React
Reactor Pattern and ReactYuya Takeyama
 
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)Yuya Takeyama
 
PHP と MySQL でカジュアルに MapReduce する (Short Version)
PHP と MySQL でカジュアルに MapReduce する (Short Version)PHP と MySQL でカジュアルに MapReduce する (Short Version)
PHP と MySQL でカジュアルに MapReduce する (Short Version)Yuya Takeyama
 
PHP と MySQL でカジュアルに MapReduce する
PHP と MySQL でカジュアルに MapReduce するPHP と MySQL でカジュアルに MapReduce する
PHP と MySQL でカジュアルに MapReduce するYuya Takeyama
 
PHPUnit でテスト駆動開発を始めよう
PHPUnit でテスト駆動開発を始めようPHPUnit でテスト駆動開発を始めよう
PHPUnit でテスト駆動開発を始めようYuya Takeyama
 
MySQL 入門的なはなし
MySQL 入門的なはなしMySQL 入門的なはなし
MySQL 入門的なはなしYuya Takeyama
 
HashTable と HashDos
HashTable と HashDosHashTable と HashDos
HashTable と HashDosYuya Takeyama
 
Proposal for xSpep BDD Framework for PHP
Proposal for xSpep BDD Framework for PHPProposal for xSpep BDD Framework for PHP
Proposal for xSpep BDD Framework for PHPYuya Takeyama
 
Building Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenvBuilding Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenvYuya Takeyama
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにYuya Takeyama
 
LIMIT 付きで UPDATE を行うと何故怒られるか
LIMIT 付きで UPDATE を行うと何故怒られるかLIMIT 付きで UPDATE を行うと何故怒られるか
LIMIT 付きで UPDATE を行うと何故怒られるかYuya Takeyama
 
Ruby 同好会宣言
Ruby 同好会宣言Ruby 同好会宣言
Ruby 同好会宣言Yuya Takeyama
 
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)Yuya Takeyama
 

Plus de Yuya Takeyama (16)

5分でわかる? 関数型 PHP の潮流
5分でわかる? 関数型 PHP の潮流5分でわかる? 関数型 PHP の潮流
5分でわかる? 関数型 PHP の潮流
 
Good Parts of PHP and the UNIX Philosophy
Good Parts of PHP and the UNIX PhilosophyGood Parts of PHP and the UNIX Philosophy
Good Parts of PHP and the UNIX Philosophy
 
Reactor Pattern and React
Reactor Pattern and ReactReactor Pattern and React
Reactor Pattern and React
 
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)
PHP と MySQL で 1 カチャカチャカチャ...ッターン! MapReduce (@ニコニコ超会議)
 
PHP と MySQL でカジュアルに MapReduce する (Short Version)
PHP と MySQL でカジュアルに MapReduce する (Short Version)PHP と MySQL でカジュアルに MapReduce する (Short Version)
PHP と MySQL でカジュアルに MapReduce する (Short Version)
 
PHP と MySQL でカジュアルに MapReduce する
PHP と MySQL でカジュアルに MapReduce するPHP と MySQL でカジュアルに MapReduce する
PHP と MySQL でカジュアルに MapReduce する
 
PHPUnit でテスト駆動開発を始めよう
PHPUnit でテスト駆動開発を始めようPHPUnit でテスト駆動開発を始めよう
PHPUnit でテスト駆動開発を始めよう
 
MySQL 入門的なはなし
MySQL 入門的なはなしMySQL 入門的なはなし
MySQL 入門的なはなし
 
HashTable と HashDos
HashTable と HashDosHashTable と HashDos
HashTable と HashDos
 
Proposal for xSpep BDD Framework for PHP
Proposal for xSpep BDD Framework for PHPProposal for xSpep BDD Framework for PHP
Proposal for xSpep BDD Framework for PHP
 
Building Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenvBuilding Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenv
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
 
LIMIT 付きで UPDATE を行うと何故怒られるか
LIMIT 付きで UPDATE を行うと何故怒られるかLIMIT 付きで UPDATE を行うと何故怒られるか
LIMIT 付きで UPDATE を行うと何故怒られるか
 
GOOS #1
GOOS #1GOOS #1
GOOS #1
 
Ruby 同好会宣言
Ruby 同好会宣言Ruby 同好会宣言
Ruby 同好会宣言
 
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)
第一回 社内勉強会 PHP Application Security Checklist に学ぶ PHP セキュリティ (Excerpt)
 

Making DSL with []

  • 2.
  • 3.
  • 4.
  • 5. Domain Specific Languages (Martin Fowler)
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. [ "foo", "bar", "hoge" => "piyo" ]
  • 18. array(3) { [0]=> string(3) "foo" [1]=> string(3) "bar" ["hoge"]=> string(4) "piyo" }
  • 19.
  • 20.
  • 21. public $id = array( 'type' => 'int', 'primary' => true, 'serial' => true ); public $name = array( 'type' =>'string', 'required' => true, 'unique' => true ); public $birthday = array( 'type' => 'date');
  • 22. public $id = [ 'int', 'primary' => true, 'serial' => true ]; public $name = [ 'string', 'required' => true, 'unique' => true ]; public $birthday = ['date'];
  • 23.
  • 24.
  • 25. ['begin', ['define', 'fib', ['lambda', ['x'], ['if', ['<', ':x', 2], ':x', ['+', ['fib', ['-', ':x', 2]], ['fib', ['-', ':x', 1]]]]]], ['print', 'fib(10) = '], ['println', ['fib', 10]]] => fib(10) = 55