|
1 |
| -# 暴風型言語 Typhon |
| 1 | +# Typhon is Typhoon Language |
2 | 2 | - Esoteric Language
|
3 |
| - - Rubyで作る奇妙なプログラム言語を見て作成 |
4 |
| -## Pythonのアナグラム |
5 |
| - - でもRubyでできている。 |
6 |
| -### いつの日かPythonに移動させまふ |
7 |
| -# コンセプト |
8 |
| - - 9年ぶりに沖縄に台風が直撃した記念 |
9 |
| - - 台風っぽい文字(@とa)で記述するプログラム言語 |
10 |
| - - WhiteSpaceの処理系(スタック型言語) |
11 |
| -## サンプルプログラム |
| 3 | + - Making via "Rubyで作る奇妙なプログラム言語" |
| 4 | +## Anagram of Python |
| 5 | + - But...Create of Ruby... |
| 6 | +### One day I remake to Python. |
| 7 | +# Concept of Typhon |
| 8 | + - Typhoon came to Okinawa in Japan after so long. |
| 9 | + - "@" seems like Typoon clouds. |
| 10 | + - Typhon is based on WhiteSpace (such as stack model language) |
| 11 | +## Typhon examples |
12 | 12 | aaa@aa@aaa
|
13 | 13 | @ aaaaa@@a@aa@
|
14 | 14 | @ aa
|
15 |
| -## 実行結果 |
| 15 | +## execution result |
16 | 16 | Hi
|
17 | 17 | # USAGE
|
18 | 18 | > ruby bin/typhon examples/hi.ty
|
19 | 19 |
|
20 | 20 | ## 文法
|
21 |
| -※ \_はスペース |
| 21 | +※ \_is Space |
22 | 22 |
|
23 |
| -Typhon|中間言語|説明 |
| 23 | +Typhon|Middle language|explain |
24 | 24 | -|-|-
|
25 |
| -aa#{NUM}|pushNUM|スタックに積む |
26 |
| -a\_a|dup|スタックの一番上を複製 |
27 |
| -a@a#{NUM}|copyNUM|コピー |
28 |
| -a\_@|swap|入れ替え |
29 |
| -a\_\_|discard|捨てる |
30 |
| -a@\_#{NUM}|slide|捨てる |
31 |
| -@aaa|add|足し算 |
32 |
| -@aa@|sub|引き算 |
33 |
| -@aa\_|mul|掛け算 |
34 |
| -@a@a|div|割り算 |
35 |
| -@a@@|mod|余剰 |
36 |
| -@@\_\_|heap\_write|ヒープに書き込む |
37 |
| -@@@\_|heap\_read|ヒープから読みだす |
38 |
| -aa#{LABEL}|labelLABEL|ラベルを設定 |
39 |
| -a@#{LABEL}|callLABEL|サブルーチンを呼び出す |
40 |
| -a\_#{LABEL}|jumpLABEL|ジャンプする |
41 |
| -@a#{LABEL}|jump\_zeroLABEL|スタックの一番上が0ならジャンプする |
42 |
| -@@#{LABEL}|jump\_negativeLABEL|スタックの一番上が負ならジャンプする |
43 |
| -@\_|return|サブルーチンから戻る |
44 |
| -\_\_\_|exit|exit |
45 |
| -@\_aa|char\_out|文字出力 |
46 |
| -@\_a@|num\_out|数値出力 |
47 |
| -@\_@\_|char\_in|文字入力 |
48 |
| -@\_@@|num\_in|数値入力 |
| 25 | +aa#{NUM}|pushNUM|add to stack |
| 26 | +a\_a|dup|dup top of stack value |
| 27 | +a@a#{NUM}|copyNUM|copy stack value |
| 28 | +a\_@|swap|swap stack value |
| 29 | +a\_\_|discard|drop top of stack value |
| 30 | +a@\_#{NUM}|slide|drop stack value top to NUM |
| 31 | +@aaa|add|calcurate add |
| 32 | +@aa@|sub|calcurate sub |
| 33 | +@aa\_|mulcalucurate multi |
| 34 | +@a@a|div|calucurate div |
| 35 | +@a@@|mod|calucurate mod |
| 36 | +@@\_\_|heap\_write|write to heap |
| 37 | +@@@\_|heap\_read|read from heap |
| 38 | +aa#{LABEL}|labelLABEL|set to label |
| 39 | +a@#{LABEL}|callLABEL|call Subroutine |
| 40 | +a\_#{LABEL}|jumpLABEL|jump to label |
| 41 | +@a#{LABEL}|jump\_zeroLABEL|jump to label when top of stacks value is zero |
| 42 | +@@#{LABEL}|jump\_negativeLABEL|jump to label when top of stacks value is negative |
| 43 | +@\_|return|return to Subroutine |
| 44 | +\_\_\_|exit|exit program |
| 45 | +@\_aa|char\_out|output char to standard I/O |
| 46 | +@\_a@|num\_out|output number to standard I/O |
| 47 | +@\_@\_|char\_in|input char from standard I/O |
| 48 | +@\_@@|num\_in|input number from standard I/O |
49 | 49 |
|
50 |
| -### 数値の扱い |
51 |
| -数値は二進数で表現する. |
| 50 | +### Numbers are depiction of binary |
52 | 51 | e.g aa@a@ -> +0101 -> 5
|
53 | 52 | @@a@a -> -1010 -> -10
|
54 |
| -### ラベルの扱い |
55 |
| -ラベルも数値と同じようにあらわす |
| 53 | +### LABEL is same as number |
0 commit comments