Diffs
Acme_BrainPhack/trunk/Acme/BrainPhack/test/testsrc/HelloWorld_Jojo_Dio.txt
表示できません: バイナリ形式としてマークされたファイルです。
svn:mime-type = application/octet-stream
属性に変更があったパス: Acme_BrainPhack/trunk/Acme/BrainPhack/test/testsrc/HelloWorld_Jojo_Dio.txt
___________________________________________________________________
名前: svn:mime-type
+ application/octet-stream
Acme_BrainPhack/trunk/Acme/BrainPhack/test/testsrc/HelloWorld_None.txt
@@ -0,0 +1,5 @@
+# default mapping HelloWorld and input & output a character
++++++++++[>++++++++>+++++++++++>+++++<<<-]>.
+>++.+++++++..+++.>-.------------.<++++++++.
+--------.+++.------.--------.>+.
+,.
\ ファイルの末尾に改行がありません
Acme_BrainPhack/trunk/Acme/BrainPhack/test/testsrc/HelloWorld_Yaruo_Detteiu.txt
@@ -0,0 +1,80 @@
+# default mapping HelloWorld and input & output a character
+PHPでっていう
+今更っていう
+しかもBrainF*ckでっていう
+遅すぎっていう
+ネタ狙いすぎっていう
+何様っていう
+所詮自己満足っていう
+でも楽しんでくれたらラッキーっていう
+ででででっていう。
+
+ギロッ
+
+しかもパッケージが"Acme"系列ワロスっていう。
+ジョークPEARかっていう。
+折角だから草生やしてみるっていうwwwww
+半角なら問題ないっていうwwwwwww
+でででっていうでっていう
+でででででっていう
+
+でっていう大杉テラワロス。
+これでもHelloWorldかっていうwwww
+
+そうはいってもっていう
+結構難しいっていう
+"+"の数大杉っていう
+うまくつなげるのがムズイっていう
+いつまで "っていう" が続くのかっていうwwww
+でっていうマジウゼェ言われるのも納得っていうwwww
+でででっていうででっていう
+
+まだ続くワロスっていう。
+「でででっていうででっていう」で稼ぐしかないっていう。
+笑ってみるしかないっていう。
+
+ニヤニヤニヤニヤニヤニヤwww
+
+キリッ
+ワロス
+ププッ
+
+真面目顔ワロスっていうwww
+ででででっていう。
+ププッ
+でっていう。
+
+Translatorのアイデア自体は悪くないかもっていう。
+でもTranslatorの調整がめんどいっていう。
+どうしても"+"が多くなるっていう。
+"+"と"-"のバランスも難しいっていう。
+下手に「っていう」みたいな語尾を"+"にするとマジウザイっていうププッ。
+
+ププッ ザマァっていう。
+
+ででででっていうでっていう
+
+マジウゼェ ププッ テラワロスwww
+
+しかも"-"の数もププッ出てくる時は大量に出過ぎwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwププッ
+ニヤニヤ
+どんだけ草生やす気っていうででででっていう。
+調整ムズスギっていう。
+ででででっていうでっていう。
+少し手抜きさせてほしいっていう。
+もう少しっていう。
+マジHelloWorldだけでウザっていう。ププッ
+wwwwwwwwwwwwwwwwwwwwwwww
+ププッ 草生やすのも大変っていう。
+でっていうででででっていう
+ププッ
+ステガノグラフィにしても手間かかりスギwwwwwwwwwwwwwwwwww
+ププッwwwwwwwwwwwwwwwwwwwwwwww
+ププッワロス
+あと少しっていう。
+ププッ
+
+以下、1文字入力して1文字表示。
+
+「や ら な い か」
+「ププッ」
Acme_BrainPhack/trunk/Acme/BrainPhack/test/scripts_test.php
@@ -0,0 +1,48 @@
+<?php
+/*
+ * Copyright (c) 2010 msakamoto-sf <msakamoto-sf@users.sourceforge.net>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.*
+ */
+
+/**
+ * @package Acme_BrainPhack
+ * @author msakamoto-sf <msakamoto-sf@users.sourceforge.net>
+ * @version $Id$
+ */
+
+// script file manual test bootstrap
+
+$include_path = ini_get('include_path');
+$__base_dir = realpath(dirname(__FILE__));
+//$__pear_src_dir = realpath($__base_dir.'/../');
+$__pear_src_dir = realpath($__base_dir.'/../../../'); // TODO
+ini_set('include_path',
+ $__base_dir.PATH_SEPARATOR.$__pear_src_dir.PATH_SEPARATOR.$include_path);
+
+// load and invoke script file
+$_script = realpath($__base_dir.'/../../../scripts/brainphack.sh');
+require_once($_script);
+
+/**
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ * vim: set expandtab tabstop=4 shiftwidth=4:
+ */
+
属性に変更があったパス: Acme_BrainPhack/trunk/Acme/BrainPhack/test/scripts_test.php
___________________________________________________________________
名前: svn:keywords
+ Id
Acme_BrainPhack/trunk/Acme/BrainPhack/test/README
@@ -8,6 +8,9 @@
- stdin_test.php : Run only "," instruction. Confirm input and output by hand..
+- scripts_test.php : Run scripts/brainphack.sh wrapper.
+ Try sample helloworlds in "testsrc" directory.
+
For more details, read source codes.
Thank you.
Acme_BrainPhack/trunk/scripts/brainphack.sh
@@ -24,6 +24,10 @@
*/
require_once('Console/GetOpt.php');
+require_once('PEAR/ErrorStack.php');
+require_once('Acme/BrainPhack/Translator.php');
+require_once('Acme/BrainPhack/MemoryStack.php');
+require_once('Acme/BrainPhack/Interpreter.php');
function usage()
{
@@ -96,6 +100,39 @@
exit(1);
}
+$bpt =& new Acme_BrainPhack_Translator();
+$bptm =& $bpt->getMapper($settings['translator']);
+$map = $bptm->getMap();
+$bpsrc = $bpt->translate($map, $src);
-var_dump($settings);
+if (true === $settings['convert_not_run']) {
+ echo $bpsrc;
+ echo "\n";
+ exit(0);
+}
+$sz = 1024 * $settings['stack_size'];
+$bpms =& new Acme_BrainPhack_MemoryStack($sz, 0);
+$errorStack =& new PEAR_ErrorStack('Acme_BrainPhack CUI ErrorStack');
+$bpi =& new Acme_BrainPhack_Interpreter($bpms, $errorStack);
+$bpi->run($bpsrc);
+$errors = $errorStack->getErrors(true);
+foreach ($errors as $e) {
+ $_l = $e['level'];
+ $_m = $e['message'];
+ $_c = $e['code'];
+ $_p = '(' . implode(', ', $e['params']) . ')';
+ echo "{$_l} {$_m} {$_p} (code={$_c})\n";
+}
+
+/**
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ * vim: set expandtab tabstop=4 shiftwidth=4 filetype=php:
+ */