the infamous hello world program
TRANSCRIPT
The Infamous Hello World Program.
@okashoi
美しいコードを書くこと
プログラマにとっての夢
そんな皆さんに
今日ご紹介するのは
The Shakespeare
Programming Language (SPL)
例えば Hello World
※公式サイト より一部抜粋
美しい。
今宵、
美しき Shakespeare の世界
に あなたをご招待します。
SPL の綴り方 I. Title
最初に出現するピリオドまでが
Title になる
これ。
Title は美学的な役割のみを果たす。
(パーサから見たらコメントに過ぎない)
The title serves only aesthetic purposes. From the
parser's point of view, it's a comment.
(公式サイトより抜粋)
改行・空白の挿入は自由。
ただしインデントは趣き深く行うことが
公式で推奨されている。
You're generally free to insert space and newlines
wherever you want in the code, but we urge you to
please indent tastefully.(公式サイトより抜粋)
SPL の綴り方 II. Dramatis Personae
ここ。
「登場人物名 , 特徴」の形で記述してゆく。
(特徴はパーサによって無視される)
登場人物とはつまり変数であり、
すべて signed int 型として扱われる。
登場人物名は実際の Shakespeare 作品に
登場する人物名でなければならない。
SPL の綴り方 III. Constants
あらゆる名詞が 1 又は -1 の値を持つ。
どちらを取るかは、その名詞が
良いものかどうかによって決まる。
例) “flower” は良いものだから 1
“pig” は汚いから -1
(※中性のもの “tree” などは 1)
名詞に形容詞が付くと 2 が掛けられる。
複数付けばその分だけ掛けられる。
“sum of X and Y” などの基本的な計算を使って
任意の整数を容易に作り出せる。
例)“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”
my little pony = 2
your big hairy hound = 4
your sorry little codpiece = -4
“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
“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 と等し
い。
このようにして、他のプログラミング言語にない
詩的な自由を与えてくれる言語、それが SPL 。
As you see, this way of writing constants gives you
much more poetic freedom than in other
programming languages.(公式サイトより抜粋)
公式サイト
http://shakespearelang.sourceforge.net/
和訳参考
http://kara.ifdef.jp/program/spl/spl01.html
是非、あなたも SPL の世界へ。