The beast of halfpace

日々のメモ

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  118  : 記事  0  : コメント  427  : トラックバック  35

ニュース

Mozilla Firefox ブラウザ無料ダウンロード


記事カテゴリ

書庫

日記カテゴリ

わんくま名古屋勉強会のLTあおいたんが紹介していたShapespeareHello Worldがさっぱり理解できなかったので、ココにあるHello Worldの解説を読んでいたときの脳内思考を含めた超意訳。

途中から機械翻訳の出したわからない日本語を「こぉかなぁ?」と想像して書いたので結果部分以外はそーとー怪しいです。

Shakespeareなどという誰も使いそうにない言語なので誤訳があっても迷惑をかける可能性が低い事が幸いw

?

?

Title(タイトル)

タイトル部の説明。最初の1行(最初のピリオドまで)はタイトルだそうな。

The first line of every SPL program is the title.…

んで、タイトルは何かというとこの章の最後にこんな一文。

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

パーサーから見ればコメントだって。

よってこの章の訳は不要とみなす。

?

Dramatis Personae(登場人物)

The next few lines are a list of all characters in the play.

続く数行はこの演目での全登場人物のリスト。

Think of them as variables, capable of holding a signed integer value. You must declare every character you intend to use, or the program won't compile.

彼らは符号付整数を保持できる変数だと思ってね。あなたが彼らを使うつもりなら必ず宣言してね。じゃないとコンパイルされませんよ。

登場人物が変数だそうな。符号付整数しか扱えなさそうね。

?

んで、やる気が失せるのがこの一文。

you must use a real Shakespeare character name, such as Romeo, Juliet, or the Ghost (Hamlet's deceased father).

シェークスピアの実在の登場人物を使わないとダメよ。例えばロミオ、ジュリエットとかゴースト(ハムレットの実父)

ゴーストの説明なんぞどうでもいいわ!と思える。

実際、

Andochin, a middle age programmer.

と入れたらコンパイルエラーだけど

Othello, one of the products of Tsukuda Original.

ならコンパイル通った。

?

Acts and Schenes (幕とシーン)

The purpose of acts and scenes is to divide the play into smaller parts.

この部分は以下のように単語を読み替えると「Cやね」と納得できるのでShakespeareの出力コードを想像したのだが

act -> source code

scene -> function

The purpose of source files and functions is to divide the program into smaller parts.

んが、Shakespeareはそんなに甘くなかった。

spl->cではそんな風に分割されない。それらは全て以下のようなgotoのラベルになりmainの中に記述される

この記述

Act II: Behind Hamlet's back.

Scene I: Romeo and Juliet's conversation.

がこんな風になる。

act_ii: /* Behind Hamlet ' s back */

act_ii_scene_i: /* Romeo and Juliet ' s conversation */

そしてsplの記述を見てもわかる通りの下記記述。

Acts and scenes are numbered with roman numerals.

幕とシーンはローマ数字にしてね。

この時点で○○○○?と思える。

?

Enter, Exit and Exeunt(登場、退場)

To be able to speak their lines, characters must be on stage. The character they address as "you" (or "thou" or any other second-person pronoun) must also be on stage. But if there is yet another character on stage, it's not clear which one is intended. This is frowned upon by the parser.

キャラクタがセリフをしゃべる為にはステージ上にいなければなりません。そのキャラクタが"you"(もしくは"thou"もしくは他の2人称を指す代名詞)と指す者もステージ上にいなければなりません。しかし、更にもう一人のキャラクタがステージ上にいる場合誰を指すかが不明確です。これはパーサーの顰蹙を買います。

Enter Enter and Exit. These directives cause characters to get on and off stage."Enter" is followed by a list of one or more characters. "Exit" is followed by exactly one character. The plural of Exit is "Exeunt", which is followed by a list of at least two characters - or none, in which case everyone leaves.

EnterとExitを記述せよ(Enter Enter and Exit)。これらの指示によりキャラクタはステージへの登場・退場を行います。"Enter"には1つ以上のキャラクタのリストが続きます。"Exit"には正しく一人のキャラクタが続きます。"Exit"の複数形は"Exeunt"です。これには少なくとも2人のキャラクタが続きます。もしキャラクタがなければ全員退場します。

※Enter Enter and Exitの訳は刈歩さんに教えてもらいました

An Enter directive given to a character already on stage, or the other way around, will cause a runtime error.

ステージ上に既にいるキャラクタへの"Enter"もしくはその逆は実行時エラーを引き起こすでしょう。

?

Lines (台詞)

A line consists of the name of a character, a colon, and one or more sentences. In the Hello World program, only two kinds of sentences are used: output, which causes output to the screen, and statements, which cause the second person to assume a certain value.

台詞はキャラクタの名前、コロンと1つ以上の文から成り立ちます。"Hello World"プログラムは、2つの文しか使用されていません。スクリーンへ出力するoutputと2番目の人に値を思い込ませる命令文(statements)です。

?

"second person"2人称の意味だから恐らく舞台上の相手を意味しているんじゃないかな?と思ったけど、それもしっくりこない。この時点でもう気力なし。

?

Constants (定数)

First, we'll explain how constants (that is, constant numbers, such as 17 and 4711) are expressed. Any noun is a constant with the value 1 or -1, depending on whether it's nice or not. For example, "flower" has the value 1 because flowers are nice, but "pig" has the value -1 because pigs are dirty (which doesn't prevent most people from eating them). Neutral nouns, such as "tree", count as 1 as well.

まず、どのように定数が定義されるかを説明します。 名詞はそれが良いか悪いかに依存して1-1になります。例えば"flower"1を持ちます。なぜならお花はナイスだからです。しかし、"pig"-1を持ちます。なぜならブタさんはばっちいからです。""のような中立名詞は1をもちます。

# ブタさん好きが聞いたら怒り出しそうな理由。

By prefixing a noun with an adjective, you multiply it by two. Another adjective, and it is multiplied by two again, and so on. That way, you can easily construct any power of two or its negation. From there, it's easy to construct arbitrary integers using basic arithmetic, such as "the sum of X and Y", where X and Y are themselves arbitrary integers.

形容詞を名詞の前に付けることで2倍することが出来、もう一つ形容詞をつけるとその値が更に2倍されていきます。従って容易に任意の値の2乗もしくはその値の負数を構築できます。そこから、基本的な数式を使用して整数値を構築できます。例えばXYが任意の整数である場合に"the sum of X and Y"(XYの和)の様にです。

?

こっから下の例文は原文をぶった切りながら

For example, "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".Substituting the simple constants with numbers,

例えば、"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"は簡単な定数値に置換されます。

little pony (ちっちゃなポニー) = 2

big hairy hound (でっかいけむくじゃらの猟犬) = 4

sorry little codpiece (かわいそうなちっちゃい股袋ン?) = -4

# 訳のミスの可能性高いけど下ネタ?

"the difference between the square of the difference between 2 and 4 and the cube of -4".

これで3つの数値が出てきた。

Now, since the difference between 2 and 4 is 2 - 4 = -2, and the cube of -4 is (-4)3 = -64, this is equal to "the difference between the square of -2 and -64". The square of -2 is (-2)2 = 4, and the difference of 4 and -64 is 60. Thus, "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" means 60.

ちっちゃい数字はn

で、今までのことから

"difference between 2 and 4" = -2

"cube of -4" = -64

になるので、文は以下のようになる。

"The difference between the square of -2 and 64".

んで、

"square of -2" = 4

になるので、全文はこうなる。

"The difference between 4 and -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を意味する。

?

As you see, this way of writing constants gives you much more poetic freedom than in other programming languages.

ご覧の通りこのような定数値の記述は古いコンピュータ言語以上に詩的な自由度をあなたに与えます。

って

ここまで読んで読む気が失せた

?

Assignment of Values(値の割り当て)

Now, how do we use those numbers? Well, just have a look at the two statements "You lying stupid fatherless big smelly half-witted coward!" and "You are as stupid as the difference between a handsome rich brave hero and thyself!"

さて、どのように私たちはそれらの値を使うのでしょうか?次の2つの文を見てください。
"You lying stupid fatherless big smelly half-witted coward!"
"You are as stupid as the difference between a handsome rich brave hero and thyself!"

The first one is simple: A second person pronoun, followed by a number. The effect of this statement is to assign the value of that number (in this case, -64) to the character being spoken to. Think "X=-64".

最初の文は簡単です。二人称代名詞に数値が続いています。この文の効果はその値(この場合なら-64)を話をされている人物に割り当てます。"X=-64"と考える

多分2*2*2*2*2*2*-1って事ね

The second one is slightly more complicated. For starters, what is the value of "thyself"? That's not a noun, that's a reflexive pronoun. It's value is the current value of the character being spoken to. So the number in the second statement is 8 - X, where X is the value of the character being spoken to. And just as you might expect from your experience with English, the second statement is just another assignment. Think "X = 8 - X". Being "as bas as", "as good as", or as [any adjective] as something else, means being equal to that something.

2番目の文はやや複雑です。手始めに、自身の値は何でしょう?それは名刺ではなく再帰代名詞です。それは値が話されているキャラクタの現在の値であるということです。従って2番目の文の中の数値は8-Xです。そしてそこでXはキャラクタに話された値です。それと同時にあなたがあなたの英語の経験から期待する通りに2番目の文はもうひとつの割り当てにすぎません。"X = 8 - X"と考える。"as bas as","as good as"もしくはas [何らかの形容詞] as [何か他の物]が[何か]と等しいことを意味するように。

ここは機械翻訳もいい訳を出してくれなかった

?

ふへぇ。疲れた

?

しかし、最後の章を訳していなかった事に翌日気付いた。

Output(出力)

The other kind of sentence used in the Hello World program is output.There are two different output sentences, "Open your heart" and "Speak your mind". The first causes the character being spoken to to output her or his value in numerical form, and the other, being more literal, outputs the corresponding letter, digit, or other character, according to the character set being used by your computer.

Hello Worldプログラムで使用された別の種類のセンテンスは出力(output)です。出力には2種類のセンテンスがあります。"Open your heart"と"Speak your mind"です。最初のセンテンスはキャラクタが自身の値を数値形式で出力します。もうひとつのセンテンスはあなたの使用するコンピュータのキャラクタセットに従い文字、数字もしくは他のキャラクタで出力します。

In this program, we use only the second form. The whole program is a long sequence of constructing a number, writing the corresponding character, constructing the next number, writing the corresponding character, and so on.

Hello Worldプログラムでは2番目のセンテンスしか使用していません。プログラム全体は数値を構築し、対応するキャラクタを書き出し次の数値を構築し対応するキャラクタを書の書き出す…が続く長い文です。

?

?

?

投稿日時 : 2008年10月28日 0:28

コメント

# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/28 1:24 アキラ
翻訳お疲れさまです(^^;

Shakespeare Programming Languageかー。
あとで調べてみよう

# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/28 1:31 アキラ
Hello World長っw
http://kara.ifdef.jp/program/spl/spl01.html

# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/28 21:32 あんどちん
すごいっしょ?見つけてきたあおいたんも凄いと思うけど何よりこんな言語を作ったこととその言語規則の変体っプリ。
Cに落ちたコードもステキですよ



# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/30 10:11 刈歩 菜良 CTP
面白いけど、全部読み切れません。
ヾ(>y<;)ノうわぁぁ

とりあえず、登場、退場まで読んでみた。
で、ちょいと疑問。

Enter Enter and Exit.

EnterとExitを入力しなさい。
だとおもう。

いわゆる英語のダジャレ的なものかと...

続きはまた空いた時間に読みますね。

# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/30 10:20 刈歩 菜良 CTP
あ、原文に注釈があったよ。
http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html#tex2html5

If you don't get the joke, you can mail the authors and ask.

やっぱダジャレだったんだ...

# re: ShakespeareのHello Worldの説明を読んでみた 2008/10/30 23:02 あんどちん
引用前後します

> If you don't get the joke, you can mail the authors and ask.
これは読んでたのでジョークなんだろうなとは思ってたんですが、

> EnterとExitを入力しなさい。
> だとおもう。
Enter and Exit = 「登場、退場」もしくは「出入口」と判断して
出入り口に入るだと思ってました。Enterを入力と訳すところまで考えが回らなくて…

上記の通りメールして聞けば良かったんですねw


Post Feedback

タイトル
名前
Url:
コメント: