From: Marjolein Zwerver Date: Fri, 30 May 2014 19:11:19 +0000 (+0200) Subject: aanpassing semantiek & analyse X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=bf5101db32613e6ccd3b6cc3043734822cf29bd9;p=sec1415.git aanpassing semantiek & analyse --- diff --git a/Clean System Files/_semantic_functions_options.o b/Clean System Files/_semantic_functions_options.o new file mode 100644 index 0000000..07a549f Binary files /dev/null and b/Clean System Files/_semantic_functions_options.o differ diff --git a/Clean System Files/semantic_functions.abc b/Clean System Files/semantic_functions.abc new file mode 100644 index 0000000..a84bea9 --- /dev/null +++ b/Clean System Files/semantic_functions.abc @@ -0,0 +1,2130 @@ +.comp 920 00011101001 +.start __semantic_functions_Start +.depend "StdReal" "20111221123336" +.depend "StdChar" "20111221123336" +.depend "StdBool" "20111221123336" +.depend "StdClass" "20111221123336" +.depend "StdList" "20111221123336" +.depend "StdOverloaded" "20111221123336" +.depend "StdInt" "20111221123336" +.depend "semantic_functions" "20140530152128" +.module m_semantic_functions "semantic_functions" "20140530175504" +.endinfo +.implab _cycle_in_spine +.implab _type_error +.implab _hnf +.impdesc _ind +.implab _indirection _eaind +.impdesc e_system_dif +.implab e_system_nif e_system_eaif +.implab e_system_sif +.impdesc e_system_dAP +.implab e_system_nAP e_system_eaAP +.implab e_system_sAP +.impdesc _Nil +.impdesc _Cons +.impdesc _Conss +.implab n_Conss ea_Conss +.impdesc _Consts +.implab n_Consts ea_Consts +.impdesc _Conssts +.implab n_Conssts ea_Conssts +.impdesc _Tuple +.impdesc d_S.1 +.implab n_S.1 ea_S.1 +.impdesc d_S.2 +.implab n_S.2 ea_S.2 +.impdesc d_S.3 +.implab n_S.3 ea_S.3 +.impdesc d_S.4 +.implab n_S.4 ea_S.4 +.impdesc d_S.5 +.implab n_S.5 ea_S.5 +.impdesc d_S.6 +.implab n_S.6 ea_S.6 +.implab _driver +.implab e_StdBool_snot +.impdesc e_StdList_d++ +.implab e_StdList_s++ +.implab e_StdList_n++ e_StdList_ea++ +.implab e_StdList_slength;47 +.implab e_StdInt_s+;6 +.impdesc e_StdInt_d-;7 +.implab e_StdInt_s-;7 +.implab e_StdInt_n-;7 +.impdesc e_StdInt_d*;9 +.implab e_StdInt_n*;9 +.implab e_StdInt_s==;16 +.implab e_StdInt_s<;17 +.export __semantic_functions_Start +.o 0 0 +__semantic_functions_Start + build _ 0 n20 +.d 1 0 + jmp _driver +.n 0 _ ea20 +.o 1 0 +n20 + push_node _cycle_in_spine 0 +.o 1 0 +ea20 +.o 1 0 +s20 +.d 1 0 + jmp s25 +.o 1 0 +s25 + create +.d 1 0 + jsr s26 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s12 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 +.d 2 0 + jmp s3 +.o 1 0 +s26 + create +.d 1 0 + jsr s27 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 4 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s7 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 +.d 2 0 + jmp s1 +.o 1 0 +s27 + create +.d 1 0 + jsr s28 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s12 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 +.d 2 0 + jmp s3 +.o 1 0 +s28 + create +.d 1 0 + jsr s29 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 4 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s7 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 +.d 2 0 + jmp s1 +.o 1 0 +s29 + create +.d 1 0 + jsr s30 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s12 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 +.d 2 0 + jmp s3 +.o 1 0 +s30 + create +.d 1 0 + jsr s31 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 4 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s7 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 +.d 2 0 + jmp s1 +.o 1 0 +s31 + create +.d 1 0 + jsr s32 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s12 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s11 +.o 1 0 +.d 2 0 + jmp s3 +.o 1 0 +s32 + buildh _Nil 0 + buildI 5 + buildh _Cons 2 + buildI 1 + buildh _Cons 2 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 4 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s7 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s10 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s6 +.o 1 0 + create + buildI 3 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s1 +.o 1 0 + create + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 +.d 2 0 + jsr s3 +.o 1 0 + create + buildI 2 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 + create + buildI 1 + push_a 2 + update_a 2 3 + update_a 0 2 + pop_a 1 +.d 3 0 + jsr s4 +.o 1 0 +.d 2 0 + jmp s1 +.o 2 0 +s12 + eq_desc _Nil 0 0 + jmp_true case.1 + jmp case.2 +case.1 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.2 + repl_args 2 2 + jsr_eval 1 + eq_desc _Nil 0 1 + jmp_true case.3 + jmp case.4 +case.3 + buildh _Nil 0 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.4 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + push_a 0 + jsr_eval 0 + pushI_a 1 + pop_a 1 + push_a 2 + jsr_eval 0 + pushI_a 3 + pop_a 1 + ltI + notB + jmp_false else.5 + push_a 1 + buildI 0 + fillh _Cons 2 6 + pop_a 4 +.d 1 0 + rtn +else.5 + push_a 1 + buildI 1 + fillh _Cons 2 6 + pop_a 4 +.d 1 0 + rtn +.o 2 0 +s11 + eq_desc _Nil 0 0 + jmp_true case.6 + jmp case.7 +case.6 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.7 + repl_args 2 2 + jsr_eval 0 + eqI_a 0 0 + jmp_true case.8 + jmp case.9 +case.8 + push_a 1 + buildI 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.9 + push_a 1 + buildI 0 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +.o 2 0 +s10 + eq_desc _Nil 0 0 + jmp_true case.10 + jmp case.11 +case.10 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.11 + repl_args 2 2 + push_a 1 + push_a 1 + buildh _Cons 2 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +.o 2 0 +s7 + eq_desc _Nil 0 0 + jmp_true case.12 + jmp case.13 +case.12 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.13 + repl_args 2 2 + jsr_eval 1 + eq_desc _Nil 0 1 + jmp_true case.14 + jmp case.15 +case.14 + buildh _Nil 0 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.15 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + push_a 2 + push_a 1 + build _ 2 e_StdInt_n*;9 + push_a 2 + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 + fillh _Cons 2 6 + pop_a 4 +.d 1 0 + rtn +.o 2 0 +s6 + eq_desc _Nil 0 0 + jmp_true case.16 + jmp case.17 +case.16 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.17 + repl_args 2 2 + jsr_eval 1 + eq_desc _Nil 0 1 + jmp_true case.18 + jmp case.19 +case.18 + buildh _Nil 0 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.19 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + push_a 2 + push_a 1 + build _ 2 e_StdInt_n-;7 + push_a 2 + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 + fillh _Cons 2 6 + pop_a 4 +.d 1 0 + rtn +.o 3 0 +s4 + eq_desc _Nil 0 1 + jmp_true case.20 + jmp case.21 +case.20 + buildh _Nil 0 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.21 + buildh _Nil 0 + push_a 1 + buildh _Cons 2 + push_a 2 + push_a 1 + update_a 1 2 + update_a 0 1 + pop_a 1 + update_a 1 3 + updatepop_a 0 2 +.d 3 0 + jmp e_StdList_s++ +.o 2 0 +s3 + eq_desc _Nil 0 0 + jmp_true case.22 + jmp case.23 +case.22 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.23 + repl_args 2 2 + pop_a 1 + jmp_eval_upd +.export e_semantic_functions_sroll +.export e_semantic_functions_earoll +.descexp e_semantic_functions_droll e_semantic_functions_nroll e_semantic_functions_lroll 1 0 "roll" +.o 2 0 +e_semantic_functions_lroll + update_a 1 0 + create + update_a 0 2 + pop_a 1 +.d 2 0 + jmp e_semantic_functions_earoll +.n 1 e_semantic_functions_droll e_semantic_functions_earoll +.o 1 0 +e_semantic_functions_nroll + push_node _cycle_in_spine 1 +.o 2 0 +e_semantic_functions_sroll +.o 2 0 +e_semantic_functions_earoll + jsr_eval 0 +.o 2 0 +s1 + eq_desc _Nil 0 0 + jmp_true case.24 + jmp case.25 +case.24 + fillh _Nil 0 1 + pop_a 1 +.d 1 0 + rtn +case.25 + repl_args 2 2 + jsr_eval 1 + eq_desc _Nil 0 1 + jmp_true case.26 + jmp case.27 +case.26 + buildh _Nil 0 + push_a 1 + fillh _Cons 2 4 + pop_a 2 +.d 1 0 + rtn +case.27 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + push_a 0 + jsr_eval 0 + pushI_a 1 + pop_a 1 + push_a 2 + jsr_eval 0 + pushI_a 3 + pop_a 1 +.d 0 2 ii + jsr s15 +.o 0 1 i + pushI 0 + push_b 1 + update_b 1 2 + update_b 0 1 + pop_b 1 + eqI + jmp_false else.28 + updatepop_a 1 3 + jmp_eval_upd +else.28 + pushI_a 0 + pushI 0 + ltI + notB + jmp_false else.29 + updatepop_a 1 3 + jmp_eval_upd +else.29 + push_a 1 + jsr_eval 0 +.d 1 0 + jsr e_StdList_slength;47 +.o 0 1 i + pushI_a 0 + push_b 1 + update_b 1 2 + update_b 0 1 + pop_b 1 + ltI + jmp_false else.30 + fill_a 1 4 + pop_a 4 +.d 1 0 + rtn +else.30 + pushI 1 + pushI_a 2 + eqI + jmp_false else.31 + push_a 1 + push_a 1 + buildh _Cons 2 + updatepop_a 0 4 +.d 2 0 + jmp s2 +else.31 + pushI_a 2 + pushI 0 + ltI + jmp_false else.32 + push_a 1 + push_a 1 + buildh _Cons 2 + build e_semantic_functions_droll1 1 e_semantic_functions_nroll1 + buildh _Nil 0 + push_a 2 + buildh _Cons 2 + build e_StdList_d++ 2 e_StdList_n++ + buildh _Nil 0 + buildI 1 + push_a 5 + build _ 2 e_StdInt_n-;7 + buildh _Cons 2 + create + push_a 2 + update_a 1 3 + update_a 2 1 + update_a 0 2 + pop_a 1 + update_a 2 6 + update_a 1 5 + updatepop_a 0 4 +.d 3 0 + jsr e_StdList_s++ +.o 1 0 +.d 2 0 + jmp s1 +else.32 + pushI 0 + pushI_a 2 + ltI + jmp_false else.33 + push_a 1 + push_a 1 + buildh _Cons 2 + buildh _Nil 0 + push_a 2 + push_a 5 + build _ 2 n15 + buildh _Cons 2 + create + push_a 2 + update_a 1 3 + update_a 2 1 + update_a 0 2 + pop_a 1 + update_a 2 6 + update_a 1 5 + updatepop_a 0 4 +.d 3 0 + jsr e_StdList_s++ +.o 1 0 +.d 2 0 + jmp s1 +else.33 + pop_a 3 + jmp s1.1 +s1.1 + pop_a 2 + pushD m_semantic_functions + pushD e_semantic_functions_droll +.d 0 2 ii + jmp _match_error +.export e_semantic_functions_sroll1 +.export e_semantic_functions_earoll1 +.descexp e_semantic_functions_droll1 e_semantic_functions_nroll1 e_semantic_functions_lroll1 1 0 "roll1" +.o 2 0 +e_semantic_functions_lroll1 + update_a 1 0 + create + update_a 0 2 + pop_a 1 +.d 2 0 + jmp e_semantic_functions_earoll1 +.n 1 e_semantic_functions_droll1 e_semantic_functions_earoll1 +.o 1 0 +e_semantic_functions_nroll1 + push_node _cycle_in_spine 1 +.o 2 0 +e_semantic_functions_sroll1 +.o 2 0 +e_semantic_functions_earoll1 + jsr_eval 0 +.o 2 0 +s2 + eq_desc _Cons 2 0 + jmp_true case.34 + jmp s2.1 +case.34 + repl_args 2 2 + jsr_eval 0 + eqI_a 1 0 + jmp_true case.35 + jmp case.36 +case.35 + pop_a 1 + jmp_eval_upd +case.36 + jsr_eval 1 + eq_desc _Cons 2 1 + jmp_true case.37 + pop_a 1 + jmp s2.1 +case.37 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + jsr_eval 1 + eq_desc _Cons 2 1 + jmp_true case.38 + pop_a 3 + jmp s2.1 +case.38 + push_args 1 2 2 + buildh _Nil 0 + update_a 0 4 + pop_a 1 + push_a 1 + push_a 3 + buildh _Cons 2 + buildI 1 + push_a 6 + build _ 2 e_StdInt_n-;7 + buildh _Cons 2 + build e_semantic_functions_droll1 1 e_semantic_functions_nroll1 + buildh _Nil 0 + push_a 2 + buildh _Cons 2 + update_a 1 7 + updatepop_a 0 6 +.d 3 0 + jmp e_StdList_s++ +s2.1 + pop_a 2 + pushD m_semantic_functions + pushD e_semantic_functions_droll1 +.d 0 2 ii + jmp _match_error +.n 2 _ +.o 1 0 +n15 + push_node _cycle_in_spine 2 +.d 2 0 + jsr ea15 +.o 0 1 i + fillI_b 0 0 + pop_b 1 +.d 1 0 + rtn +.o 2 0 +ea15 + jsr_eval 1 + jsr_eval 0 + pushI_a 1 + pushI_a 0 + pop_a 2 +.o 0 2 ii +s15 + pushI 0 + push_b 1 + ltI + jmp_false else.39 + push_b 1 + push_b 1 + addI + push_b 2 + push_b 1 + update_b 1 2 + update_b 0 1 + pop_b 1 + update_b 1 3 + updatepop_b 0 2 +.d 0 2 ii + jmp s15 +else.39 + push_b 1 + push_b 1 + ltI + jmp_false else.40 + update_b 0 1 + pop_b 1 +.d 0 1 i + rtn +else.40 + push_b 1 + push_b 1 + subI + push_b 2 + push_b 1 + update_b 1 2 + update_b 0 1 + pop_b 1 + update_b 1 3 + updatepop_b 0 2 +.d 0 2 ii + jmp s15 diff --git a/Clean System Files/semantic_functions.o b/Clean System Files/semantic_functions.o new file mode 100644 index 0000000..9b437d2 Binary files /dev/null and b/Clean System Files/semantic_functions.o differ diff --git a/an_faculteit.tex b/an_faculteit.tex index 695fb4d..7db77ea 100644 --- a/an_faculteit.tex +++ b/an_faculteit.tex @@ -95,3 +95,35 @@ Wat in piet er uit zit als in \ref{fig:img3} \fbox{\includegraphics[natheight=320px, natwidth=256px, height=320px, width=256px]{img3.png}} \end{figure} + +\begin{landscape} +De afleidingsrij voor 1! ziet er als volgt uit:\\ +$ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1;push \: 1, [\:], [\:], [\:]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2;push \: 1, [\:], [\:], [1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1;push \: 2, [\:], [\:], [1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll;push \: 1, [\:], [\:], [2,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup;roll, [\:], [\:], [1,2,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3;dup, [\:], [\:], [1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1;push \: 3, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll;push \: 1, [\:], [\:], [3,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1;roll, [\:], [\:], [1,3,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;push \: 1, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not;subtract;, [\:], [\:], [1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1;not, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1;push \: 1, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract;push\:1, [\:], [\:], [1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater;subtract, [\:], [\:], [1,1,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not;greater, [\:], [\:], [0,1,1,1]\rangle \Rightarrow\\ +\langle pointer; not, [\:], [\:], [1,1,1]\rangle \Rightarrow\\ +\langle pointer [\:], [\:], [0,1,1]\rangle \Rightarrow\\ +\langle [\:], [\:], [1,1]\rangle\\ +\ +$ +Eerst worden x en y op de stack gepusht zodat de stack [y,x] = [1,1]. +Deze stack is gelijk aan de stack in de termineerende configuratie: 1 = 1! dus y = x!. +Als bewijs dat de wiskundige operaties op de stack goed zijn uitgevoerd staat in +de appendix onder het kopje voorbeelden een stukje code. In het programma +eenfaculteit worden alle wiskundige operaties die bij de commando's horen +achter elkaar uitgevoerd op de stack, waarbij het resultaat [1,1] is. +\end{landscape} \ No newline at end of file diff --git a/appendix.tex b/appendix.tex index 3bacb77..ed1e909 100644 --- a/appendix.tex +++ b/appendix.tex @@ -1 +1,6 @@ -\lstinputlisting[language=Clean, lastline=100]{functions.icl} \ No newline at end of file +\subsection{help functies} +\lstinputlisting[language=Clean, lastline=88]{semantic_functions.icl} +\subsection{voorbeelden} +\begin{landscape} +\lstinputlisting[language=Clean,firstline=90, lastline=120]{semantic_functions.icl} +\end{landscape} diff --git a/functions.icl b/functions.icl deleted file mode 100644 index 8250323..0000000 --- a/functions.icl +++ /dev/null @@ -1,122 +0,0 @@ -implementation module roll - -import StdInt, StdList - -d :: [Int] -> [Int] -d [] = [] -d [a:rest] = rest - -e :: [Int] Int -> [Int] -e [] a = [a] -e [b] a = [a] ++ [b] - -add :: [Int] -> [Int] -add [] = [] -add [a] = [a] -add [a:b:rest] = [b+a:rest] - -sub :: [Int] -> [Int] -sub [] = [] -sub [a] = [a] -sub [a:b:rest] = [b-a:rest] - -mul :: [Int] -> [Int] -mul [] = [] -mul [a] = [a] -mul [a:b:rest] = [b*a:rest] - -div :: [Int] -> [Int] -div [] = [] -div [a] = [a] -div [a:b:rest] = [b/a:rest] - -modc :: [Int] -> [Int] -modc[] = [] -modc[a] = [a] -modc[a:b:rest] = [modulo b a:rest] - -dup :: [Int] -> [Int] -dup[] = [] -dup[a:rest] = [a:a:rest] - -notc :: [Int] -> [Int] -notc[] = [] -notc[0:rest] = [1:rest] -notc[_:rest] = [0:rest] - -gre :: [Int] -> [Int] -gre[] = [] -gre[a] = [a] -gre[a:b:rest] -|a >= b = [0:rest] -|otherwise = [1:rest] - -roll :: [Int] -> [Int] -roll [] = [] -roll [a] = [a] -roll [a:b:rest] -|modulo a b == 0 = rest -|b <= 0 = rest -|b > length rest = rest -|a == 1 = roll1 [b:rest] -|a > 0 = roll ([a-1] ++ [b] ++ roll1 [b:rest]) -|a < 0 = roll ([modulo a b] ++ [b:rest]) - -pointer :: [Int] -> [Int] -pointer [] = [] -pointer [a:rest] = rest - -//outnum_s :: stack_output stack -> stack_output -outnum_s :: [Int] [Int] -> [Int] -outnum_s _ [] = [] -outnum_s _ [a:rest] = rest - -outnum_so :: [Int] [Int] -> [Int] -outnum_so so [] = so -outnum_so so [a:rest] = add_to_s a so - -//innum_s :: stack_input stack -> stack -innum_s :: [Int] [Int] -> [Int] -innum_s [] _ = [] -innum_s [a:rest] s = add_to_s a s - -innum_si :: [Int] [Int] -> [Int] -innum_si [] s = [] -innum_si [a:rest] s = rest - -//help functions -roll1 :: [Int] -> [Int] -roll1 [1:rest] = rest -roll1 [b:c:d:rest] = [d] ++ roll1[b-1:c:rest] - -modulo :: Int Int -> Int -modulo a b -|a<0 = modulo (a+b) b -|a [a] -add_to_s a [] = [a] -add_to_s a b = b ++ [a] - -x = 5 -y = 1 -stack = [] -so = [] -si = [] - -Start = start51 - -start21 = (notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[2,1]))))))))))))))) -start22 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[1,2])))))))))))))))))))))))))))) -start23 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(push 1 (push 2 stack))))))))))))))))) - -start51 = (notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[120,1]))))))))))))))) -start52 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[60,2])))))))))))))))))))))))))))) -start53 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[60,2]))))))))))))))) -start54 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[20,3])))))))))))))))))))))))))))) -start55 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[20,3]))))))))))))))) -start56 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[5,4])))))))))))))))))))))))))))) -start57 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[5,4]))))))))))))))) -start58 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[1,5])))))))))))))))))))))))))))) -start59 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(push y (push x stack))))))))))))))))) diff --git a/img/Thumbs.db b/img/Thumbs.db new file mode 100644 index 0000000..ca9c33b Binary files /dev/null and b/img/Thumbs.db differ diff --git a/semantic_functions.dcl b/semantic_functions.dcl new file mode 100644 index 0000000..f198566 --- /dev/null +++ b/semantic_functions.dcl @@ -0,0 +1,3 @@ +definition module semantic_functions +roll :: [Int] -> [Int] +roll1 :: [Int] -> [Int] \ No newline at end of file diff --git a/semantic_functions.exe b/semantic_functions.exe new file mode 100644 index 0000000..ac11aa1 Binary files /dev/null and b/semantic_functions.exe differ diff --git a/semantic_functions.icl b/semantic_functions.icl new file mode 100644 index 0000000..adf2ba2 --- /dev/null +++ b/semantic_functions.icl @@ -0,0 +1,112 @@ +implementation module semantic_functions + +import StdInt, StdList + +d :: [Int] -> [Int] +d [] = [] +d [a:rest] = rest + +e :: Int [Int] -> [Int] +e a [] = [a] +e a b = [a] ++ b + +add :: [Int] -> [Int] +add [] = [] +add [a] = [a] +add [a:b:rest] = [b+a:rest] + +sub :: [Int] -> [Int] +sub [] = [] +sub [a] = [a] +sub [a:b:rest] = [b-a:rest] + +mul :: [Int] -> [Int] +mul [] = [] +mul [a] = [a] +mul [a:b:rest] = [b*a:rest] + +div :: [Int] -> [Int] +div [] = [] +div [a] = [a] +div [a:b:rest] = [b/a:rest] + +modc :: [Int] -> [Int] +modc[] = [] +modc[a] = [a] +modc[a:b:rest] = [modulo b a:rest] + +dup :: [Int] -> [Int] +dup[] = [] +dup[a:rest] = [a:a:rest] + +notc :: [Int] -> [Int] +notc[] = [] +notc[0:rest] = [1:rest] +notc[_:rest] = [0:rest] + +gre :: [Int] -> [Int] +gre[] = [] +gre[a] = [a] +gre[a:b:rest] +|a >= b = [0:rest] +|otherwise = [1:rest] + +roll :: [Int] -> [Int] +roll [] = [] +roll [a] = [a] +roll [a:b:rest] +|modulo a b == 0 = rest +|b <= 0 = rest +|b > length rest = rest +|a == 1 = roll1 [b:rest] +|a > 0 = roll ([a-1] ++ [b] ++ roll1 [b:rest]) +|a < 0 = roll ([modulo a b] ++ [b:rest]) + +roll1 :: [Int] -> [Int] +roll1 [1:rest] = rest +roll1 [b:c:d:rest] = [d] ++ roll1[b-1:c:rest] + +//outnum_so :: stack_output stack -> stack_output +outnum_so :: [Int] [Int] -> [Int] +outnum_so so [] = so +outnum_so so [a:rest] = add_to_s a so + +//innum_s :: stack_input stack -> stack +innum_s :: [Int] [Int] -> [Int] +innum_s [] _ = [] +innum_s [a:rest] s = add_to_s a s + +//help functions +modulo :: Int Int -> Int +modulo a b +|a<0 = modulo (a+b) b +|a [a] +add_to_s a [] = [a] +add_to_s a b = b ++ [a] + +x = 5 +y = 1 +stack = [] + +Start = vijffaculteit + +eenfaculteit = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2[1,1]))))))))))))))) + +tweefaculteit = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2 tweefaculteit1))))))))))))))) +tweefaculteit1 = roll(e 1(e 2(d(roll(e 2(e 3(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(d(roll(e 1(e 2(mul(roll(e 1(e 4(dup(roll(e 2(e 3(dup tweefaculteit2)))))))))))))))))))))))))))) +tweefaculteit2 = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(e 1 (e 2 stack))))))))))))))))) + +vijffaculteit = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2 vijffaculteit1))))))))))))))) +vijffaculteit1 = roll(e 1(e 2(d(roll(e 2(e 3(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(d(roll(e 1(e 2(mul(roll(e 1(e 4(dup(roll(e 2(e 3(dup vijffaculteit2)))))))))))))))))))))))))))) +vijffaculteit2 = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2 vijffaculteit3))))))))))))))) +vijffaculteit3 = roll(e 1(e 2(d(roll(e 2(e 3(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(d(roll(e 1(e 2(mul(roll(e 1(e 4(dup(roll(e 2(e 3(dup vijffaculteit4)))))))))))))))))))))))))))) +vijffaculteit4 = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2 vijffaculteit5))))))))))))))) +vijffaculteit5 = roll(e 1(e 2(d(roll(e 2(e 3(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(d(roll(e 1(e 2(mul(roll(e 1(e 4(dup(roll(e 2(e 3(dup vijffaculteit6)))))))))))))))))))))))))))) +vijffaculteit6 = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2 vijffaculteit7))))))))))))))) +vijffaculteit7 = roll(e 1(e 2(d(roll(e 2(e 3(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(d(roll(e 1(e 2(mul(roll(e 1(e 4(dup(roll(e 2(e 3(dup [1,5])))))))))))))))))))))))))))) +//[1,5] is the outcome of vijffaculteit8, but it won't run if not substituted +vijffaculteit8 = d(notc(gre(sub(e 1(e 1(notc(sub(e 1(roll(e 1(e 3(dup(roll(e 1(e 2(e y (e x stack))))))))))))))))) + diff --git a/semantic_functions.prj b/semantic_functions.prj new file mode 100644 index 0000000..f034c2d --- /dev/null +++ b/semantic_functions.prj @@ -0,0 +1,239 @@ +Version: 1.4 +Global + ProjectRoot: . + Built: True + Target: StdEnv + Exec: {Project}\semantic_functions.exe + CodeGen + CheckStacks: False + CheckIndexes: True + Application + HeapSize: 2097152 + StackSize: 512000 + ExtraMemory: 81920 + IntialHeapSize: 204800 + HeapSizeMultiplier: 4096 + ShowExecutionTime: False + ShowGC: False + ShowStackSize: False + MarkingCollector: False + StandardRuntimeEnv: True + Profile + Memory: False + MemoryMinimumHeapSize: 0 + Time: False + Stack: False + Output + Output: ShowConstructors + Font: Courier + FontSize: 9 + WriteStdErr: False + Link + LinkMethod: Static + GenerateRelocations: False + GenerateLinkMap: False + LinkResources: False + ResourceSource: + GenerateDLL: False + ExportedNames: + Paths + Path: {Project} + Precompile: + Postlink: +MainModule + Name: semantic_functions + Dir: {Project} + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False +OtherModules + Module + Name: StdArray + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdBool + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdChar + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdClass + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdEnum + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdInt + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdList + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdMisc + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdOverloaded + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdReal + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdString + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemArray + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemEnum + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False diff --git a/semantic_functions.prp b/semantic_functions.prp new file mode 100644 index 0000000..131e5bc --- /dev/null +++ b/semantic_functions.prp @@ -0,0 +1,78 @@ +Version: 1.4 +MainModule + Name: semantic_functions + Dir: {Project} + Dcl + WindowPosition + X: 10 + Y: 10 + SizeX: 800 + SizeY: 640 + DclOpen: False + IclOpen: True +OtherModules + Module + Name: StdArray + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdBool + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdChar + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdClass + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdEnum + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdInt + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdList + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdMisc + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdOverloaded + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdReal + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdString + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: _SystemArray + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: _SystemEnum + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False diff --git a/semantics.tex b/semantics.tex index 7812014..00eca8a 100644 --- a/semantics.tex +++ b/semantics.tex @@ -9,7 +9,9 @@ Om deze redenen hebben we gekozen voor sos.\\ Een toestand in onze semantiek wordt beschreven door drie stacks; input, output en programma. Respectievelijk benoemen we deze met $s_i, s_o, s$ en beschrijven ze de STDIN, STDOUT en interne stack van het programma. Stacks worden -gerepresenteerd als: $s=[e_0, e_1, \dots, e_n]$ waarbij $e_i\in\mathbb{Z}$\\ +gerepresenteerd als: $s=[e_0, e_1, \dots, e_n]$ waarbij $e_i\in\mathbb{Z}$ + en waarbij het bovenste element op de stack gerepresenteerd word door het + eerste element in de lijst.\\ Het transitie systeem zal twee verschillende transities kennen, namelijk:\\ $\langle S, s_i, s_o, s\rangle\Rightarrow\langle S', s_i', s_o', s'\rangle$ en\\ $\langle S, s_i, s_o, s\rangle\Rightarrow\langle s_i', s_o', s'\rangle$\\ @@ -30,7 +32,7 @@ Deze functie haalt het bovenste element van de stack en gooit deze weg.\\ extend functie (e, r. 9):\\ Om een stack uit te kunnen breiden met een element gebruiken we de volgende functie:\\ -$$\mathcal{E} : Stack\rightarrow (\mathbb{Z} \rightarrow Stack)$$\\ +$$\mathcal{E} : \mathbb{Z}\rightarrow (Stack\rightarrow Stack)$$\\ Deze functie neemt een stack en een integer en voegt de integer toe bovenop de stack.\\ @@ -100,24 +102,27 @@ Deze functie haalt de bovenste twee elementen van de stack en stopt 1 bovenop de stack als het tweede bovenste element een hogere waarde heeft als dat van het bovenste element. Anders word 1 bovenop de stack gestopt.\\ -pointer functie (pointer, r. 65):\\ +out number (output stack) functie (outnum, r. 79):\\ +Deze functie past de output stack aan als er een integer naartoe geschreven word:\\ +$$\mathcal{OUTN_{SO}} : Stack \rightarrow Stack$$\\ +Deze functie haalt het bovenste element van de stack en stopt dit element bovenop de output stack.\\ -out number functie (outnum, r. 74):\\ - -in number functie (innum, r. 83):\\ - - - - - -(switch, outchar, inchar)\\ +in number (stack) functie (innum, r. 84):\\ +Deze functie past de stack aan als er een integer naartoe geschreven word:\\ +$$\mathcal{INN_S} : Stack \rightarrow Stack$$\\ +Deze functie haalt het bovenste element van de input stack en stopt dit element bovenop de output stack.\\ +(outchar, inchar)\\ Met behulp van deze gedefinieerde functies kunnen we nu de volgende semantiekregels opstellen:\\ - - \begin{alignat*}{2} +{[comp^1_{sos}]}\qquad & +\frac{\langle S_1, s\rangle \Rightarrow \langle S'_1, s'\rangle} +{\langle S_1 ;S_2, s\rangle \Rightarrow \langle S'_1;S_2, s'\rangle}\\ +{[comp^2_{sos}]}\qquad & +\frac{\langle S_1, s\rangle \Rightarrow \langle s'\rangle} +{\langle S_1 ;S_2, s\rangle \Rightarrow \langle S_2, s'\rangle}\\ {[pop_{sos}]}\qquad & \langle pop, s_i, s_o, s\rangle \Rightarrow \langle s_i, s_o,\mathcal{D}(s)\rangle\\ @@ -148,6 +153,9 @@ Met behulp van deze gedefinieerde functies kunnen we nu de volgende semantiekreg {[pointer_{sos}]} \qquad & \langle pointer, s_i, s_o, s\rangle \Rightarrow \langle s_i, s_o, \mathcal{D}(s)\rangle\\ +{[switch_{sos}]} \qquad & +\langle switch, s_i, s_o, s\rangle \Rightarrow +\langle s_i, s_o, \mathcal{D}(s)\rangle\\ {[push_{sos}]} \qquad & \langle push \: n, s_i, s_o, s\rangle \Rightarrow \langle s_i, s_o, \mathcal{E}(n,s)\rangle\\ @@ -156,18 +164,15 @@ Met behulp van deze gedefinieerde functies kunnen we nu de volgende semantiekreg \langle s_i, s_o, \mathcal{ROLL}(s)\rangle\\ {[innum_{sos}]} \qquad & \langle innum, s_i, s_o, s\rangle \Rightarrow -\langle \mathcal{INN_{SI}}(s_i), s_o, \mathcal{INN_S}(s)\rangle\\ +\langle \mathcal{D}(s_i), s_o, \mathcal{INN_S}(s)\rangle\\ {[outnum_{sos}]} \qquad & \langle outnum, s_i, s_o, s\rangle \Rightarrow -\langle s_i, \mathcal{OUTN_{SO}}(s_o),\mathcal{OUTN_S}(s)\rangle\\ +\langle s_i, \mathcal{OUTN_{SO}}(s_o),\mathcal{D}(s)\rangle\\ {[inchar_{sos}]} \qquad & \langle inchar, s_i, s_o, s\rangle \Rightarrow \langle s_i, s_o, s\rangle\\ {[outchar_{sos}]} \qquad & \langle outchar, s_i, s_o, s\rangle \Rightarrow \langle s_i, s_o, s\rangle\\ -{[switch_{sos}]} \qquad & -\langle switch, s_i, s_o, s\rangle \Rightarrow -\langle s_i, s_o, s\rangle\\ \end{alignat*} diff --git a/todo.txt b/todo.txt index 95e3e0b..bdc9a01 100644 --- a/todo.txt +++ b/todo.txt @@ -12,9 +12,10 @@ annoteren Piet' programma in paint uitleg terminatie Piet' programma Marjolein: -BEZIG wiskundige operaties op stacks definieren -BEZIG onderscheid wiskundige deel -BEZIG natuurlijke taal toevoegen voor semantiekbeschrijving -BEZIG toevoegen functies/regels aan semantiek -toepassen semantiekregels op faculteitsprogramma in Piet' +KLAAR wiskundige operaties op stacks definieren +KLAAR onderscheid wiskundige deel +KLAAR natuurlijke taal toevoegen voor semantiekbeschrijving +KLAAR toevoegen functies/regels aan semantiek +BEZIG toepassen semantiekregels op faculteitsprogramma in Piet' +inchar/outchar eventueel toevoegen aan semantiek? verdere uitleg Piet'