The Infamous Hello World Program

26
The Infamous Hello World Program. @okashoi

Transcript of The Infamous Hello World Program

Page 1: The Infamous Hello World Program

The Infamous Hello World Program.

@okashoi

Page 2: The Infamous Hello World Program

美しいコードを書くこと

プログラマにとっての夢

Page 3: The Infamous Hello World Program

そんな皆さんに

今日ご紹介するのは

Page 4: The Infamous Hello World Program

The Shakespeare

Programming Language (SPL)

Page 5: The Infamous Hello World Program

例えば Hello World

Page 6: The Infamous Hello World Program

※公式サイト より一部抜粋

Page 7: The Infamous Hello World Program

美しい。

Page 8: The Infamous Hello World Program

今宵、

美しき Shakespeare の世界

に あなたをご招待します。

Page 9: The Infamous Hello World Program

SPL の綴り方 I. Title

Page 10: The Infamous Hello World Program

最初に出現するピリオドまでが

Title になる

Page 11: The Infamous Hello World Program

これ。

Page 12: The Infamous Hello World Program

Title は美学的な役割のみを果たす。

(パーサから見たらコメントに過ぎない)

The title serves only aesthetic purposes. From the

parser's point of view, it's a comment.

(公式サイトより抜粋)

Page 13: The Infamous Hello World Program

改行・空白の挿入は自由。

ただしインデントは趣き深く行うことが

公式で推奨されている。

You're generally free to insert space and newlines

wherever you want in the code, but we urge you to

please indent tastefully.(公式サイトより抜粋)

Page 14: The Infamous Hello World Program

SPL の綴り方 II. Dramatis Personae

Page 15: The Infamous Hello World Program

ここ。

Page 16: The Infamous Hello World Program

「登場人物名 , 特徴」の形で記述してゆく。

(特徴はパーサによって無視される)

登場人物とはつまり変数であり、

すべて signed int 型として扱われる。

Page 17: The Infamous Hello World Program

登場人物名は実際の Shakespeare 作品に

登場する人物名でなければならない。

Page 18: The Infamous Hello World Program

SPL の綴り方 III. Constants

Page 19: The Infamous Hello World Program

あらゆる名詞が 1 又は -1 の値を持つ。

どちらを取るかは、その名詞が

良いものかどうかによって決まる。

例) “flower” は良いものだから 1

“pig” は汚いから -1

(※中性のもの “tree” などは 1)

Page 20: The Infamous Hello World Program

名詞に形容詞が付くと 2 が掛けられる。

複数付けばその分だけ掛けられる。

“sum of X and Y” などの基本的な計算を使って

任意の整数を容易に作り出せる。

Page 21: The Infamous Hello World Program

例)“the difference between the square of the

difference between my little pony and your big

hairy hound and the cube of your sorry little

codpiece”

Page 22: The Infamous Hello World Program

my little pony = 2

your big hairy hound = 4

your sorry little codpiece = -4

Page 23: The Infamous Hello World Program

“the difference between the square of the difference

between 2 and 4 and the cube of -4”

つまり

(2 - 4)2 - (-4)3 = 4 - (-64) = 60

Page 24: The Infamous Hello World Program

“the difference between the square of the difference

between my little pony and your big hairy hound and

the cube of your sorry little codpiece” は 60 と等し

い。

Page 25: The Infamous Hello World Program

このようにして、他のプログラミング言語にない

詩的な自由を与えてくれる言語、それが SPL 。

As you see, this way of writing constants gives you

much more poetic freedom than in other

programming languages.(公式サイトより抜粋)

Page 26: The Infamous Hello World Program

公式サイト

http://shakespearelang.sourceforge.net/

和訳参考

http://kara.ifdef.jp/program/spl/spl01.html

是非、あなたも SPL の世界へ。