From cbec21161346256d244e19c3f507170352f9bb4f Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Fri, 21 Dec 2007 17:01:49 +0100 Subject: [PATCH] Renaming modules: compileData.ml -> compileData.ml ; dump.ml -> syntaxTreeDump.ml --- Makefile | 2 +- src/Makefile | 5 +- src/TAGS | 575 ++++++++++++------------ src/compile.ml | 61 +-- src/{compileData.ml => compiledData.ml} | 55 +-- src/errors.ml | 6 +- src/evalConst.ml | 4 +- src/evalConst.mli | 13 +- src/evalType.ml | 4 +- src/evalType.mli | 4 +- src/ident.ml | 48 +- src/ident.mli | 4 +- src/lazyCompiler.ml | 121 ++--- src/lazyCompiler.mli | 27 +- src/lxm.ml | 1 + src/main.ml | 77 ++-- src/parser.mly | 50 +-- src/{dump.ml => syntaxTreeDump.ml} | 12 +- src/syntaxTreeDump.mli | 10 + src/test/Makefile | 33 +- src/test/test.res | 252 ++++++++++- src/test/test.res.exp | 252 ++++++++++- src/verbose.ml | 7 +- src/verbose.mli | 9 +- src/version.ml | 4 +- 25 files changed, 1057 insertions(+), 579 deletions(-) rename src/{compileData.ml => compiledData.ml} (94%) rename src/{dump.ml => syntaxTreeDump.ml} (98%) create mode 100644 src/syntaxTreeDump.mli diff --git a/Makefile b/Makefile index 55f73d42..d54a792e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ all: .PHONY: diff test log diff: - rm -f lv6.diff; git diff --ignore-all-space > lv6.diff + rm -f diff_lv6.diff; git diff --ignore-all-space > diff_lv6.diff log: rm -f lv6.log; git log > lv6.log diff --git a/src/Makefile b/src/Makefile index 0d653155..35ea5c01 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,14 +16,15 @@ SOURCES = \ ./syntaxTree.ml \ ./parser.mly \ ./lexer.mll \ - ./dump.ml \ + ./syntaxTreeDump.mli \ + ./syntaxTreeDump.ml \ ./syntaxTabUtils.mli \ ./syntaxTabUtils.ml \ ./expandPack.mli \ ./expandPack.ml \ ./symbolTab.mli \ ./symbolTab.ml \ - ./compileData.ml \ + ./compiledData.ml \ ./syntaxTab.mli \ ./syntaxTab.ml \ ./evalConst.mli \ diff --git a/src/TAGS b/src/TAGS index b67e7ea4..dc2c53b4 100644 --- a/src/TAGS +++ b/src/TAGS @@ -1,193 +1,146 @@ -./compile.ml,78 +./compile.ml,77 Compile1,0 -let rec first_pack_infirst_pack_in31,872 -let doitdoit38,1050 - -./compileData.ml,4079 -CompileData1,0 -type id_solverid_solver116,3203 - id2constid2const117,3222 - id2typeid2type118,3270 -and type_efftype_eff130,3753 - Bool_type_effBool_type_eff131,3768 - | Int_type_effInt_type_eff132,3786 - | Real_type_effReal_type_eff133,3803 - | External_type_effExternal_type_eff134,3821 - | Enum_type_effEnum_type_eff135,3858 - | Array_type_effArray_type_eff136,3915 - | Struct_type_effStruct_type_eff137,3956 -and slice_effslice_eff146,4439 - se_firstse_first147,4457 - se_lastse_last148,4475 - se_stepse_step149,4492 - se_widthse_width150,4509 -and left_effleft_eff164,5031 - LeftEffVarLeftEffVar165,5046 - | LeftEffFieldLeftEffField166,5082 - | LeftEffArrayLeftEffArray167,5134 - | LeftEffSliceLeftEffSlice168,5182 -and eq_effeq_eff175,5526 - eqf_left_listeqf_left_list176,5541 -and const_effconst_eff188,6058 - Bool_const_effBool_const_eff190,6092 - | Int_const_effInt_const_eff191,6119 - | Real_const_effReal_const_eff192,6144 - | Extern_const_effExtern_const_eff194,6227 - | Enum_const_effEnum_const_eff195,6275 - | Struct_const_effStruct_const_eff197,6387 - | Array_const_effArray_const_eff199,6518 -and val_effval_eff206,6878 - ConstEffConstEff207,6892 - | VarEffVarEff208,6918 -and var_effvar_eff215,7252 - vf_namevf_name216,7268 - vf_naturevf_nature217,7290 - vf_typevf_type218,7317 - vf_clockvf_clock219,7340 -and clock_effclock_eff221,7366 - BaseClockEffBaseClockEff222,7383 - | VarClockEffVarClockEff223,7400 -and oper_half_effoper_half_eff233,7924 - FuncRefFuncRef234,7945 - | NodeRefNodeRef235,7969 -and func_efffunc_eff241,8264 - fe_namefe_name242,8281 - fe_in_typesfe_in_types243,8303 - fe_out_typesfe_out_types244,8336 -and node_half_effnode_half_eff252,8717 -and node_effnode_eff265,9333 - nf_keynf_key266,9350 - nf_in_typesnf_in_types267,9372 - nf_out_typesnf_out_types268,9405 - nf_in_formal_clocksnf_in_formal_clocks269,9438 - nf_out_formal_clocksnf_out_formal_clocks270,9481 -and item_keyitem_key278,9845 -and node_keynode_key279,9871 -and static_arg_effstatic_arg_eff289,10336 - ConstStaticArgEffConstStaticArgEff290,10357 - | TypeStaticArgEffTypeStaticArgEff291,10404 - | OperStaticArgEffOperStaticArgEff292,10450 -and oper_effoper_eff301,10968 - PredefOperPredefOper302,10983 - | FuncOperFuncOper303,11012 - | NodeOperNodeOper304,11037 -and oper_aliasoper_alias313,11534 - CheckedOperCheckedOper314,11551 - | HalfCheckedNodeHalfCheckedNode315,11579 -type 'a chkflagedchkflaged328,12096 - CheckingChecking329,12116 - | CheckedChecked330,12129 - | BadCheckedBadChecked331,12147 -world_envworld_env334,12168 - wenv_srcwenv_src335,12182 - wenv_mod_srcswenv_mod_srcs336,12226 - wenv_pack_srcswenv_pack_srcs337,12299 - wenv_pack_envswenv_pack_envs338,12373 -and pack_envpack_env344,12657 - penv_worldpenv_world345,12674 - penv_type_tablepenv_type_table347,12741 - penv_const_tablepenv_const_table348,12806 - penv_oper_tablepenv_oper_table349,12871 - penv_node_tablepenv_node_table350,12929 -and local_envlocal_env356,13224 - lenv_node_keylenv_node_key357,13242 - lenv_globalslenv_globals358,13271 - lenv_typeslenv_types359,13299 - lenv_valslenv_vals360,13346 - lenv_operslenv_opers361,13392 -let (make_simple_node_keymake_simple_node_key365,13479 -let const_and_type_id_solverconst_and_type_id_solver381,13965 -let type_of_const_efftype_of_const_eff402,14477 -let type_of_left_efftype_of_left_eff424,15167 -let rec string_of_type_effstring_of_type_eff443,15701 -and string_of_type_eff_liststring_of_type_eff_list451,16053 -let rec string_of_const_effstring_of_const_eff457,16207 -let rec string_of_node_keystring_of_node_key479,16926 -let string_of_clockstring_of_clock513,17769 -exception Compile_node_errorCompile_node_error523,18128 -exception Global_node_errorGlobal_node_error524,18186 -let node_error_stringnode_error_string529,18422 -let print_compile_node_errorprint_compile_node_error536,18715 -let print_global_node_errorprint_global_node_error542,18870 - -./dump.ml,1958 -Dump1,0 -let (op2stringop2string11,214 -let rec dump_packbodydump_packbody70,1897 -and dump_constdump_const103,2914 -and dump_const_defdump_const_def110,3164 -and dump_typedump_type121,3642 -and dump_type_defdump_type_def129,3903 -and dump_id_listdump_id_list146,4548 -and dump_field_listdump_field_list155,4892 -and dump_fielddump_field161,5118 -and dump_funcdump_func175,5561 -and dump_param_listdump_param_list184,5941 -and dump_paramdump_param193,6197 -and dump_item_info_listdump_item_info_list201,6523 -and dump_item_infodump_item_info210,6767 -and dump_static_param_listdump_static_param_list224,7160 -and dump_static_paramdump_static_param233,7419 -and dump_nodedump_node249,7992 -and dump_node_bodydump_node_body266,8641 -and dump_var_decl_listdump_var_decl_list292,9606 -and dump_line_var_decl_listdump_line_var_decl_list299,9890 -and dump_var_decldump_var_decl305,10148 -and dump_type_expdump_type_exp316,10531 -and dump_assert_listdump_assert_list331,11007 -and dump_eq_listdump_eq_list342,11343 -and dump_left_part_listdump_left_part_list352,11636 -and dump_left_partdump_left_part360,11885 -and dump_val_expdump_val_exp373,12433 -and dump_val_exp_listdump_val_exp_list382,12692 -and dump_by_pos_expdump_by_pos_exp391,13013 -and dump_leaf_expdump_leaf_exp494,17653 -and dump_unary_expdump_unary_exp497,17734 -and dump_binary_expdump_binary_exp504,17881 -and dump_ternary_expdump_ternary_exp512,18068 -and dump_nary_expdump_nary_exp524,18340 -and dump_oper_expdump_oper_exp532,18495 -and dump_static_arg_listdump_static_arg_list548,18865 -and dump_static_argdump_static_arg558,19145 -and dump_slice_infodump_slice_info576,19574 -and dump_by_name_expdump_by_name_exp588,19935 -and dump_named_parsdump_named_pars603,20294 -let dump_packinstancedump_packinstance621,20644 -let dump_packgivendump_packgiven627,20837 -let rec dump_packinfodump_packinfo641,21251 -let dump_modelinfodump_modelinfo660,21985 +let rec first_pack_infirst_pack_in9,166 +let (doitdoit16,341 + +./compiledData.ml,4080 +CompiledData1,0 +type id_solverid_solver116,3204 + id2constid2const117,3223 + id2typeid2type118,3271 +and type_efftype_eff130,3754 + Bool_type_effBool_type_eff131,3769 + | Int_type_effInt_type_eff132,3787 + | Real_type_effReal_type_eff133,3804 + | External_type_effExternal_type_eff134,3822 + | Enum_type_effEnum_type_eff135,3859 + | Array_type_effArray_type_eff136,3916 + | Struct_type_effStruct_type_eff137,3957 +and slice_effslice_eff146,4440 + se_firstse_first147,4458 + se_lastse_last148,4476 + se_stepse_step149,4493 + se_widthse_width150,4510 +and left_effleft_eff164,5032 + LeftEffVarLeftEffVar165,5047 + | LeftEffFieldLeftEffField166,5083 + | LeftEffArrayLeftEffArray167,5135 + | LeftEffSliceLeftEffSlice168,5183 +and eq_effeq_eff175,5527 + eqf_left_listeqf_left_list176,5542 +and const_effconst_eff188,6059 + Bool_const_effBool_const_eff190,6093 + | Int_const_effInt_const_eff191,6120 + | Real_const_effReal_const_eff192,6145 + | Extern_const_effExtern_const_eff194,6228 + | Enum_const_effEnum_const_eff195,6276 + | Struct_const_effStruct_const_eff197,6388 + | Array_const_effArray_const_eff199,6519 +and val_effval_eff206,6879 + ConstEffConstEff207,6893 + | VarEffVarEff208,6919 +and var_effvar_eff215,7253 + vf_namevf_name216,7269 + vf_naturevf_nature217,7291 + vf_typevf_type218,7318 + vf_clockvf_clock219,7341 +and clock_effclock_eff221,7367 + BaseClockEffBaseClockEff222,7384 + | VarClockEffVarClockEff223,7401 +and oper_half_effoper_half_eff233,7925 + FuncRefFuncRef234,7946 + | NodeRefNodeRef235,7970 +and func_efffunc_eff241,8265 + fe_namefe_name242,8282 + fe_in_typesfe_in_types243,8304 + fe_out_typesfe_out_types244,8337 +and node_half_effnode_half_eff252,8718 +and node_effnode_eff265,9334 + nf_keynf_key266,9351 + nf_in_typesnf_in_types267,9373 + nf_out_typesnf_out_types268,9406 + nf_in_formal_clocksnf_in_formal_clocks269,9439 + nf_out_formal_clocksnf_out_formal_clocks270,9482 +and item_keyitem_key278,9846 +and node_keynode_key279,9872 +and static_arg_effstatic_arg_eff289,10337 + ConstStaticArgEffConstStaticArgEff290,10358 + | TypeStaticArgEffTypeStaticArgEff291,10405 + | OperStaticArgEffOperStaticArgEff292,10451 +and oper_effoper_eff301,10969 + PredefOperPredefOper302,10984 + | FuncOperFuncOper303,11013 + | NodeOperNodeOper304,11038 +and oper_aliasoper_alias313,11535 + CheckedOperCheckedOper314,11552 + | HalfCheckedNodeHalfCheckedNode315,11580 +type 'a check_flagcheck_flag328,12097 + CheckingChecking329,12118 + | CheckedChecked330,12131 + | IncorrectIncorrect331,12149 +world_envworld_env334,12169 + wenv_srcwenv_src335,12183 + wenv_mod_srcswenv_mod_srcs336,12227 + wenv_pack_srcswenv_pack_srcs337,12300 + wenv_pack_envswenv_pack_envs338,12374 +and pack_envpack_env344,12658 + penv_worldpenv_world345,12675 + penv_type_tablepenv_type_table347,12742 + penv_const_tablepenv_const_table348,12808 + penv_oper_tablepenv_oper_table349,12874 + penv_node_tablepenv_node_table350,12932 +and local_envlocal_env356,13228 + lenv_node_keylenv_node_key357,13246 + lenv_globalslenv_globals358,13275 + lenv_typeslenv_types359,13303 + lenv_valslenv_vals360,13350 + lenv_operslenv_opers361,13396 +let (make_simple_node_keymake_simple_node_key365,13483 +let const_and_type_id_solverconst_and_type_id_solver381,13969 +let type_of_const_efftype_of_const_eff402,14491 +let type_of_left_efftype_of_left_eff424,15181 +let rec string_of_type_effstring_of_type_eff443,15715 +and string_of_type_eff_liststring_of_type_eff_list451,16067 +let rec string_of_const_effstring_of_const_eff457,16221 +let rec string_of_node_keystring_of_node_key479,16940 +let string_of_clockstring_of_clock498,17736 +exception Compile_node_errorCompile_node_error508,18095 +exception Global_node_errorGlobal_node_error509,18153 +let node_error_stringnode_error_string514,18389 +let print_compile_node_errorprint_compile_node_error521,18682 +let print_global_node_errorprint_global_node_error527,18837 ./errors.ml,346 Errors1,0 -exception Compile_errorCompile_error97,3391 -exception Global_errorGlobal_error102,3604 -let compile_error_stringcompile_error_string108,3825 -let print_compile_errorprint_compile_error115,4122 -let warningwarning123,4418 -let print_global_errorprint_global_error130,4699 -let print_internal_errorprint_internal_error138,4982 +exception Compile_errorCompile_error97,3393 +exception Global_errorGlobal_error102,3606 +let compile_error_stringcompile_error_string108,3827 +let print_compile_errorprint_compile_error115,4124 +let warningwarning123,4420 +let print_global_errorprint_global_error130,4701 +let print_internal_errorprint_internal_error138,4984 ./evalConst.ml,582 EvalConst1,0 -exception EvalArray_errorEvalArray_error14,318 -exception EvalConst_errorEvalConst_error21,586 -let type_errortype_error26,766 -let arity_errorarity_error30,931 -let uneval_erroruneval_error35,1123 -let op_computerop_computer48,1616 -let make_slice_constmake_slice_const327,9906 -let make_array_constmake_array_const341,10315 -let make_struct_constmake_struct_const379,11384 -let rec eval_consteval_const506,15319 -and eval_array_sizeeval_array_size747,22830 -and eval_array_indexeval_array_index780,23763 -and eval_array_sliceeval_array_slice818,24957 +exception EvalArray_errorEvalArray_error14,319 +exception EvalConst_errorEvalConst_error21,587 +let type_errortype_error26,767 +let arity_errorarity_error30,932 +let uneval_erroruneval_error35,1124 +let op_computerop_computer48,1617 +let make_slice_constmake_slice_const327,9907 +let make_array_constmake_array_const341,10316 +let make_struct_constmake_struct_const379,11385 +let rec eval_consteval_const506,15320 +and eval_array_sizeeval_array_size747,22831 +and eval_array_indexeval_array_index780,23764 +and eval_array_sliceeval_array_slice818,24958 ./evalType.ml,79 EvalType1,0 -exception EvalType_errorEvalType_error9,144 -let rec ff24,500 +exception EvalType_errorEvalType_error9,145 +let rec ff24,501 ./expandPack.ml,37 ExpandPack1,0 @@ -210,44 +163,40 @@ let (make_longmake_long31,569 let dft_pack_namedft_pack_name34,636 let (set_dft_pack_nameset_dft_pack_name36,710 let (to_pack_nameto_pack_name40,794 -type idrefidref50,853 - id_packid_pack52,873 - id_idid_id53,904 -let (pack_of_idrefpack_of_idref56,933 -let (name_of_idrefname_of_idref59,1007 -let idref_of_stringidref_of_string64,1089 -let (long_of_stringlong_of_string71,1328 -let string_of_idrefstring_of_idref78,1555 -let (long_of_idreflong_of_idref84,1660 - -./lazyCompiler.ml,917 +type idrefidref50,877 + id_packid_pack52,897 + id_idid_id53,931 +let (pack_of_idrefpack_of_idref56,955 +let (name_of_idrefname_of_idref59,1029 +let idref_of_stringidref_of_string64,1111 +let (long_of_stringlong_of_string71,1350 +let string_of_idrefstring_of_idref78,1577 +let (long_of_idreflong_of_idref84,1682 + +./lazyCompiler.ml,794 LazyCompiler1,0 -type 'a chkflagedchkflaged21,302 - CheckingChecking22,322 - | CheckedChecked23,335 - | BadCheckedBadChecked24,353 -exception Recursion_errorRecursion_error30,524 -exception BadCheckRef_errorBadCheckRef_error33,627 -let recursion_errorrecursion_error36,657 -tt48,970 - src_tabsrc_tab49,981 - typestypes51,1026 - constsconsts52,1095 - nodesnodes53,1165 - prov_typesprov_types55,1253 - prov_constsprov_consts56,1327 - prov_nodesprov_nodes57,1402 -let createcreate60,1474 -let rec do_typedo_type90,2236 - do_prov_typedo_prov_type118,3189 - and check_type_defcheck_type_def179,5099 - do_constdo_const264,7801 - do_prov_constdo_prov_const294,8826 - check_const_defcheck_const_def352,10646 - solve_type_idrefsolve_type_idref412,12578 - solve_const_idrefsolve_const_idref441,13466 -let do_nodedo_node474,14415 -let test_typestest_types481,14622 +exception Recursion_errorRecursion_error19,337 +exception BadCheckRef_errorBadCheckRef_error22,440 +let recursion_errorrecursion_error26,492 +tt39,884 + src_tabsrc_tab40,895 + typestypes42,943 + constsconsts43,1011 + nodesnodes44,1079 + prov_typesprov_types46,1170 + prov_constsprov_consts47,1243 + prov_nodesprov_nodes48,1316 +let (createcreate54,1488 +let rec do_typedo_type86,2344 + do_prov_typedo_prov_type114,3299 + and check_type_defcheck_type_def175,5214 + do_constdo_const260,7916 + do_prov_constdo_prov_const290,8942 + check_const_defcheck_const_def348,10763 + solve_type_idrefsolve_type_idref408,12695 + solve_const_idrefsolve_const_idref437,13583 +let (do_nodedo_node470,14626 +let test_typestest_types492,15137 ./lxm.ml,598 Lxm1,0 @@ -259,42 +208,42 @@ tt17,304 _line_line19,332 _cstart_cstart20,347 _cend_cend21,364 -let strstr24,380 -let idid25,401 -let pack_namepack_name26,437 -let lineline27,490 -let cstartcstart28,513 -let cendcend29,540 -let detailsdetails32,590 -let positionposition36,702 -type 'a srcflagedsrcflaged42,849 - srcsrc43,871 - itit44,884 -let (flagitflagit47,937 -let dummydummy51,1033 -let last_lexemelast_lexeme53,1103 -let makemake55,1133 -let last_madelast_made65,1433 - -./main.ml,582 +let strstr25,414 +let idid26,435 +let pack_namepack_name27,471 +let lineline28,524 +let cstartcstart29,547 +let cendcend30,574 +let detailsdetails33,624 +let positionposition37,736 +type 'a srcflagedsrcflaged43,883 + srcsrc44,905 + itit45,918 +let (flagitflagit48,971 +let dummydummy52,1067 +let last_lexemelast_lexeme54,1137 +let makemake56,1167 +let last_madelast_made66,1467 + +./main.ml,581 Main1,0 -let usage_msgusage_msg51,1018 -type lpp_argslpp_args57,1268 - mutable infileinfile58,1286 - mutable main_nodemain_node59,1314 - mutable runmoderunmode60,1345 -let rec _LPP_ARGS_LPP_ARGS62,1376 -and set_infileset_infile68,1554 -and set_run_modeset_run_mode79,1806 -and print_versionprint_version82,1878 -and arg_listarg_list85,1960 - parse_argsparse_args106,2619 -let test_lextest_lex114,2813 -let lus_loadlus_load127,3136 -let dump_bodydump_body132,3229 -let dump_nsdump_ns138,3409 -let get_source_listget_source_list156,3896 -let mainmain169,4239 +let usage_msgusage_msg45,970 +type lpp_argslpp_args51,1220 + mutable infileinfile52,1238 + mutable main_nodemain_node53,1266 + mutable runmoderunmode54,1297 +let rec _LPP_ARGS_LPP_ARGS56,1328 +and set_infileset_infile62,1506 +and set_run_modeset_run_mode73,1758 +and print_versionprint_version76,1830 +and arg_listarg_list79,1912 + parse_argsparse_args103,2703 +let test_lextest_lex111,2897 +let lus_loadlus_load124,3220 +let dump_bodydump_body129,3313 +let dump_nsdump_ns135,3498 +let get_source_listget_source_list153,3995 +let mainmain166,4338 ./parserUtils.ml,124 ParserUtils1,0 @@ -303,27 +252,27 @@ let flat_twice_flagged_listflat_twice_flagged_list73,1926 ./symbolTab.ml,659 SymbolTab1,0 -type 'a hereflagedhereflaged9,70 - HereHere10,91 -| NotHereNotHere11,104 -tt13,129 - st_constsst_consts14,140 - st_typesst_types15,212 - st_opersst_opers16,282 -let createcreate20,403 -let find_typefind_type26,524 -let find_constfind_const34,718 -let find_operfind_oper42,913 -let add_import_constadd_import_const51,1135 -let add_import_typeadd_import_type55,1257 -let add_import_operadd_import_oper59,1377 -let add_constadd_const63,1497 -let add_typeadd_type67,1616 -let add_operadd_oper84,2147 -let iter_typesiter_types88,2258 -let iter_constsiter_consts89,2314 -let iter_opersiter_opers90,2372 -let dumpdump92,2429 +type 'a hereflagedhereflaged9,73 + HereHere10,94 +| NotHereNotHere11,107 +tt13,132 + st_constsst_consts14,143 + st_typesst_types15,215 + st_opersst_opers16,285 +let createcreate20,406 +let find_typefind_type26,527 +let find_constfind_const34,721 +let find_operfind_oper42,916 +let add_import_constadd_import_const51,1138 +let add_import_typeadd_import_type55,1260 +let add_import_operadd_import_oper59,1380 +let add_constadd_const63,1500 +let add_typeadd_type67,1619 +let add_operadd_oper84,2150 +let iter_typesiter_types88,2261 +let iter_constsiter_consts89,2317 +let iter_opersiter_opers90,2375 +let dumpdump92,2432 ./syntaxTab.ml,873 SyntaxTab1,0 @@ -340,17 +289,17 @@ tt74,2380 st_raw_pack_tabst_raw_pack_tab78,2540 st_pack_mng_tabst_pack_mng_tab80,2648 let pack_listpack_list85,2716 -let pack_body_envpack_body_env90,2823 -let pack_prov_envpack_prov_env95,2945 -let init_user_itemsinit_user_items104,3279 -let create_pack_mngcreate_pack_mng187,5699 -let rec createcreate224,6833 - init_raw_tabsinit_raw_tabs256,7850 - init_pack_mng_stabsinit_pack_mng_stabs292,9065 -let find_typefind_type374,11539 -let find_constfind_const378,11652 -let find_operfind_oper382,11766 -let dumpdump389,11895 +let pack_body_envpack_body_env90,2821 +let pack_prov_envpack_prov_env95,2943 +let init_user_itemsinit_user_items104,3277 +let create_pack_mngcreate_pack_mng185,5676 +let rec createcreate222,6810 + init_raw_tabsinit_raw_tabs254,7839 + init_pack_mng_stabsinit_pack_mng_stabs290,9054 +let find_typefind_type372,11528 +let find_constfind_const376,11641 +let find_operfind_oper380,11755 +let dumpdump387,11884 ./syntaxTabUtils.ml,51 SyntaxTabUtils1,0 @@ -548,21 +497,67 @@ let lexeme_of_val_explexeme_of_val_exp422,12246 let rec lexeme_of_left_partlexeme_of_left_part426,12376 let lexeme_of_pack_or_modellexeme_of_pack_or_model433,12588 -./verbose.ml,113 +./syntaxTreeDump.ml,1938 +SyntaxTreeDump1,0 +let (op2stringop2string11,214 +let rec packbodypackbody70,1897 +and dump_constdump_const103,2909 +and dump_const_defdump_const_def110,3159 +and dump_typedump_type121,3637 +and dump_type_defdump_type_def129,3898 +and dump_id_listdump_id_list146,4543 +and dump_field_listdump_field_list155,4887 +and dump_fielddump_field161,5113 +and dump_funcdump_func175,5556 +and dump_param_listdump_param_list184,5936 +and dump_paramdump_param193,6192 +and dump_item_info_listdump_item_info_list201,6518 +and dump_item_infodump_item_info210,6762 +and dump_static_param_listdump_static_param_list224,7155 +and dump_static_paramdump_static_param233,7414 +and dump_nodedump_node249,7987 +and dump_node_bodydump_node_body266,8636 +and dump_var_decl_listdump_var_decl_list292,9601 +and dump_line_var_decl_listdump_line_var_decl_list299,9885 +and dump_var_decldump_var_decl305,10143 +and dump_type_expdump_type_exp316,10526 +and dump_assert_listdump_assert_list331,11002 +and dump_eq_listdump_eq_list342,11338 +and dump_left_part_listdump_left_part_list352,11631 +and dump_left_partdump_left_part360,11880 +and dump_val_expdump_val_exp373,12428 +and dump_val_exp_listdump_val_exp_list382,12687 +and dump_by_pos_expdump_by_pos_exp391,13008 +and dump_leaf_expdump_leaf_exp494,17648 +and dump_unary_expdump_unary_exp497,17729 +and dump_binary_expdump_binary_exp504,17876 +and dump_ternary_expdump_ternary_exp512,18063 +and dump_nary_expdump_nary_exp524,18335 +and dump_oper_expdump_oper_exp532,18490 +and dump_static_arg_listdump_static_arg_list548,18860 +and dump_static_argdump_static_arg558,19140 +and dump_slice_infodump_slice_info576,19569 +and dump_by_name_expdump_by_name_exp588,19930 +and dump_named_parsdump_named_pars603,20289 +let dump_packinstancedump_packinstance621,20639 +let dump_packgivendump_packgiven627,20832 +let rec packinfopackinfo641,21241 +let modelinfomodelinfo660,21970 + +./verbose.ml,120 Verbose1,0 let _level_level27,880 -let onon29,900 -let offoff30,928 -let setset31,957 -let putput34,1027 +let set_levelset_level29,900 +let get_levelget_level30,940 +let putput33,1003 ./version.ml,118 Version1,0 let tooltool2,49 let branchbranch3,70 let commitcommit4,88 -let sha_1sha_15,105 -let strstr6,160 +let sha_1sha_15,106 +let strstr6,161 /usr/local/soft/ocaml/3.10.0//lib/ocaml/arg.mli,655 Arg1,0 diff --git a/src/compile.ml b/src/compile.ml index 6663b6b4..d3610d04 100644 --- a/src/compile.ml +++ b/src/compile.ml @@ -1,68 +1,51 @@ -(** Time-stamp: <modified the 18/12/2007 (at 11:10) by Erwan Jahier> *) +(** Time-stamp: <modified the 21/12/2007 (at 14:34) by Erwan Jahier> *) -(*---------------------------------------------------------------------- - module : Compile - date : ------------------------------------------------------------------------- -DESCRIPTION : - - Le top du compilateur - - _ init_appli : initialisation de l'appli (links - dynamiques enre les modules caml, nécessaires - à cause des dépendences cycliques) - - - test_check : test du check statique du packbody - - - compile : compilation standard - -----------------------------------------------------------------------*) open Lxm open Errors open SyntaxTree -(*--------------------------------------------------------------------- -init_appli ----------------------------------------------------------------------*) -(* let init_appli () = ( *) - (* CheckExp.call_check_node_key := CheckNode.check_node_key *) -(* ) *) -let rec first_pack_in = ( +(* get the first package in the package/model list *) +let rec first_pack_in = function | (NSPack pi)::_ -> pi.it.pa_name | _::tail -> first_pack_in tail | [] -> raise (Global_error "No package has been provided") -) -let doit (srclist : SyntaxTree.pack_or_model list) (mnode : Ident.idref) = ( - (* init de la table source *) - let srctab = SyntaxTab.create srclist in - SyntaxTab.dump srctab; +let (doit : SyntaxTree.pack_or_model list -> Ident.idref -> unit) = + fun srclist main_node -> + + let syntax_tab = SyntaxTab.create srclist in + if Verbose.get_level () > 2 then SyntaxTab.dump syntax_tab; - (* le pack par défaut est le premier de la liste ... *) Ident.set_dft_pack_name (first_pack_in srclist); (* la clée "absolue" du main node (pas d'args statiques) *) - let mnode_key = CompileData.make_simple_node_key (Ident.long_of_idref mnode) in + let main_node_key = + CompiledData.make_simple_node_key (Ident.long_of_idref main_node) + in - Verbose.put "-- MAIN NODE: \"%s\"\n" (CompileData.string_of_node_key mnode_key); + Verbose.put + "-- MAIN NODE: \"%s\"\n" (CompiledData.string_of_node_key main_node_key); (* Pour chaque package, on a un solveur de références globales, pour les types, const et oper : - les références pointées (p::n) sont recherchées - directement dans la srctab puisqu'il n'y a pas + directement dans la syntax_tab puisqu'il n'y a pas d'ambiguité - - les références simple sont recherchées : + - les références simples sont recherchées : . dans le pack lui-même . dans un des packs déclarés "uses", avec priorité dans l'ordre *) - let lzcomp = LazyCompiler.create srctab in -(* let res = LazyCompiler.do_node lzcomp mnode_key in *) - LazyCompiler.test_types lzcomp ; (* XXX : a virer *) + let lzcomp = LazyCompiler.create syntax_tab in +(* let node_eff = LazyCompiler.do_node lzcomp main_node_key in *) + + + (* XXX : a virer *) + LazyCompiler.test_types lzcomp ; () -) + diff --git a/src/compileData.ml b/src/compiledData.ml similarity index 94% rename from src/compileData.ml rename to src/compiledData.ml index 4345e460..c429ac6f 100644 --- a/src/compileData.ml +++ b/src/compiledData.ml @@ -1,11 +1,11 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:58) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/12/2007 (at 11:07) by Erwan Jahier> *) (** *) (*---------------------------------------------------------------------- - module : CompileData + module : CompiledData date : ------------------------------------------------------------------------ @@ -316,19 +316,19 @@ and oper_alias = (*--------------------------------------------------------------------- -Type chkflaged +Type check_flag ----------------------------------------------------------------------- Au cours du check, on conserve le statut des idents : - Checking => en cours de traitement, permet de lever les récursions - Checked => traité et correct -- BadChecked => déjà marqué comme incorrect (pas besoin d'un nouveau +- Incorrect => déjà marqué comme incorrect (pas besoin d'un nouveau message d'erreur) ----------------------------------------------------------------------*) -type 'a chkflaged = +type 'a check_flag = Checking | Checked of 'a - | BadChecked + | Incorrect type world_env = { @@ -344,10 +344,10 @@ Type pack_env and pack_env = { penv_world : world_env ; (* penv_src : SyntaxTree.package ; *) - penv_type_table : (Ident.t, type_eff chkflaged) Hashtbl.t ; - penv_const_table : (Ident.t, const_eff chkflaged) Hashtbl.t ; + penv_type_table : (Ident.t, type_eff check_flag) Hashtbl.t ; + penv_const_table : (Ident.t, const_eff check_flag) Hashtbl.t ; penv_oper_table : (Ident.t, oper_half_eff) Hashtbl.t ; - penv_node_table : (node_key, node_eff chkflaged) Hashtbl.t + penv_node_table : (node_key, node_eff check_flag) Hashtbl.t } (*--------------------------------------------------------------------- Type local_env @@ -379,9 +379,9 @@ Effets de bord : aucun. mais peut générer des Internal à l'usage ! ---------------------------------------------------------------------*) let const_and_type_id_solver - (i2c : Ident.idref -> Lxm.t -> const_eff) - (i2t : Ident.idref -> Lxm.t -> type_eff) -= + (i2c : Ident.idref -> Lxm.t -> const_eff) + (i2t : Ident.idref -> Lxm.t -> type_eff) + = { id2const = i2c ; id2type = i2t ; @@ -479,35 +479,20 @@ let rec string_of_const_eff = ( let rec string_of_node_key (nkey: node_key) = ( let arg2string (sa : static_arg_eff) = match sa with - | ConstStaticArgEff (id, ceff) -> - sprintf "const %s" (string_of_const_eff ceff) - - | TypeStaticArgEff (id, teff) -> - sprintf "type %s" (string_of_type_eff teff) - + | ConstStaticArgEff (id, ceff) -> sprintf "const %s" (string_of_const_eff ceff) + | TypeStaticArgEff (id, teff) -> sprintf "type %s" (string_of_type_eff teff) | OperStaticArgEff (id, opeff) -> ( match opeff with - | PredefOper posop -> - sprintf "operator %s" (Dump.op2string posop) - - | FuncOper feff -> - sprintf "node %s" (Ident.to_string feff.fe_name) - - | NodeOper neff -> - sprintf "node %s" (string_of_node_key neff.nf_key) - + | PredefOper posop -> sprintf "operator %s" (SyntaxTreeDump.op2string posop) + | FuncOper feff -> sprintf "node %s" (Ident.to_string feff.fe_name) + | NodeOper neff -> sprintf "node %s" (string_of_node_key neff.nf_key) ) in match nkey with - (ik, []) -> ( - (Ident.string_of_long ik) - ) - | (ik, salst) -> ( + | (ik, []) -> Ident.string_of_long ik + | (ik, salst) -> let astrings = List.map arg2string salst in - sprintf "%s<<%s>>" - (Ident.string_of_long ik) - (String.concat ", " astrings) - ) + sprintf "%s<<%s>>" (Ident.string_of_long ik) (String.concat ", " astrings) ) let string_of_clock (ck : clock_eff) = ( diff --git a/src/errors.ml b/src/errors.ml index 01a7321f..66970c28 100644 --- a/src/errors.ml +++ b/src/errors.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 06/12/2007 (at 11:12) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *) (*---------------------------------------------------------------------- module : Errors.ml @@ -28,12 +28,12 @@ une erreur qui n'est pas spécialement liée à un lexeme, (mais peut-être liée à un noeud -> void checkNode) * - - Compile_node_error of CompileData.node_key * Lxm.t * string : + - Compile_node_error of CompiledData.node_key * Lxm.t * string : ------------------------------------------------------------------ une erreur de compil liée à un lexeme et à un noeud (en fait une instance de template) particulier * ** *** - - Global_node_error of CompileData.node_key * string : + - Global_node_error of CompiledData.node_key * string : ------------------------------------------------------------------ une erreur de compil non liée à un lexeme particulier, mais dependant levée lors de la compilation d'un noeud * ** *** diff --git a/src/evalConst.ml b/src/evalConst.ml index 9f648d42..02297c7d 100644 --- a/src/evalConst.ml +++ b/src/evalConst.ml @@ -1,11 +1,11 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *) open Printf open Lxm open Errors open SyntaxTree -open CompileData +open CompiledData (*---------------------------------------------------- EvalArray_error : diff --git a/src/evalConst.mli b/src/evalConst.mli index 91c79c94..bde4ca41 100644 --- a/src/evalConst.mli +++ b/src/evalConst.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:57) by Erwan Jahier> *) (* @@ -9,7 +9,7 @@ DESCRIPTION : PARAMETRES : Pour avoir qq chose de générique, les fonctions sont paramétrées par un "id_solver", qui contient deux fonctions : - (voir CompileData) + (voir CompiledData) type id_solver = { id2const : Ident.idref -> Lxm.t -> const_eff @@ -62,7 +62,7 @@ FONCTIONS DERIVEES : (permet de pr exception EvalArray_error of string -val eval_const : CompileData.id_solver -> SyntaxTree.val_exp -> CompileData.const_eff list +val eval_const : CompiledData.id_solver -> SyntaxTree.val_exp -> CompiledData.const_eff list (** Rôle : calcule une taille de tableau @@ -76,7 +76,7 @@ val eval_const : CompileData.id_solver -> SyntaxTree.val_exp -> CompileData.cons EvalArray_error "bad array size, type int expected but get <t>" si t pas int EvalArray_error "bad array size <n>" si n <= 0 *) -val eval_array_size : CompileData.id_solver -> SyntaxTree.val_exp -> int +val eval_array_size : CompiledData.id_solver -> SyntaxTree.val_exp -> int (** Rôle : @@ -90,7 +90,7 @@ val eval_array_size : CompileData.id_solver -> SyntaxTree.val_exp -> int Effets de bord : EvalArray_error msg si pas bon *) -val eval_array_index : CompileData.id_solver -> SyntaxTree.val_exp -> int -> int +val eval_array_index : CompiledData.id_solver -> SyntaxTree.val_exp -> int -> int (** Rôle : @@ -108,4 +108,5 @@ val eval_array_index : CompileData.id_solver -> SyntaxTree.val_exp -> int -> int EvalArray_error msg si pas bon *) val eval_array_slice : - CompileData.id_solver -> SyntaxTree.slice_info -> int -> Lxm.t -> CompileData.slice_eff + CompiledData.id_solver -> SyntaxTree.slice_info -> int -> Lxm.t -> + CompiledData.slice_eff diff --git a/src/evalType.ml b/src/evalType.ml index 753b4ba3..d3e76053 100644 --- a/src/evalType.ml +++ b/src/evalType.ml @@ -1,9 +1,9 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *) open Lxm open Errors open SyntaxTree -open CompileData +open CompiledData open EvalConst exception EvalType_error of string diff --git a/src/evalType.mli b/src/evalType.mli index ed503a5d..78934a47 100644 --- a/src/evalType.mli +++ b/src/evalType.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *) (*---------------------------------------------------------------------- module : EvalType @@ -45,4 +45,4 @@ Effets de bord : ----------------------------------------------------------------------*) -val f : CompileData.id_solver -> SyntaxTree.type_exp -> CompileData.type_eff +val f : CompiledData.id_solver -> SyntaxTree.type_exp -> CompiledData.type_eff diff --git a/src/ident.ml b/src/ident.ml index 02ccdce2..c3546da7 100644 --- a/src/ident.ml +++ b/src/ident.ml @@ -1,5 +1,45 @@ -(** Time-stamp: <modified the 14/12/2007 (at 16:56) by Erwan Jahier> *) +(** Time-stamp: <modified the 21/12/2007 (at 14:34) by Erwan Jahier> *) +(* J'ai appele ca symbol (mais ca remplace le ident) : +c'est juste une couche qui garantit l'unicite en memoire +des strings ... +C'est tout petit, non ??? + +(* debut symbol.mli *) +type t +val to_string : t -> string +val of_string : string -> t + +(* fin symbol.mli *) + +------------------ + +(* debut symbol.ml *) +type t = string + +module WeakStringTab = struct + include Weak.Make( + struct + type t = string + let equal = (=) + let hash = Hashtbl.hash + end + ) +end + +let zetab = WeakStringTab.create 100 +let (to_string : t -> string) = + fun x -> x + +let (of_string : string -> t) = + fun x -> ( + WeakStringTab.merge zetab x + ) +(* fin symbol.ml *) + + *) + +(*cf ~/dd/ocaml-3.10.0/typing/ident.ml *) type t = string type pack_name = t @@ -45,12 +85,12 @@ let (to_pack_name : t -> pack_name) = - +(* -> syntaxeTree.ml *) type idref = { - id_pack : string option; - id_id : string + id_pack : pack_name option; + id_id : t } let (pack_of_idref : idref -> pack_name option) = diff --git a/src/ident.mli b/src/ident.mli index 625753b1..e894b01b 100644 --- a/src/ident.mli +++ b/src/ident.mli @@ -1,7 +1,7 @@ -(** Time-stamp: <modified the 17/12/2007 (at 18:00) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/12/2007 (at 10:18) by Erwan Jahier> *) -type t +type t type pack_name diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 5dea0c59..97ec90b2 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,31 +1,20 @@ +(** Time-stamp: <modified the 19/12/2007 (at 10:39) by Erwan Jahier> *) -(* -Compilation à la demande - -Essentiellement : - -- sert à associer à des items (identifiés par des key) - leur code ``compilé'' (xxx_eff) - -- se fait à la demande, par remplissage de tables de - résultats. - -*) open Lxm open Errors open SyntaxTree -open CompileData +open CompiledData + + + + +(******************************************************************************) +(** Returns the ident on which the recursion was detedted, plus an execution + stack description. -(* Flag pour les items compilés *) -type 'a chkflaged = - Checking - | Checked of 'a - | BadChecked + XXX cf QUESTION -(* ERREUR DE RECURSION : -- l'id sur lequel a été détecté la récursion -- une liste de message décrivant la "pile" d'exécution conduisant à la récursion *) exception Recursion_error of (Ident.long as 'id) * (string list as 'stack) @@ -33,42 +22,48 @@ exception Recursion_error of (Ident.long as 'id) * (string list as 'stack) exception BadCheckRef_error -let recursion_error (lxm : Lxm.t) (stack : string list) = ( +(* XXX cf QUESTION *) +let recursion_error (lxm : Lxm.t) (stack : string list) = let rec string_of_stack = function - [] -> "" - | s::[] -> s - | s::l -> s^"\n > "^(string_of_stack l) - in raise ( Compile_error (lxm, - "recursion loop detected:\n > "^(string_of_stack stack) + | [] -> "" + | s::[] -> s + | s::l -> s^"\n > "^(string_of_stack l) + in + raise ( Compile_error (lxm, + "recursion loop detected:\n > "^(string_of_stack stack) )) -) +(******************************************************************************) (* Structure principale *) type t = { src_tab : SyntaxTab.t; (* table des defs *) - types : (item_key, CompileData.type_eff chkflaged) Hashtbl.t ; - consts : (item_key, CompileData.const_eff chkflaged) Hashtbl.t ; - nodes : (node_key, CompileData.node_eff chkflaged) Hashtbl.t; + types : (item_key, CompiledData.type_eff check_flag) Hashtbl.t; + consts : (item_key, CompiledData.const_eff check_flag) Hashtbl.t; + nodes : (node_key, CompiledData.node_eff check_flag) Hashtbl.t; (* table des prov *) - prov_types : (item_key, CompileData.type_eff chkflaged) Hashtbl.t ; - prov_consts : (item_key, CompileData.const_eff chkflaged) Hashtbl.t ; - prov_nodes : (node_key, CompileData.node_eff chkflaged) Hashtbl.t + prov_types : (item_key, CompiledData.type_eff check_flag) Hashtbl.t; + prov_consts : (item_key, CompiledData.const_eff check_flag) Hashtbl.t; + prov_nodes : (node_key, CompiledData.node_eff check_flag) Hashtbl.t } -let create srcs = ( - let res = { - src_tab = srcs; - types = Hashtbl.create 50; - consts = Hashtbl.create 50; - nodes = Hashtbl.create 50; - prov_types = Hashtbl.create 50; - prov_consts = Hashtbl.create 50; - prov_nodes = Hashtbl.create 50; - } in - res -) +(******************************************************************************) +(* exported *) + +let (create : SyntaxTab.t -> t) = +fun tbl -> + { + src_tab = tbl; + types = Hashtbl.create 0; + consts = Hashtbl.create 0; + nodes = Hashtbl.create 0; + prov_types = Hashtbl.create 0; + prov_consts = Hashtbl.create 0; + prov_nodes = Hashtbl.create 0; + } + +(******************************************************************************) (* Compiler les types @@ -87,6 +82,7 @@ Compiler les types Compiler, si besoin, le type identifié par tk à l'intérieur du pack correspondant. *) +(* exported *) let rec do_type (this: t) (* l'env global *) (tk: Ident.long) (* nom du pack + nom du type *) @@ -96,7 +92,7 @@ let rec do_type match Hashtbl.find this.types tk with Checked res -> res | Checking -> raise (Recursion_error (tk, ["type ref "^(Lxm.details lxm)])) - | BadChecked -> raise (BadCheckRef_error) + | Incorrect -> raise (BadCheckRef_error) ) with Not_found -> ( Hashtbl.add this.types tk Checking ; @@ -120,7 +116,7 @@ let rec do_type match Hashtbl.find this.prov_types tk with Checked res -> res | Checking -> raise (Recursion_error (tk, ["type ref "^(Lxm.details lxm)])) - | BadChecked -> raise (BadCheckRef_error) + | Incorrect -> raise (BadCheckRef_error) ) with Not_found -> ( Hashtbl.add this.prov_types tk Checking ; @@ -269,8 +265,8 @@ let rec do_type try ( match Hashtbl.find this.consts ck with Checked res -> res - | Checking -> raise (Recursion_error (ck, ["const ref "^(Lxm.details lxm)])) - | BadChecked -> raise (BadCheckRef_error) + | Checking -> raise (Recursion_error (ck, ["const ref "^(Lxm.details lxm)])) + | Incorrect -> raise (BadCheckRef_error) ) with Not_found -> ( Hashtbl.add this.consts ck Checking ; @@ -295,8 +291,8 @@ let rec do_type try ( match Hashtbl.find this.prov_consts ck with Checked res -> res - | Checking -> raise (Recursion_error (ck, ["const ref "^(Lxm.details lxm)])) - | BadChecked -> raise (BadCheckRef_error) + | Checking -> raise (Recursion_error (ck, ["const ref "^(Lxm.details lxm)])) + | Incorrect -> raise (BadCheckRef_error) ) with Not_found -> ( Hashtbl.add this.prov_consts ck Checking ; @@ -469,9 +465,24 @@ let rec do_type ) ) - - -let do_node this nodek = assert false +(******************************************************************************) +(* exported *) +let (do_node: t -> CompiledData.node_key -> CompiledData.node_eff) = + fun this nk -> +(* XXX finish me ! *) + let itl = [] in + let otl = [] in + let icl = [] in + let ocl = [] in + + assert false; + { + nf_key = nk ; + nf_in_types = itl; + nf_out_types = otl; + nf_in_formal_clocks = icl; + nf_out_formal_clocks = ocl; + } (*------------------------------------------------------------------------- Test/debug diff --git a/src/lazyCompiler.mli b/src/lazyCompiler.mli index 4a88df83..2a02a854 100644 --- a/src/lazyCompiler.mli +++ b/src/lazyCompiler.mli @@ -1,20 +1,29 @@ -(** Time-stamp: <modified the 18/12/2007 (at 11:11) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/12/2007 (at 09:50) by Erwan Jahier> *) -(** Compiling items on demand *) +(** A lazy compiler is an internal structure that contains tables + storing compiled entities (types, const, node). At the beginning + (on creation), it only contains empty tables. But then, one when + ask for a type, a const, or a node, the tables are filled in. +*) type t -(* Création *) +(* Create en lazy compiler. *) val create : SyntaxTab.t -> t -(* Demande de compil d'un type *) -val do_type : t -> Ident.long -> Lxm.t -> CompileData.type_eff +(** Compiles one type. -(* Demande de compil d'un type provided *) -val do_prov_type : t -> Ident.long -> Lxm.t -> CompileData.type_eff + nb: modifies its first argument! + *) +val do_type : t -> Ident.long -> Lxm.t -> CompiledData.type_eff + +(** Compiles one provided type *) +val do_prov_type : t -> Ident.long -> Lxm.t -> CompiledData.type_eff +(* val do_prov_const : t -> Ident.long -> Lxm.t -> CompiledData.type_eff *) + +(** Compiles one node *) +val do_node : t -> CompiledData.node_key -> CompiledData.node_eff -(* Demande de compil d'un node *) -val do_node : t -> CompileData.node_key -> CompileData.node_eff (* Test/debug des types et constantes statiques associées *) val test_types : t -> unit diff --git a/src/lxm.ml b/src/lxm.ml index 1d6e2995..ac43b094 100644 --- a/src/lxm.ml +++ b/src/lxm.ml @@ -19,6 +19,7 @@ type t = { _line : int ; _cstart : int ; _cend : int +(* XXX rajouter le fichier !!! *) } let str x = (x._str) diff --git a/src/main.ml b/src/main.ml index f08f3215..b79a04d2 100644 --- a/src/main.ml +++ b/src/main.ml @@ -1,42 +1,36 @@ -(** Time-stamp: <modified the 18/12/2007 (at 11:03) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/12/2007 (at 11:16) by Erwan Jahier> *) -(** Here follows a description of the different modules of the lus2lis compiler +(** Here follows a description of the different modules used by this lus2lic compiler. -- Lexing and Parsing (produces the parse tree) +(1) First, the Lustre files are parsed, lexer.mll parser.mly parserUtils.ml lxm.mli/ml -- Data types - *** (1) Data types used to represent source expressions - syntaxTree.ml +which results into a parse tree containing raw source expressions. + SyntaxTree.ml -> shoudl rather be called rawSyntaxTab.ml ? + syntaxTreedump.ml - *** (2) Tabulated version of the syntax tree +(2) Reference checking at module level + model expansion syntaxTab.mli/ml - syntaxTabUtil.ml/mli - expandPack.mli/ml - symbolTab.mli/ml (util module for syntaxTab containing Symbol (type/const/oper) tbls) - - - *** (3) Data types used to represent checked (ie compiled) expressions - compileData.ml - - -- The compiling (checking+const evaluation) functions (from (2) to (3)) - compile.ml - lazyCompiler.mli/ml - -- Static evaluation of parameters (used during compilation) - evalConst.mli/ml - evalType.mli/ml - - -- Misc modules - dump.ml - errors.ml + syntaxTabUtil.ml/mli + expandPack.mli/ml + symbolTab.mli/ml (type/const/oper) + +(3) Finally, the compilation (checking+const/type evaluation) is performed . + compile.ml + lazyCompiler.mli/ml + evalConst.mli/ml + evalType.mli/ml + compiledData.ml + + +Some misc (eponymous) modules are used along the way. + errors.ml verbose.mli/ml version.ml + ident.ml *) @@ -98,8 +92,11 @@ and arg_list = [ ( "-dump", Arg.Unit(function x -> _LPP_ARGS.runmode <- "dump" ; ()), " parse and dump the internal data" ); - ( "-v", Arg.Unit(function x -> Verbose.on () ), - " set verbose mode" + ( "-v", Arg.Unit (function vl -> Verbose.set_level 1 ), + " set verbose mode on (i.e., verbose level = 1)" + ); + ( "-vl", Arg.Int(function vl -> Verbose.set_level vl ), + " <int> set verbose level" ) ] and @@ -131,7 +128,7 @@ let lus_load lexbuf = ( (* Dump d'un packbody *) let dump_body (pkg: SyntaxTree.packbody) = ( let os = Format.formatter_of_out_channel stdout in - Dump.dump_packbody os pkg + SyntaxTreeDump.packbody os pkg ) (* Dump d'un name-space, pack ou modele ... *) @@ -140,11 +137,11 @@ let dump_ns (ns: SyntaxTree.pack_or_model) = ( match ns with NSPack pf -> ( (* Verbose.put (lazy ("DUMP PACKDEF\n")); *) - Dump.dump_packinfo os pf + SyntaxTreeDump.packinfo os pf ) | NSModel mf -> ( (* Verbose.put (lazy ("DUMP MODDEF\n")); *) - Dump.dump_modelinfo os mf + SyntaxTreeDump.modelinfo os mf ) ) @@ -177,17 +174,11 @@ let main = ( let inchannel = open_in _LPP_ARGS.infile in let lexbuf = Lexing.from_channel inchannel in match _LPP_ARGS.runmode with - | "tlex" -> ( - test_lex lexbuf - ) - (* "tcheck" -> ( - Compile.test_check (pkg_load lexbuf) _LPP_ARGS.main_node - ) | - *) - | "dump" -> ( + | "tlex" -> test_lex lexbuf + | "dump" -> let nsl = get_source_list _LPP_ARGS.infile lexbuf in List.iter dump_ns nsl ; - ) + | _ -> ( (* Compile.compile (pkg_load lexbuf) _LPP_ARGS.main_node *) let nsl = get_source_list _LPP_ARGS.infile lexbuf in @@ -209,7 +200,7 @@ let main = ( exit 1 | Assert_failure (file, line, col) -> prerr_string ( - "\n*** An internal error occured in file "^ file ^ ", line " ^ + "\n*** oops: an internal error occurred in file "^ file ^ ", line " ^ (string_of_int line) ^ ", column " ^ (string_of_int col) ^ "\n") ; exit 2 diff --git a/src/parser.mly b/src/parser.mly index cc7aba2a..afad10c4 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -69,49 +69,23 @@ let treat_external_type_list lxmlst = ( ) let treat_aliased_type lxm typexp = ( - SyntaxTree.add_info type_table "type" lxm (AliasedType ((Lxm.id lxm), typexp)) ; + SyntaxTree.add_info type_table "type" lxm (AliasedType ((Lxm.id lxm), typexp)); def_list := (TypeItem (Lxm.id lxm)) :: !def_list -) +) (**********************************) (* Traitement d'un type énuméré *) (**********************************) -(* OBSOLETE ET DANGEREUX : - Il ne faut pas traiter les decl - de constantes enum au niveau syntaxique -*) -let treat_enum_type - (typlxm: Lxm.t) (* le lexeme du type *) - (cstlxmlst: Lxm.t list) (* liste des lexemes des valeurs *) - = (* sortie: unit *) - ( - (* On anticipe l'expression de type *) - - (* OBSOLETE ET DANGEREUX : - Il ne faut pas traiter les decl - de constantes enum au niveau syntaxique - - let tir = idref_of_lxm typlxm in - let typexp = Lxm.flagit (Named_type_exp tir.it) tir.src in - let put_in_const_tab - (cstlxm: Lxm.t) - = (* output: string *) - ( - let cststr = (Lxm.id cstlxm) in - SyntaxTree.add_info const_table - "constant" cstlxm (EnumConst (cststr, typexp)); - lexeme_to_string_flaged cstlxm - ) in - (* On mappe cette fonction pour avoir la liste des noms *) - let cstnamelist = List.map put_in_const_tab cstlxmlst in - *) - let cstnamelist = List.map lexeme_to_ident_flagged cstlxmlst in - (* Enfin, on introduit la définition du type *) - let typstr = Lxm.id typlxm in - SyntaxTree.add_info type_table - "type" typlxm (EnumType (typstr, cstnamelist)); - def_list := (TypeItem typstr) :: !def_list - ) + +let (treat_enum_type : Lxm.t -> Lxm.t list -> unit) = + fun typlxm (* le lexeme du type *) cstlxmlst (* liste des lexemes des valeurs *) -> + ( + let cstnamelist = List.map lexeme_to_ident_flagged cstlxmlst in + (* Enfin, on introduit la définition du type *) + let typstr = Lxm.id typlxm in + SyntaxTree.add_info type_table "type" typlxm (EnumType (typstr, cstnamelist)); + def_list := (TypeItem typstr) :: !def_list + ) (**********************************) (* Traitement d'un type structure *) diff --git a/src/dump.ml b/src/syntaxTreeDump.ml similarity index 98% rename from src/dump.ml rename to src/syntaxTreeDump.ml index 9a2ecf82..bf0e9f77 100644 --- a/src/dump.ml +++ b/src/syntaxTreeDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:58) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/12/2007 (at 11:05) by Erwan Jahier> *) open Lxm @@ -67,7 +67,7 @@ let (op2string : SyntaxTree.by_pos_op -> string) = (***********************************************************************************) (* exported *) -let rec dump_packbody (os: Format.formatter) (pkg: SyntaxTree.packbody) = +let rec packbody (os: Format.formatter) (pkg: SyntaxTree.packbody) = let dump_def (d: item_ident) = ( ( try ( @@ -633,12 +633,12 @@ let dump_packgiven (os: Format.formatter) (pg: SyntaxTree.pack_given) = ( ) | _ -> () ); Format.fprintf os "body@\n@[<b 3> %a@]@\nend@\n" - dump_packbody pg.pg_body ; + packbody pg.pg_body ; ) (***********************************************************************************) (* exported *) -let rec dump_packinfo (os: Format.formatter) (pf: SyntaxTree.pack_info srcflaged) = ( +let rec packinfo (os: Format.formatter) (pf: SyntaxTree.pack_info srcflaged) = ( let (p, lxm) = (pf.it, pf.src) in Format.fprintf os "@?@[<b 0>" ; Format.fprintf os "-----------------------------\n"; @@ -657,7 +657,7 @@ let rec dump_packinfo (os: Format.formatter) (pf: SyntaxTree.pack_info srcflaged (***********************************************************************************) (* exported *) -let dump_modelinfo (os: Format.formatter) (mf: SyntaxTree.model_info srcflaged) = ( +let modelinfo (os: Format.formatter) (mf: SyntaxTree.model_info srcflaged) = ( let (m, lxm) = (mf.it, mf.src) in Format.fprintf os "@?@[<b 0>" ; Format.fprintf os "-----------------------------\n"; @@ -680,7 +680,7 @@ let dump_modelinfo (os: Format.formatter) (mf: SyntaxTree.model_info srcflaged) ) | _ -> () ); Format.fprintf os "body@\n@[<b 3> %a@]@\nend@\n" - dump_packbody m.mo_body ; + packbody m.mo_body ; Format.fprintf os "-----------------------------\n"; Format.fprintf os "@]@." ) diff --git a/src/syntaxTreeDump.mli b/src/syntaxTreeDump.mli new file mode 100644 index 00000000..51ae344d --- /dev/null +++ b/src/syntaxTreeDump.mli @@ -0,0 +1,10 @@ +(** Time-stamp: <modified the 19/12/2007 (at 11:05) by Erwan Jahier> *) + +(** Pretty-printing the internal structure *) + + +val packinfo : Format.formatter -> SyntaxTree.pack_info Lxm.srcflaged -> unit +val packbody : Format.formatter -> SyntaxTree.packbody -> unit + +val modelinfo : Format.formatter -> SyntaxTree.model_info Lxm.srcflaged -> unit +val op2string : SyntaxTree.by_pos_op -> string diff --git a/src/test/Makefile b/src/test/Makefile index 7c84b03a..c26150e2 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,21 +1,50 @@ -LC=../lus2lic +LC=../lus2lic -vl 3 test: - $(LC) newpacks.lus > test.res + echo "Non-regression tests" > test.res + echo " " >> test.res; echo "====> $(LC) newpacks.lus" >> test.res + \ + $(LC) newpacks.lus >> test.res + echo " " >> test.res; echo "====> $(LC) struct0.lus" >> test.res $(LC) struct0.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) t0.lus" >> test.res $(LC) t0.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) t2.lus" >> test.res $(LC) t2.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) test.lus" >> test.res $(LC) test.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) trivial.lus" >> test.res $(LC) trivial.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) x.lus" >> test.res $(LC) x.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) consensus.lus" >> test.res $(LC) consensus.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) left.lus" >> test.res $(LC) left.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) packs.lus" >> test.res $(LC) packs.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) p.lus" >> test.res $(LC) p.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) t.lus" >> test.res $(LC) t.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) trivial.lus" >> test.res $(LC) trivial.lus >> test.res + \ + echo " " >> test.res; echo "====> $(LC) t1.lus" >> test.res $(LC) t1.lus >> test.res + \ diff -u test.res.exp test.res utest: diff --git a/src/test/test.res b/src/test/test.res index 6938c39c..e80d5b37 100644 --- a/src/test/test.res +++ b/src/test/test.res @@ -1,4 +1,32 @@ -XXX dump: finishme!package preal +Non-regression tests + +====> ../lus2lic -vl 3 newpacks.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + init pack mainPack + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -9,18 +37,152 @@ package mainPack package inter type t -> preal::t type selType -> inter::selType -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 struct0.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type Toto + export oper bibi +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "struct0::main" +package dummy type Toto -> dummy::Toto -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package P1 + +====> ../lus2lic -vl 3 t0.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper min_4 + export oper min + export oper min_n + export oper max +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t0::main" +package dummy + +====> ../lus2lic -vl 3 t2.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper fold_left + export oper consensus_6_bis + export oper consensus_6 + export oper consensus_bis + export oper consensus +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t2::main" +package dummy + +====> ../lus2lic -vl 3 test.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack P1 + export const y + export type titi +*** SyntaxTab.create pass 3 + symbol tables for pack P1 +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "P1::main" +package P1 type titi -> P1::titi -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 trivial.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper trivial +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "trivial::main" +package dummy + +====> ../lus2lic -vl 3 x.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export const m + export const n + export const t + export const x + export const y +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "x::main" +package dummy + +====> ../lus2lic -vl 3 consensus.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper main + export oper main2 + export oper consensus + export oper c8 +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "consensus::main" +package dummy + +====> ../lus2lic -vl 3 left.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type truc + export oper toto +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "left::main" +package dummy type truc -> dummy::truc -XXX dump: finishme!package preal + +====> ../lus2lic -vl 3 packs.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + export enum const X + export enum const Y + export type toto + init pack mainPack + export type T + export enum const bleu + export enum const rose + export enum const jaune + export type couleurs + export const N + export const X + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -35,7 +197,34 @@ package inter type t -> preal::t type selType -> inter::selType type toto -> inter::toto -XXX dump: finishme!package preal + +====> ../lus2lic -vl 3 p.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + init pack mainPack + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -46,6 +235,41 @@ package mainPack package inter type t -> preal::t type selType -> inter::selType -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 t.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export const A + export const B + export oper map2 + export oper toto +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t::main" +package dummy + +====> ../lus2lic -vl 3 trivial.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper trivial +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "trivial::main" +package dummy + +====> ../lus2lic -vl 3 t1.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper fold_left + export oper consensus + export oper bt_void +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t1::main" +package dummy diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 6938c39c..e80d5b37 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -1,4 +1,32 @@ -XXX dump: finishme!package preal +Non-regression tests + +====> ../lus2lic -vl 3 newpacks.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + init pack mainPack + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -9,18 +37,152 @@ package mainPack package inter type t -> preal::t type selType -> inter::selType -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 struct0.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type Toto + export oper bibi +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "struct0::main" +package dummy type Toto -> dummy::Toto -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package P1 + +====> ../lus2lic -vl 3 t0.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper min_4 + export oper min + export oper min_n + export oper max +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t0::main" +package dummy + +====> ../lus2lic -vl 3 t2.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper fold_left + export oper consensus_6_bis + export oper consensus_6 + export oper consensus_bis + export oper consensus +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t2::main" +package dummy + +====> ../lus2lic -vl 3 test.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack P1 + export const y + export type titi +*** SyntaxTab.create pass 3 + symbol tables for pack P1 +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "P1::main" +package P1 type titi -> P1::titi -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 trivial.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper trivial +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "trivial::main" +package dummy + +====> ../lus2lic -vl 3 x.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export const m + export const n + export const t + export const x + export const y +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "x::main" +package dummy + +====> ../lus2lic -vl 3 consensus.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper main + export oper main2 + export oper consensus + export oper c8 +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "consensus::main" +package dummy + +====> ../lus2lic -vl 3 left.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export type truc + export oper toto +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "left::main" +package dummy type truc -> dummy::truc -XXX dump: finishme!package preal + +====> ../lus2lic -vl 3 packs.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + export enum const X + export enum const Y + export type toto + init pack mainPack + export type T + export enum const bleu + export enum const rose + export enum const jaune + export type couleurs + export const N + export const X + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -35,7 +197,34 @@ package inter type t -> preal::t type selType -> inter::selType type toto -> inter::toto -XXX dump: finishme!package preal + +====> ../lus2lic -vl 3 p.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack inter + export oper preced + export const n + export type selType + init pack mainPack + export oper preced + init pack pint + export oper fby1 + export type t + init pack pbool + export oper fby1 + export type t + init pack preal + export oper fby1 + export type t +*** SyntaxTab.create pass 3 + symbol tables for pack inter + symbol tables for pack mainPack + symbol tables for pack pint + symbol tables for pack pbool + symbol tables for pack preal +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "pint::main" +package preal type t -> real package pbool type t -> bool @@ -46,6 +235,41 @@ package mainPack package inter type t -> preal::t type selType -> inter::selType -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy -XXX dump: finishme!package dummy + +====> ../lus2lic -vl 3 t.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export const A + export const B + export oper map2 + export oper toto +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t::main" +package dummy + +====> ../lus2lic -vl 3 trivial.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper trivial +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "trivial::main" +package dummy + +====> ../lus2lic -vl 3 t1.lus +*** SyntaxTab.create pass 1 +*** SyntaxTab.create pass 2 + init pack dummy + export oper fold_left + export oper consensus + export oper bt_void +*** SyntaxTab.create pass 3 + symbol tables for pack dummy +*** SyntaxTab.create done +XXX dump: finishme!-- MAIN NODE: "t1::main" +package dummy diff --git a/src/verbose.ml b/src/verbose.ml index b222415d..50bf8ccb 100644 --- a/src/verbose.ml +++ b/src/verbose.ml @@ -26,13 +26,12 @@ N.B. VERSION GORE : le kprintf n'est appel let _level = ref 0 -let on () = ( _level := 1 ) -let off () = ( _level := 0 ) -let set (l:int) = ( _level := l ) +let set_level (l:int) = ( _level := l ) +let get_level () = !_level (**** VERSION PAS TROP GORE *****) let put ?(level=1) s = Printf.kprintf - (fun t -> if (!_level >= level) then (prerr_string t) else ()) s + (fun t -> if (!_level >= level) then (print_string t) else ()) s (**** VERSION GORE *****) diff --git a/src/verbose.mli b/src/verbose.mli index 412c9428..c94ed071 100644 --- a/src/verbose.mli +++ b/src/verbose.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 06/12/2007 (at 11:20) by Erwan Jahier> *) +(** Time-stamp: <modified the 18/12/2007 (at 14:29) by Erwan Jahier> *) (*---------------------------------------------------------------------- module : Verbose @@ -11,8 +11,9 @@ Verbose.put "format" args... ----------------------------------------------------------------------*) -val on : unit -> unit -val off : unit -> unit -val set : int -> unit + + +val set_level : int -> unit +val get_level : unit -> int val put : ?level:int -> ('a, unit, string, unit) format4 -> 'a diff --git a/src/version.ml b/src/version.ml index 756325df..8702233f 100644 --- a/src/version.ml +++ b/src/version.ml @@ -1,6 +1,6 @@ (* Automatically generated from src/Makefile *) let tool = "lus2lic" let branch = "u0" -let commit = "9" -let sha_1 = "d83d8e63a7dacf064f011b1f1674aa4663aa7292" +let commit = "10" +let sha_1 = "a2f521dd15d3377a8a10e46fefdf415ad68effa9" let str = (branch ^ "." ^ commit) -- GitLab