• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisão01478f7b3711aa3d6e202a8b63fbe000fccad011 (tree)
Hora2017-04-04 22:32:21
Autordhrname <dhrname@user...>
Commiterdhrname

Mensagem de Log

Add the alpha conversation

Mudança Sumário

Diff

--- a/source_code/Makefile
+++ b/source_code/Makefile
@@ -1,21 +1,21 @@
11 CC = gcc
2-DEBUGMODE = -O0 -g
2+DEBUGMODE = -O0 -g -pg
33 NODEBUGMODE = -O2
44 all : startest star
55 .PHONY : all
66
77 star.o: star.c
8- $(CC) -fopenmp -Wall -std=c11 $(NODEBUGMODE) -c star.c
8+ $(CC) -Wall -std=c11 $(NODEBUGMODE) -c star.c
99
1010 shadowstar.o: shadowstar.c
11- $(CC) -fopenmp -Wall -std=c11 $(NODEBUGMODE) -c shadowstar.c
11+ $(CC) -Wall -std=c11 $(NODEBUGMODE) -c shadowstar.c
1212
1313 star: shadowstar.o star.o
1414 $(CC) -Wall -std=c11 $(NODEBUGMODE) -o ../star shadowstar.o star.o
1515
1616
1717 startest.o: startest.c
18- $(CC) -fopenmp -Wall -std=c11 $(NODEBUGMODE) -c startest.c
18+ $(CC) -Wall -std=c11 $(NODEBUGMODE) -c startest.c
1919
2020 startest: shadowstar.o startest.o
2121 $(CC) -Wall -std=c11 $(NODEBUGMODE) -o ../startest shadowstar.o startest.o
--- a/source_code/shadowstar.c
+++ b/source_code/shadowstar.c
@@ -292,15 +292,44 @@ ST_Ordered_Pair *ST_tokenize(const int_least8_t *text, ST_Token_Mode *array)
292292 * 「ARR01-C. 配列のサイズを求めるときに sizeof 演算子をポインタに適用しない」
293293 * http://www.jpcert.or.jp/sc-rules/c-arr01-c.html
294294 * 実行処理のみ実装*/
295+/* 1, λx.x y
296+ * 2, y x.xλ
297+ * 3, 「ワイをエックス」(エックス)*/
295298 bool ST_parse(ST_Token_Mode *array, size_t length, ST_Ordered_Pair *list)
296299 {
297300 if (ST_isEmpty(list))
298301 {
299302 return false;
300303 }
304+
305+ /*衝突しそうな変数は前もってアルファ変換をしておく
306+ * listの値を変更することになるので、テストをすること
307+ * ex:
308+ * λx.λx.x ->α λx.λy.y
309+ * 「「甲」(甲)」(甲) ->α 「「乙」(乙)」(甲)
310+ * あるいは、
311+ * 「甲」(甲)「甲」(甲) ->α 「乙」(乙)「甲」(甲)*/
312+
313+ /*トークンモードの数値*/
314+ ST_Token_Mode mode = ST_UNKNOWN_TOKEN;
315+
316+ /*探すべき変数の値*/
317+ double varcode = 0.0;
318+
319+ /*リストの現在のヘッダー*/
320+ ST_Ordered_Pair *head = list;
321+
322+#pragma omp parallel for
301323 for (int_fast32_t i = length-1; i >= 0; i--)
302324 {
303-
325+ mode = array[i];
326+ if (mode == ST_VARIABLE_TOKEN)
327+ {
328+ double code = ST_first(head);
329+ /*ここでリストの値を書き換えていることに注意*/
330+ head->first = code / (double) rand();
331+ head = ST_second(head);
332+ }
304333 }
305334 return true;
306335 }
--- a/source_code/shadowstar.h
+++ b/source_code/shadowstar.h
@@ -39,8 +39,6 @@ extern "C" {
3939
4040
4141
42-
43-
4442 /** Run modes for the basic interface. */
4543 typedef enum {
4644 CU_BRM_NORMAL = 0, /**< Normal mode - failures and run summary are printed [default]. */
Binary files a/source_code/shadowstar.o and b/source_code/shadowstar.o differ
--- a/source_code/startest.c
+++ b/source_code/startest.c
@@ -237,12 +237,20 @@ int main(int argc, char **argv)
237237 assert(ST_parse(tokens, length, &ST_EMPTY) == false);
238238 varlist = ST_tokenize(u8"aBa愛", tokens);
239239 assert(ST_parse(tokens, length, varlist) == true);
240+ ST_freelist(varlist);
240241 init_token(tokens1);
241242 length = sizeof(tokens1)/sizeof(tokens1[0]);
242243 ST_parse(tokens1, length, &ST_EMPTY);
243244 assert(ST_parse(tokens1, length, &ST_EMPTY) == false);
244245 varlist = ST_tokenize(u8"aBa愛", tokens1);
245246 assert(ST_parse(tokens1, length, varlist) == true);
247+ ST_freelist(varlist);
248+ init_token(tokens1);
249+ varlist = ST_tokenize(u8"(愛あ)(愛)", tokens1);
250+ assert(ST_parse(tokens1, length, varlist) == true);
251+ assert(ST_first(ST_second(varlist)) != ST_first(varlist));
252+ ST_freelist(varlist);
253+
246254
247255
248256 ST_Token_Mode tokenmode = ST_FUNCTION_APPLY_TOKEN;
Binary files a/source_code/startest.o and b/source_code/startest.o differ