Check-in [f7e9e77316]
Not logged in
Overview
SHA1 Hash:f7e9e773169d8428df5d23b0fbf3e7a04bc8746b
Date: 2010-11-26 16:42:38
User: kinaba
Comment:introduced "..." expression, and replaced the pattern match failure with this.
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified doc/_common.html from [9340890a47c908ed] to [b9095bf676f7ac7c].

22 22 23 The list of modules globaly used inside Polemy.<br><br> 23 The list of modules globaly used inside Polemy.<br><br> 24 24 25 </td></tr> 25 </td></tr> 26 <tr><td id="docfooter"> 26 <tr><td id="docfooter"> 27 Page was generated with 27 Page was generated with 28 <img src="candydoc/img/candydoc.gif" style="vertical-ali 28 <img src="candydoc/img/candydoc.gif" style="vertical-ali 29 on Thu Nov 25 12:13:45 2010 | 29 on Fri Nov 26 16:41:43 2010 30 30 31 </td></tr> 31 </td></tr> 32 </table> 32 </table> 33 </div> 33 </div> 34 <script> 34 <script> 35 explorer.packageExplorer.addModule("index"); 35 explorer.packageExplorer.addModule("index"); 36 explorer.packageExplorer.addModule("main"); 36 explorer.packageExplorer.addModule("main");

Modified doc/ast.html from [378b6fe37d6f4ecd] to [7559b28d1aa75ece].

406 <dd><br><br> 406 <dd><br><br> 407 </dd> 407 </dd> 408 </dl> 408 </dl> 409 <script>explorer.outline.decSymbolLevel();</script> 409 <script>explorer.outline.decSymbolLevel();</script> 410 410 411 411 412 </dd> 412 </dd> > 413 > 414 <script>explorer.outline.writeEnabled = true;</script> > 415 <dt><span class="decl">class > 416 <span class="currsymbol">Die</span> > 417 <script>explorer.outline.addDecl('Die');</script> > 418 > 419 : polemy.ast.AST; > 420 </span></dt> > 421 <script>explorer.outline.writeEnabled = false;</script> > 422 > 423 > 424 <dd>AST node for deadend<br><br> > 425 > 426 </dd> 413 427 414 <script>explorer.outline.writeEnabled = true;</script> 428 <script>explorer.outline.writeEnabled = true;</script> 415 <dt><span class="decl">alias 429 <dt><span class="decl">alias 416 <span class="currsymbol">ListOfASTTypes</span> 430 <span class="currsymbol">ListOfASTTypes</span> 417 <script>explorer.outline.addDecl('ListOfASTTypes');</script> 431 <script>explorer.outline.addDecl('ListOfASTTypes');</script> 418 432 419 ; 433 ; ................................................................................................................................................................................ 550 (string <span class="funcparam">name</span>, string[] <span class="funcparam">la 564 (string <span class="funcparam">name</span>, string[] <span class="funcparam">la 551 </span></dt> 565 </span></dt> 552 <script>explorer.outline.writeEnabled = false;</script> 566 <script>explorer.outline.writeEnabled = false;</script> 553 567 554 568 555 <dd><br><br> 569 <dd><br><br> 556 </dd> 570 </dd> > 571 > 572 <script>explorer.outline.writeEnabled = true;</script> > 573 <dt><span class="decl">alias > 574 <span class="currsymbol">dieast</span> > 575 <script>explorer.outline.addDecl('dieast');</script> > 576 > 577 ; > 578 </span></dt> > 579 <script>explorer.outline.writeEnabled = false;</script> > 580 > 581 > 582 <dd><br><br> > 583 </dd> 557 </dl> 584 </dl> 558 <script>explorer.outline.decSymbolLevel();</script> 585 <script>explorer.outline.decSymbolLevel();</script> 559 586 560 587 561 </dd> 588 </dd> 562 </dl> 589 </dl> 563 <script>explorer.outline.decSymbolLevel();</script> 590 <script>explorer.outline.decSymbolLevel();</script> 564 591 565 592 566 </td></tr> 593 </td></tr> 567 <tr><td id="docfooter"> 594 <tr><td id="docfooter"> 568 Page was generated with 595 Page was generated with 569 <img src="candydoc/img/candydoc.gif" style="vertical-ali 596 <img src="candydoc/img/candydoc.gif" style="vertical-ali 570 on Thu Nov 25 12:13:46 2010 | 597 on Fri Nov 26 16:41:44 2010 571 598 572 </td></tr> 599 </td></tr> 573 </table> 600 </table> 574 </div> 601 </div> 575 <script> 602 <script> 576 explorer.packageExplorer.addModule("index"); 603 explorer.packageExplorer.addModule("index"); 577 explorer.packageExplorer.addModule("main"); 604 explorer.packageExplorer.addModule("main");

Modified doc/eval.html from [694d60ab663f1749] to [2f7c4dc496477f14].

128 <script>explorer.outline.decSymbolLevel();</script> 128 <script>explorer.outline.decSymbolLevel();</script> 129 129 130 130 131 </td></tr> 131 </td></tr> 132 <tr><td id="docfooter"> 132 <tr><td id="docfooter"> 133 Page was generated with 133 Page was generated with 134 <img src="candydoc/img/candydoc.gif" style="vertical-ali 134 <img src="candydoc/img/candydoc.gif" style="vertical-ali 135 on Thu Nov 25 12:13:46 2010 | 135 on Fri Nov 26 16:41:45 2010 136 136 137 </td></tr> 137 </td></tr> 138 </table> 138 </table> 139 </div> 139 </div> 140 <script> 140 <script> 141 explorer.packageExplorer.addModule("index"); 141 explorer.packageExplorer.addModule("index"); 142 explorer.packageExplorer.addModule("main"); 142 explorer.packageExplorer.addModule("main");

Modified doc/failure.html from [40513c24ea54cf40] to [73b33ccfe21436b6].

178 <script>explorer.outline.decSymbolLevel();</script> 178 <script>explorer.outline.decSymbolLevel();</script> 179 179 180 180 181 </td></tr> 181 </td></tr> 182 <tr><td id="docfooter"> 182 <tr><td id="docfooter"> 183 Page was generated with 183 Page was generated with 184 <img src="candydoc/img/candydoc.gif" style="vertical-ali 184 <img src="candydoc/img/candydoc.gif" style="vertical-ali 185 on Thu Nov 25 12:13:47 2010 | 185 on Fri Nov 26 16:41:45 2010 186 186 187 </td></tr> 187 </td></tr> 188 </table> 188 </table> 189 </div> 189 </div> 190 <script> 190 <script> 191 explorer.packageExplorer.addModule("index"); 191 explorer.packageExplorer.addModule("index"); 192 explorer.packageExplorer.addModule("main"); 192 explorer.packageExplorer.addModule("main");

Modified doc/fresh.html from [c181d051b30c5ddc] to [9043a131c52ae01a].

46 <script>explorer.outline.decSymbolLevel();</script> 46 <script>explorer.outline.decSymbolLevel();</script> 47 47 48 48 49 </td></tr> 49 </td></tr> 50 <tr><td id="docfooter"> 50 <tr><td id="docfooter"> 51 Page was generated with 51 Page was generated with 52 <img src="candydoc/img/candydoc.gif" style="vertical-ali 52 <img src="candydoc/img/candydoc.gif" style="vertical-ali 53 on Thu Nov 25 12:13:47 2010 | 53 on Fri Nov 26 16:41:46 2010 54 54 55 </td></tr> 55 </td></tr> 56 </table> 56 </table> 57 </div> 57 </div> 58 <script> 58 <script> 59 explorer.packageExplorer.addModule("index"); 59 explorer.packageExplorer.addModule("index"); 60 explorer.packageExplorer.addModule("main"); 60 explorer.packageExplorer.addModule("main");

Modified doc/index.html from [56b12828066b590e] to [dc242393e80db0b7].

89 89 90 <dd><pre> 90 <dd><pre> 91 ID ::= 適当に識別子っぽい文字列 91 ID ::= 適当に識別子っぽい文字列 92 LAYER ::= "@" ID 92 LAYER ::= "@" ID 93 93 94 E ::= 94 E ::= 95 <font color=green># 変数宣言</font> 95 <font color=green># 変数宣言</font> 96 | ("var"|"let"|"def"|LAYER) ID "=" E (";"|"in") E | 96 | DECL "=" E (";"|"in") E 97 | ("var"|"let"|"def"|LAYER) ID "(" PARAMS ")" "{" E "}" (";"|"in") E | 97 | DECL "(" PARAMS ")" "{" E "}" (";"|"in") E 98 | ("var"|"let"|"def"|LAYER) ID "=" E | 98 | DECL "=" E 99 | ("var"|"let"|"def"|LAYER) ID "(" PARAMS ")" "{" E "}" | 99 | DECL "(" PARAMS ")" "{" E "}" > 100 > 101 where DECL ::= ("var"|"let"|"def"|LAYER) ID | "@" LAYER 100 102 101 <font color=green># リテラル</font> 103 <font color=green># リテラル</font> 102 | INTEGER <font color=green># 非負整数</font> 104 | INTEGER <font color=green># 非負整数</font> 103 | STRING <font color=green># "" でくくった文字列。\" と \\ は 105 | STRING <font color=green># "" でくくった文字列。\" と \\ は 104 | "{" ENTRYS "}" <font color=green># テーブル</font> 106 | "{" ENTRYS "}" <font color=green># テーブル</font> 105 | "fun" "(" PARAMS ")" "{" E "}" <font color=green># 無名関数</font> 107 | "fun" "(" PARAMS ")" "{" E "}" <font color=green># 無名関数</font> 106 | "λ" "(" PARAMS ")" "{" E "}" <font color=green># 無名関数</font> 108 | "λ" "(" PARAMS ")" "{" E "}" <font color=green># 無名関数</font> ................................................................................................................................................................................ 110 112 111 where ARGS ::= E "," ... "," E 113 where ARGS ::= E "," ... "," E 112 PARAMS ::= (ID|LAYER)+ "," ... "," (ID|LAYER)+ 114 PARAMS ::= (ID|LAYER)+ "," ... "," (ID|LAYER)+ 113 ENTRYS ::= ID ":" E "," ... "," ID ":" E 115 ENTRYS ::= ID ":" E "," ... "," ID ":" E 114 116 115 <font color=green># 演算子など</font> 117 <font color=green># 演算子など</font> 116 | "(" E ")" <font color=green># ただの括弧</font> 118 | "(" E ")" <font color=green># ただの括弧</font> > 119 | "..." <font color=green># これを実行するとdie</font> 117 | E BINOP E <font color=green># 二項演算子いろいろ</font> 120 | E BINOP E <font color=green># 二項演算子いろいろ</font> 118 | E "." ID <font color=green># テーブルのフィールドアクセス</font> 121 | E "." ID <font color=green># テーブルのフィールドアクセス</font> 119 | E ".?" ID <font color=green># テーブルにフィールドがあるか否か</font> 122 | E ".?" ID <font color=green># テーブルにフィールドがあるか否か</font> 120 | E "{" ENTRYS "}" <font color=green># テーブル拡張</font> 123 | E "{" ENTRYS "}" <font color=green># テーブル拡張</font> 121 | "if" E ("then"|":"|"then" ":") E 124 | "if" E ("then"|":"|"then" ":") E 122 | "if" E ("then"|":"|"then" ":") E "else" ":"? E 125 | "if" E ("then"|":"|"then" ":") E "else" ":"? E 123 126 ................................................................................................................................................................................ 285 以下のデータ型があります。 288 以下のデータ型があります。 286 </p> 289 </p> 287 <ul> 290 <ul> 288 <li>整数: <tt>0</tt>, <tt>123</tt>, <tt>456666666666666666666666666666666666 291 <li>整数: <tt>0</tt>, <tt>123</tt>, <tt>456666666666666666666666666666666666 289 <li>文字列: <tt>"hello, world!"</tt>, ...</li> 292 <li>文字列: <tt>"hello, world!"</tt>, ...</li> 290 <li>関数: <tt>fun(x){x+1}</tt></li> 293 <li>関数: <tt>fun(x){x+1}</tt></li> 291 <li>テーブル: <tt>{car: 1, cdr: {car: 2, cdr: {}}}</tt></li> 294 <li>テーブル: <tt>{car: 1, cdr: {car: 2, cdr: {}}}</tt></li> 292 <li>未定義値: (undefined。特殊なケースで作られます)</li> | 295 <li>未定義値: (特殊なケースで作られます。「レイヤ」の説明参照のこと。)</li> 293 </ul> 296 </ul> 294 <p> 297 <p> 295 関数はいわゆる「クロージャ」です。静的スコープで外側の環境にアクセスできます。 298 関数はいわゆる「クロージャ」です。静的スコープで外側の環境にアクセスできます。 296 テーブルはいわゆるプロトタイプチェーンを持っていて、 299 テーブルはいわゆるプロトタイプチェーンを持っていて、 297 自分にないフィールドの場合は親に問い合わせが行く感じになっていますが、 300 自分にないフィールドの場合は親に問い合わせが行く感じになっていますが、 298 フィールドの書き換えがないので、これは特に意味ないかもしれない…。 301 フィールドの書き換えがないので、これは特に意味ないかもしれない…。 299 </p> 302 </p> ................................................................................................................................................................................ 325 when {car:x, cdr:{}}: lst 328 when {car:x, cdr:{}}: lst 326 when {}: {} 329 when {}: {} 327 } 330 } 328 </pre> 331 </pre> 329 <p> 332 <p> 330 動かすときには、処理系がそれっぽい if-then-else に展開しています。 333 動かすときには、処理系がそれっぽい if-then-else に展開しています。 331 <tt>when</tt> を上から試していって、最初にマッチしたところを実行します。 334 <tt>when</tt> を上から試していって、最初にマッチしたところを実行します。 > 335 どれにもマッチしないとエラーでプログラム終了します。 332 </p> 336 </p> 333 <pre> 337 <pre> 334 PAT ::= "_" <font color=green># ワイルドカード< 338 PAT ::= "_" <font color=green># ワイルドカード< 335 | ID <font color=green># 変数パターン</ 339 | ID <font color=green># 変数パターン</ 336 | "{" ID ":" PAT "," ... "," ID : PAT "}" <font color=green># テーブルパター 340 | "{" ID ":" PAT "," ... "," ID : PAT "}" <font color=green># テーブルパター 337 | E <font color=green># 値パターン</f 341 | E <font color=green># 値パターン</f 338 </pre> 342 </pre> ................................................................................................................................................................................ 873 <script>explorer.outline.decSymbolLevel();</script> 877 <script>explorer.outline.decSymbolLevel();</script> 874 878 875 879 876 </td></tr> 880 </td></tr> 877 <tr><td id="docfooter"> 881 <tr><td id="docfooter"> 878 Page was generated with 882 Page was generated with 879 <img src="candydoc/img/candydoc.gif" style="vertical-ali 883 <img src="candydoc/img/candydoc.gif" style="vertical-ali 880 on Fri Nov 26 10:02:52 2010 | 884 on Fri Nov 26 16:41:52 2010 881 885 882 </td></tr> 886 </td></tr> 883 </table> 887 </table> 884 </div> 888 </div> 885 <script> 889 <script> 886 explorer.packageExplorer.addModule("index"); 890 explorer.packageExplorer.addModule("index"); 887 explorer.packageExplorer.addModule("main"); 891 explorer.packageExplorer.addModule("main");

Modified doc/layer.html from [26ac57c2c82a7847] to [a4f78e6e3d8c715a].

37 37 38 <dd>Type for the layer ID<br><br> 38 <dd>Type for the layer ID<br><br> 39 39 40 </dd> 40 </dd> 41 41 42 <script>explorer.outline.writeEnabled = true;</script> 42 <script>explorer.outline.writeEnabled = true;</script> 43 <dt><span class="decl"> 43 <dt><span class="decl"> 44 <span class="currsymbol">SystemLayer</span> | 44 <span class="currsymbol">LiftLayer</span> 45 <script>explorer.outline.addDecl('SystemLayer');</script> | 45 <script>explorer.outline.addDecl('LiftLayer');</script> > 46 > 47 </span></dt> > 48 <script>explorer.outline.writeEnabled = false;</script> > 49 > 50 > 51 <dd>Predefined layer for storing lift functions<br><br> > 52 > 53 </dd> > 54 > 55 <script>explorer.outline.writeEnabled = true;</script> > 56 <dt><span class="decl"> > 57 <span class="currsymbol">NoopLayer</span> > 58 <script>explorer.outline.addDecl('NoopLayer');</script> 46 59 47 </span></dt> 60 </span></dt> 48 <script>explorer.outline.writeEnabled = false;</script> 61 <script>explorer.outline.writeEnabled = false;</script> 49 62 50 63 51 <dd>Predefined layer for internal data<br><br> | 64 <dd>Predefined layer for just allocating a slot for table<br><br> 52 65 53 </dd> 66 </dd> 54 67 55 <script>explorer.outline.writeEnabled = true;</script> 68 <script>explorer.outline.writeEnabled = true;</script> 56 <dt><span class="decl"> 69 <dt><span class="decl"> 57 <span class="currsymbol">ValueLayer</span> 70 <span class="currsymbol">ValueLayer</span> 58 <script>explorer.outline.addDecl('ValueLayer');</script> 71 <script>explorer.outline.addDecl('ValueLayer');</script> ................................................................................................................................................................................ 150 <script>explorer.outline.decSymbolLevel();</script> 163 <script>explorer.outline.decSymbolLevel();</script> 151 164 152 165 153 </td></tr> 166 </td></tr> 154 <tr><td id="docfooter"> 167 <tr><td id="docfooter"> 155 Page was generated with 168 Page was generated with 156 <img src="candydoc/img/candydoc.gif" style="vertical-ali 169 <img src="candydoc/img/candydoc.gif" style="vertical-ali 157 on Thu Nov 25 12:13:48 2010 | 170 on Fri Nov 26 16:41:46 2010 158 171 159 </td></tr> 172 </td></tr> 160 </table> 173 </table> 161 </div> 174 </div> 162 <script> 175 <script> 163 explorer.packageExplorer.addModule("index"); 176 explorer.packageExplorer.addModule("index"); 164 explorer.packageExplorer.addModule("main"); 177 explorer.packageExplorer.addModule("main");

Modified doc/lex.html from [a48f5afeb590d4a5] to [b039dcaea4552a8f].

307 <script>explorer.outline.decSymbolLevel();</script> 307 <script>explorer.outline.decSymbolLevel();</script> 308 308 309 309 310 </td></tr> 310 </td></tr> 311 <tr><td id="docfooter"> 311 <tr><td id="docfooter"> 312 Page was generated with 312 Page was generated with 313 <img src="candydoc/img/candydoc.gif" style="vertical-ali 313 <img src="candydoc/img/candydoc.gif" style="vertical-ali 314 on Thu Nov 25 12:15:05 2010 | 314 on Fri Nov 26 16:41:47 2010 315 315 316 </td></tr> 316 </td></tr> 317 </table> 317 </table> 318 </div> 318 </div> 319 <script> 319 <script> 320 explorer.packageExplorer.addModule("index"); 320 explorer.packageExplorer.addModule("index"); 321 explorer.packageExplorer.addModule("main"); 321 explorer.packageExplorer.addModule("main");

Modified doc/main.html from [47fac5459c7c889e] to [d5dd76810e38b7f6].

62 <script>explorer.outline.decSymbolLevel();</script> 62 <script>explorer.outline.decSymbolLevel();</script> 63 63 64 64 65 </td></tr> 65 </td></tr> 66 <tr><td id="docfooter"> 66 <tr><td id="docfooter"> 67 Page was generated with 67 Page was generated with 68 <img src="candydoc/img/candydoc.gif" style="vertical-ali 68 <img src="candydoc/img/candydoc.gif" style="vertical-ali 69 on Thu Nov 25 12:15:04 2010 | 69 on Fri Nov 26 16:41:42 2010 70 70 71 </td></tr> 71 </td></tr> 72 </table> 72 </table> 73 </div> 73 </div> 74 <script> 74 <script> 75 explorer.packageExplorer.addModule("index"); 75 explorer.packageExplorer.addModule("index"); 76 explorer.packageExplorer.addModule("main"); 76 explorer.packageExplorer.addModule("main");

Modified doc/parse.html from [bff389c3a8da9e67] to [e3b4b64f19f93798].

56 <script>explorer.outline.decSymbolLevel();</script> 56 <script>explorer.outline.decSymbolLevel();</script> 57 57 58 58 59 </td></tr> 59 </td></tr> 60 <tr><td id="docfooter"> 60 <tr><td id="docfooter"> 61 Page was generated with 61 Page was generated with 62 <img src="candydoc/img/candydoc.gif" style="vertical-ali 62 <img src="candydoc/img/candydoc.gif" style="vertical-ali 63 on Thu Nov 25 12:15:05 2010 | 63 on Fri Nov 26 16:41:48 2010 64 64 65 </td></tr> 65 </td></tr> 66 </table> 66 </table> 67 </div> 67 </div> 68 <script> 68 <script> 69 explorer.packageExplorer.addModule("index"); 69 explorer.packageExplorer.addModule("index"); 70 explorer.packageExplorer.addModule("main"); 70 explorer.packageExplorer.addModule("main");

Modified doc/repl.html from [bbc57ada8c3877f2] to [f38bae3012b6b256].

156 <script>explorer.outline.decSymbolLevel();</script> 156 <script>explorer.outline.decSymbolLevel();</script> 157 157 158 158 159 </td></tr> 159 </td></tr> 160 <tr><td id="docfooter"> 160 <tr><td id="docfooter"> 161 Page was generated with 161 Page was generated with 162 <img src="candydoc/img/candydoc.gif" style="vertical-ali 162 <img src="candydoc/img/candydoc.gif" style="vertical-ali 163 on Thu Nov 25 12:15:06 2010 | 163 on Fri Nov 26 16:41:48 2010 164 164 165 </td></tr> 165 </td></tr> 166 </table> 166 </table> 167 </div> 167 </div> 168 <script> 168 <script> 169 explorer.packageExplorer.addModule("index"); 169 explorer.packageExplorer.addModule("index"); 170 explorer.packageExplorer.addModule("main"); 170 explorer.packageExplorer.addModule("main");

Modified doc/runtime.html from [c03951e325eae3e8] to [fb971a54db14120e].

42 <script>explorer.outline.decSymbolLevel();</script> 42 <script>explorer.outline.decSymbolLevel();</script> 43 43 44 44 45 </td></tr> 45 </td></tr> 46 <tr><td id="docfooter"> 46 <tr><td id="docfooter"> 47 Page was generated with 47 Page was generated with 48 <img src="candydoc/img/candydoc.gif" style="vertical-ali 48 <img src="candydoc/img/candydoc.gif" style="vertical-ali 49 on Thu Nov 25 12:30:12 2010 | 49 on Fri Nov 26 16:41:49 2010 50 50 51 </td></tr> 51 </td></tr> 52 </table> 52 </table> 53 </div> 53 </div> 54 <script> 54 <script> 55 explorer.packageExplorer.addModule("index"); 55 explorer.packageExplorer.addModule("index"); 56 explorer.packageExplorer.addModule("main"); 56 explorer.packageExplorer.addModule("main");

Modified doc/test.html from [3cf05b87d24962dc] to [65937464daabbe41].

143 <script>explorer.outline.decSymbolLevel();</script> 143 <script>explorer.outline.decSymbolLevel();</script> 144 144 145 145 146 </td></tr> 146 </td></tr> 147 <tr><td id="docfooter"> 147 <tr><td id="docfooter"> 148 Page was generated with 148 Page was generated with 149 <img src="candydoc/img/candydoc.gif" style="vertical-ali 149 <img src="candydoc/img/candydoc.gif" style="vertical-ali 150 on Thu Nov 25 12:15:08 2010 | 150 on Fri Nov 26 16:41:51 2010 151 151 152 </td></tr> 152 </td></tr> 153 </table> 153 </table> 154 </div> 154 </div> 155 <script> 155 <script> 156 explorer.packageExplorer.addModule("index"); 156 explorer.packageExplorer.addModule("index"); 157 explorer.packageExplorer.addModule("main"); 157 explorer.packageExplorer.addModule("main");

Modified doc/tricks.html from [67d9668f00ab5789] to [66f1242be8634b07].

246 <script>explorer.outline.decSymbolLevel();</script> 246 <script>explorer.outline.decSymbolLevel();</script> 247 247 248 248 249 </td></tr> 249 </td></tr> 250 <tr><td id="docfooter"> 250 <tr><td id="docfooter"> 251 Page was generated with 251 Page was generated with 252 <img src="candydoc/img/candydoc.gif" style="vertical-ali 252 <img src="candydoc/img/candydoc.gif" style="vertical-ali 253 on Thu Nov 25 12:15:09 2010 | 253 on Fri Nov 26 16:41:52 2010 254 254 255 </td></tr> 255 </td></tr> 256 </table> 256 </table> 257 </div> 257 </div> 258 <script> 258 <script> 259 explorer.packageExplorer.addModule("index"); 259 explorer.packageExplorer.addModule("index"); 260 explorer.packageExplorer.addModule("main"); 260 explorer.packageExplorer.addModule("main");

Modified doc/value.html from [c36eaebf49fd7834] to [4d6f8832c63e974c].

259 <script>explorer.outline.decSymbolLevel();</script> 259 <script>explorer.outline.decSymbolLevel();</script> 260 260 261 261 262 </td></tr> 262 </td></tr> 263 <tr><td id="docfooter"> 263 <tr><td id="docfooter"> 264 Page was generated with 264 Page was generated with 265 <img src="candydoc/img/candydoc.gif" style="vertical-ali 265 <img src="candydoc/img/candydoc.gif" style="vertical-ali 266 on Thu Nov 25 12:15:07 2010 | 266 on Fri Nov 26 16:41:50 2010 267 267 268 </td></tr> 268 </td></tr> 269 </table> 269 </table> 270 </div> 270 </div> 271 <script> 271 <script> 272 explorer.packageExplorer.addModule("index"); 272 explorer.packageExplorer.addModule("index"); 273 explorer.packageExplorer.addModule("main"); 273 explorer.packageExplorer.addModule("main");

Modified doc/valueconv.html from [86d592872cc32a6a] to [e08638d4763e1185].

84 <script>explorer.outline.decSymbolLevel();</script> 84 <script>explorer.outline.decSymbolLevel();</script> 85 85 86 86 87 </td></tr> 87 </td></tr> 88 <tr><td id="docfooter"> 88 <tr><td id="docfooter"> 89 Page was generated with 89 Page was generated with 90 <img src="candydoc/img/candydoc.gif" style="vertical-ali 90 <img src="candydoc/img/candydoc.gif" style="vertical-ali 91 on Thu Nov 25 12:15:47 2010 | 91 on Fri Nov 26 16:41:51 2010 92 92 93 </td></tr> 93 </td></tr> 94 </table> 94 </table> 95 </div> 95 </div> 96 <script> 96 <script> 97 explorer.packageExplorer.addModule("index"); 97 explorer.packageExplorer.addModule("index"); 98 explorer.packageExplorer.addModule("main"); 98 explorer.packageExplorer.addModule("main");

Modified index.dd from [80b16f2bd31d3d7f] to [a7325259b4f09952].

40 $(SECTION BNF, $(SECBODY 40 $(SECTION BNF, $(SECBODY 41 <pre> 41 <pre> 42 ID ::= 適当に識別子っぽい文字列 42 ID ::= 適当に識別子っぽい文字列 43 LAYER ::= "@" ID 43 LAYER ::= "@" ID 44 44 45 E ::= 45 E ::= 46 $(D_COMMENT # 変数宣言) 46 $(D_COMMENT # 変数宣言) 47 | ("var"|"let"|"def"|LAYER) ID "=" E (";"|"in") E | 47 | DECL "=" E (";"|"in") E 48 | ("var"|"let"|"def"|LAYER) ID "(" PARAMS ")" "{" E "}" (";"|"in") E | 48 | DECL "(" PARAMS ")" "{" E "}" (";"|"in") E 49 | ("var"|"let"|"def"|LAYER) ID "=" E | 49 | DECL "=" E 50 | ("var"|"let"|"def"|LAYER) ID "(" PARAMS ")" "{" E "}" | 50 | DECL "(" PARAMS ")" "{" E "}" > 51 > 52 where DECL ::= ("var"|"let"|"def"|LAYER) ID | "@" LAYER 51 53 52 $(D_COMMENT # リテラル) 54 $(D_COMMENT # リテラル) 53 | INTEGER $(D_COMMENT # 非負整数) 55 | INTEGER $(D_COMMENT # 非負整数) 54 | STRING $(D_COMMENT # "" でくくった文字列。\" と \\ は使える) 56 | STRING $(D_COMMENT # "" でくくった文字列。\" と \\ は使える) 55 | "{" ENTRYS "}" $(D_COMMENT # テーブル) 57 | "{" ENTRYS "}" $(D_COMMENT # テーブル) 56 | "fun" "(" PARAMS ")" "{" E "}" $(D_COMMENT # 無名関数) 58 | "fun" "(" PARAMS ")" "{" E "}" $(D_COMMENT # 無名関数) 57 | "λ" "(" PARAMS ")" "{" E "}" $(D_COMMENT # 無名関数) 59 | "λ" "(" PARAMS ")" "{" E "}" $(D_COMMENT # 無名関数) ................................................................................................................................................................................ 61 63 62 where ARGS ::= E "," ... "," E 64 where ARGS ::= E "," ... "," E 63 PARAMS ::= (ID|LAYER)+ "," ... "," (ID|LAYER)+ 65 PARAMS ::= (ID|LAYER)+ "," ... "," (ID|LAYER)+ 64 ENTRYS ::= ID ":" E "," ... "," ID ":" E 66 ENTRYS ::= ID ":" E "," ... "," ID ":" E 65 67 66 $(D_COMMENT # 演算子など) 68 $(D_COMMENT # 演算子など) 67 | "(" E ")" $(D_COMMENT # ただの括弧) 69 | "(" E ")" $(D_COMMENT # ただの括弧) > 70 | "..." $(D_COMMENT # これを実行するとdie) 68 | E BINOP E $(D_COMMENT # 二項演算子いろいろ) 71 | E BINOP E $(D_COMMENT # 二項演算子いろいろ) 69 | E "." ID $(D_COMMENT # テーブルのフィールドアクセス) 72 | E "." ID $(D_COMMENT # テーブルのフィールドアクセス) 70 | E ".?" ID $(D_COMMENT # テーブルにフィールドがあるか否か) 73 | E ".?" ID $(D_COMMENT # テーブルにフィールドがあるか否か) 71 | E "{" ENTRYS "}" $(D_COMMENT # テーブル拡張) 74 | E "{" ENTRYS "}" $(D_COMMENT # テーブル拡張) 72 | "if" E ("then"|":"|"then" ":") E 75 | "if" E ("then"|":"|"then" ":") E 73 | "if" E ("then"|":"|"then" ":") E "else" ":"? E 76 | "if" E ("then"|":"|"then" ":") E "else" ":"? E 74 77 ................................................................................................................................................................................ 200 以下のデータ型があります。 203 以下のデータ型があります。 201 </p> 204 </p> 202 <ul> 205 <ul> 203 <li>整数: <tt>0</tt>, <tt>123</tt>, <tt>456666666666666666666666666666666666 206 <li>整数: <tt>0</tt>, <tt>123</tt>, <tt>456666666666666666666666666666666666 204 <li>文字列: <tt>"hello, world!"</tt>, ...</li> 207 <li>文字列: <tt>"hello, world!"</tt>, ...</li> 205 <li>関数: <tt>fun(x){x+1}</tt></li> 208 <li>関数: <tt>fun(x){x+1}</tt></li> 206 <li>テーブル: <tt>{car: 1, cdr: {car: 2, cdr: {}}}</tt></li> 209 <li>テーブル: <tt>{car: 1, cdr: {car: 2, cdr: {}}}</tt></li> 207 <li>未定義値: (undefined。特殊なケースで作られます)</li> | 210 <li>未定義値: (特殊なケースで作られます。「レイヤ」の説明参照のこと。)</li> 208 </ul> 211 </ul> 209 <p> 212 <p> 210 関数はいわゆる「クロージャ」です。静的スコープで外側の環境にアクセスできます。 213 関数はいわゆる「クロージャ」です。静的スコープで外側の環境にアクセスできます。 211 テーブルはいわゆるプロトタイプチェーンを持っていて、 214 テーブルはいわゆるプロトタイプチェーンを持っていて、 212 自分にないフィールドの場合は親に問い合わせが行く感じになっていますが、 215 自分にないフィールドの場合は親に問い合わせが行く感じになっていますが、 213 フィールドの書き換えがないので、これは特に意味ないかもしれない…。 216 フィールドの書き換えがないので、これは特に意味ないかもしれない…。 214 </p> 217 </p> ................................................................................................................................................................................ 232 when {car:x, cdr:{}}: lst 235 when {car:x, cdr:{}}: lst 233 when {}: {} 236 when {}: {} 234 } 237 } 235 </pre> 238 </pre> 236 <p> 239 <p> 237 動かすときには、処理系がそれっぽい if-then-else に展開しています。 240 動かすときには、処理系がそれっぽい if-then-else に展開しています。 238 <tt>when</tt> を上から試していって、最初にマッチしたところを実行します。 241 <tt>when</tt> を上から試していって、最初にマッチしたところを実行します。 > 242 どれにもマッチしないとエラーでプログラム終了します。 239 </p> 243 </p> 240 <pre> 244 <pre> 241 PAT ::= "_" $(D_COMMENT # ワイルドカード) 245 PAT ::= "_" $(D_COMMENT # ワイルドカード) 242 | ID $(D_COMMENT # 変数パターン) 246 | ID $(D_COMMENT # 変数パターン) 243 | "{" ID ":" PAT "," ... "," ID : PAT "}" $(D_COMMENT # テーブルパターン) 247 | "{" ID ":" PAT "," ... "," ID : PAT "}" $(D_COMMENT # テーブルパターン) 244 | E $(D_COMMENT # 値パターン) 248 | E $(D_COMMENT # 値パターン) 245 </pre> 249 </pre>

Modified polemy/ast.d from [98d6a7a3304f7043] to [8ec2df800d3eb579].

89 class Fun : AST 89 class Fun : AST 90 { 90 { 91 Parameter[] params; /// 91 Parameter[] params; /// 92 AST funbody; /// 92 AST funbody; /// 93 93 94 mixin SimpleClass; 94 mixin SimpleClass; 95 } 95 } > 96 > 97 /// AST node for deadend > 98 class Die : AST > 99 { > 100 mixin SimpleClass; > 101 } 96 102 97 /// List of AST Types 103 /// List of AST Types 98 104 99 alias TypeTuple!(Int,Str,Var,Lay,Let,App,Fun) ListOfASTTypes; | 105 alias TypeTuple!(Int,Str,Var,Lay,Let,App,Fun,Die) ListOfASTTypes; 100 106 101 /// Handy Generator for AST nodes. To use this, mixin EasyAst; 107 /// Handy Generator for AST nodes. To use this, mixin EasyAst; 102 108 103 /*mixin*/ 109 /*mixin*/ 104 template EasyAST() 110 template EasyAST() 105 { 111 { 106 /// 112 /// ................................................................................................................................................................................ 113 return genEast!Fun(array(map!((string x){return new Parameter(x, 119 return genEast!Fun(array(map!((string x){return new Parameter(x, 114 auto funp(Parameter[] xs, AST ps) { return genEast!Fun(xs,ps); } /// 120 auto funp(Parameter[] xs, AST ps) { return genEast!Fun(xs,ps); } /// 115 alias genEast!Var var; /// 121 alias genEast!Var var; /// 116 alias genEast!Lay lay; /// 122 alias genEast!Lay lay; /// 117 alias genEast!Let let; /// 123 alias genEast!Let let; /// 118 alias genEast!App call; /// 124 alias genEast!App call; /// 119 auto param(string name, string[] lay...) { return new Parameter(name, la 125 auto param(string name, string[] lay...) { return new Parameter(name, la > 126 alias genEast!Die dieast; /// 120 } 127 }

Modified polemy/eval.d from [47affa2343c633ca] to [8d6e708eceba536a].

149 { 149 { 150 Value ri = eval(e.init, lay, newCtx); 150 Value ri = eval(e.init, lay, newCtx); 151 if(e.name!="_") 151 if(e.name!="_") 152 newCtx.set(e.name, e.layer.empty ? lay : e.layer 152 newCtx.set(e.name, e.layer.empty ? lay : e.layer 153 return eval(e.expr, lay, newCtx, OverwriteCtx); 153 return eval(e.expr, lay, newCtx, OverwriteCtx); 154 } 154 } 155 } 155 } > 156 > 157 Value eval( Die e, Layer lay, Table ctx, bool overwriteCtx=CascadeCtx ) > 158 { > 159 if( isMacroLayer(lay) ) > 160 return ast2table(e, (AST e){return eval(e,lay,ctx);}); > 161 if( isUserDefinedLayer(lay) ) > 162 return new UndefinedValue; > 163 throw genex!RuntimeException(e.pos, "undefined case"); > 164 } 156 165 157 private: 166 private: 158 // little little bit incremental macro defining version. 167 // little little bit incremental macro defining version. 159 // enables @macro foo(x)=... in ... foo ..., only at the top level of th 168 // enables @macro foo(x)=... in ... foo ..., only at the top level of th 160 // interpreter and functions. better than nothing :P 169 // interpreter and functions. better than nothing :P 161 Tuple!(Value,AST) macroAndEval( AST e_, Layer lay, Table ctx, bool overw 170 Tuple!(Value,AST) macroAndEval( AST e_, Layer lay, Table ctx, bool overw 162 , ref AST[void*] mandeCache) // [TODO] avoid assuming non-moving 171 , ref AST[void*] mandeCache) // [TODO] avoid assuming non-moving ................................................................................................................................................................................ 479 main() 488 main() 480 `) ); 489 `) ); 481 } 490 } 482 unittest 491 unittest 483 { 492 { 484 auto e = new Evaluator; 493 auto e = new Evaluator; 485 enrollRuntimeLibrary(e); 494 enrollRuntimeLibrary(e); 486 assert_nothrow( e.evalString(`case 1`) ); | 495 assert_throw!RuntimeException( e.evalString(`case 1`) ); 487 assert_nothrow( e.evalString(`case 1 when 1: 2`) ); 496 assert_nothrow( e.evalString(`case 1 when 1: 2`) ); 488 497 489 // this is a shorthand for 498 // this is a shorthand for 490 // @macro x = fun(){} in @macro(x) 499 // @macro x = fun(){} in @macro(x) 491 // so it is ok to fail, but it is really incovenient on REPL 500 // so it is ok to fail, but it is really incovenient on REPL 492 assert_nothrow( e.evalString(`@macro x=fun(){}`) ); 501 assert_nothrow( e.evalString(`@macro x=fun(){}`) ); 493 } 502 } > 503 > 504 unittest > 505 { > 506 auto e = new Evaluator; > 507 enrollRuntimeLibrary(e); > 508 assert_throw!RuntimeException( e.evalString(`...`) ); > 509 assert_eq( e.evalString(`@@foo(x){x}; @foo(...)`), new UndefinedValue ); > 510 }

Modified polemy/parse.d from [3ad9850246d5111f] to [45c4aa9e0628516e].

265 return new Str(pos, lex.front.str); 265 return new Str(pos, lex.front.str); 266 } 266 } 267 if( isNumber(lex.front.str) ) 267 if( isNumber(lex.front.str) ) 268 { 268 { 269 scope(exit) lex.popFront; 269 scope(exit) lex.popFront; 270 return new Int(pos, BigInt(cast(string)lex.front.str)); 270 return new Int(pos, BigInt(cast(string)lex.front.str)); 271 } 271 } > 272 if( tryEat("...") ) > 273 { > 274 return new Die(pos); > 275 } 272 if( tryEat("@") ) 276 if( tryEat("@") ) 273 { 277 { 274 auto lay = "@"~eatId("for layer ID"); 278 auto lay = "@"~eatId("for layer ID"); 275 eat("(", "for layered execution"); 279 eat("(", "for layered execution"); 276 auto e = Body(); 280 auto e = Body(); 277 eat(")", "after "~lay~"(..."); 281 eat(")", "after "~lay~"(..."); 278 return new Lay(pos, lay, e); 282 return new Lay(pos, lay, e); ................................................................................................................................................................................ 356 return parsePatternMatchCases(casePos, pmVar, failBranch 360 return parsePatternMatchCases(casePos, pmVar, failBranch 357 new Let(pos, tryThisBranchVar, [], 361 new Let(pos, tryThisBranchVar, [], 358 new Fun(pos,[],judgement), thenDoThis) 362 new Fun(pos,[],judgement), thenDoThis) 359 ); 363 ); 360 } 364 } 361 else 365 else 362 { 366 { 363 AST doNothing = new Fun(casePos,[], | 367 AST doNothing = new Fun(casePos,[], new Die(casePos)); 364 new Str(casePos, sprintf!"(pattern match failure < 365 return new Let(casePos, tryThisBranchVar, [], doNothing, 368 return new Let(casePos, tryThisBranchVar, [], doNothing, 366 } 369 } 367 } 370 } 368 371 369 // hageshiku tenuki 372 // hageshiku tenuki 370 abstract class SinglePattern 373 abstract class SinglePattern 371 { 374 {