• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版2c88c8ad05a46d02c9cf97b76b8c9cf7fa829f4e (tree)
时间2017-09-15 23:42:29
作者dhrname <dhrname@user...>
Commiterdhrname

Log Message

Modify the ST_parse function

更改概述

差异

--- a/source_code/shadowstar.c
+++ b/source_code/shadowstar.c
@@ -377,7 +377,7 @@ static inline void alphaconvert(ST_Token_Mode *array, size_t length, ST_Ordered_
377377 /*ST_parse関数
378378 * トークン配列arrayでパーサ解析
379379 * 連結リストのlistは束縛変数の値を格納している
380- * 返却値は解析リスト
380+ * 返却値は解析された二分木を収納した隣接リスト
381381 * arrayの長さとして、引数にlengthを用いる理由は以下を参照のこと
382382 * 「ARR01-C. 配列のサイズを求めるときに sizeof 演算子をポインタに適用しない」
383383 * http://www.jpcert.or.jp/sc-rules/c-arr01-c.html
@@ -403,17 +403,19 @@ ST_Binary_Tree ST_parse(ST_Token_Mode *array, size_t length, ST_Ordered_Pair *l
403403 * 「甲」(甲)「甲」(甲) ->α 「乙」(乙)「甲」(甲)*/
404404 alphaconvert(array, length, list);
405405
406+ /*関数抽象を表す木構造*/
407+ ST_Binary_Tree tree = ST_pairTree(list, ST_second(ST_second(list)));
406408
407- return true;
409+ /*隣接リストの親ルート。このリストの右側の枝に、関数抽象treeを格納*/
410+ ST_Binary_Tree root = ST_pairTree(&ST_EMPTY, tree);
411+
412+ return root;
408413 }
409414
410415 /*ベータ簡約を用いて、解析木の評価を行う*/
411416 ST_Ordered_Pair *ST_eval()
412417 {
413- /*前もって、簡単なベータ簡約を実施しておく
414- * listの値を変更することになるので、テストをすること
415- * 甲を「乙」(乙) ->β 甲
416- * 実際には、甲を「甲」(乙)と残しておく*/
418+
417419 }
418420
419421 /*以下の連結リスト構造については数学の集合とラムダ計算と項書き換え系を参照のこと
@@ -673,7 +675,7 @@ static inline bool is_Branch_From_Outer(ST_Binary_Tree first, ST_Binary_Tree sec
673675 }
674676
675677 /*ST_pairTree 関数
676- * 二つのST_Ordered_Pair型を用いて、二分木を作成する
678+ * 引数で指定された二つのST_Ordered_Pair型を用いて、二分木を作成する
677679 * それぞれ、左の枝と右の枝にぶら下げられる*/
678680 ST_Binary_Tree ST_pairTree(ST_Binary_Tree first, ST_Binary_Tree second)
679681 {
Binary files a/source_code/shadowstar.o and b/source_code/shadowstar.o differ
--- a/source_code/star.h
+++ b/source_code/star.h
@@ -136,7 +136,7 @@ ST_Binary_Tree ST_getSecondTree(ST_Binary_Tree);
136136
137137 /*ST_pairTree 関数
138138 * 二つのST_Ordered_Pair型を用いて、二分木を作成する
139- * それぞれ、左の枝と右の枝にぶら下げられる*/
139+ * それぞれ、一番目の左の枝と、二番目の右の枝にぶら下げられる*/
140140 ST_Binary_Tree ST_pairTree(ST_Binary_Tree, ST_Binary_Tree);
141141
142142 /*ST_freetree 関数
--- a/source_code/startest.c
+++ b/source_code/startest.c
@@ -300,8 +300,11 @@ int main(int argc, char **argv)
300300
301301 init_token_length(tokens5, length);
302302 varlist = ST_tokenize(u8"謎は「愛を愛する」(愛)", tokens5);
303- assert(ST_parse(tokens5, length, varlist) == true);
304-
303+ ST_Binary_Tree btr = ST_parse(tokens5, length, varlist);
304+ assert(ST_isEmpty(ST_getFirstTree(btr)));
305+ assert(ST_first(ST_getFirstTree(ST_getSecondTree(btr))) == ST_first(varlist));
306+ ST_freelist(btr);
307+ ST_freelist(varlist);
305308
306309 ST_Token_Mode tokenmode = ST_FUNCTION_APPLY_TOKEN;
307310 assert(tokenmode == 1);
Binary files a/source_code/startest.o and b/source_code/startest.o differ