diff --git a/src/Makefile b/src/Makefile index 35ea5c016a87494b9209b47f55e657cba2cb8159..c838f97816b8c6f249a22684c20c6ff55eb22a35 100644 --- a/src/Makefile +++ b/src/Makefile @@ -51,6 +51,9 @@ tags: $(MLONLY_SOURCES) test: $(RESULT) cd test; make test +utest: $(RESULT) + cd test; make utest + diff --git a/src/OCamlMakefile b/src/OCamlMakefile index a75fcd784b4df6564f67ac670e19c4d51b9157e0..20ef17c6ef6295d7a74efa68c137e6ae4c3e25be 100644 --- a/src/OCamlMakefile +++ b/src/OCamlMakefile @@ -667,6 +667,7 @@ pdfdoc: doc/latex/doc.pdf # generates all supported forms of documentation doc: htdoc ladoc psdoc pdfdoc + ########################################################################### # LOW LEVEL RULES diff --git a/src/TAGS b/src/TAGS index dc2c53b4cdfd37167b458bb2b6a4eaf8c8bdd5ff..b69d3698b3af9c887878d79fa73c8bc1e972ac2a 100644 --- a/src/TAGS +++ b/src/TAGS @@ -146,32 +146,32 @@ let rec ff24,501 ExpandPack1,0 let (doitdoit8,131 -./ident.ml,876 +./ident.ml,898 Ident1,0 -tt4,74 -type pack_namepack_name5,90 -type longlong6,109 -let (pack_of_longpack_of_long8,136 -let (of_longof_long11,184 -let (to_stringto_string14,219 -let (of_stringof_string17,265 -let (pack_name_of_stringpack_name_of_string20,311 -let (pack_name_to_stringpack_name_to_string23,375 -let (string_of_longstring_of_long26,439 -let (long_to_stringlong_to_string28,510 -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,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 +tt44,790 +type pack_namepack_name45,806 +type longlong46,825 +let (pack_of_longpack_of_long48,852 +let (of_longof_long51,900 +let (to_stringto_string54,935 +let (of_stringof_string57,981 +let (pack_name_of_stringpack_name_of_string60,1027 +let (pack_name_to_stringpack_name_to_string63,1091 +let (string_of_longstring_of_long66,1155 +let (long_to_stringlong_to_string68,1226 +let (make_longmake_long71,1285 +let dft_pack_namedft_pack_name74,1352 +let (set_dft_pack_nameset_dft_pack_name76,1426 +let (to_pack_nameto_pack_name80,1510 +type idrefidref90,1593 + id_packid_pack92,1613 + id_idid_id93,1647 +let (pack_of_idrefpack_of_idref96,1671 +let (name_of_idrefname_of_idref99,1745 +let idref_of_stringidref_of_string104,1827 +let (long_of_stringlong_of_string111,2066 +let string_of_idrefstring_of_idref118,2293 +let (long_of_idreflong_of_idref124,2398 ./lazyCompiler.ml,794 LazyCompiler1,0 @@ -225,25 +225,25 @@ let last_lexemelast_lexeme54,1137 let makemake56,1167 let last_madelast_made66,1467 -./main.ml,581 +./main.ml,582 Main1,0 -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 +let usage_msgusage_msg52,1080 +type lpp_argslpp_args58,1330 + mutable infileinfile59,1348 + mutable main_nodemain_node60,1376 + mutable runmoderunmode61,1407 +let rec _LPP_ARGS_LPP_ARGS63,1438 +and set_infileset_infile69,1616 +and set_run_modeset_run_mode80,1868 +and print_versionprint_version83,1940 +and arg_listarg_list86,2022 + parse_argsparse_args110,2813 +let test_lextest_lex118,3007 +let lus_loadlus_load131,3330 +let dump_bodydump_body136,3423 +let dump_nsdump_ns142,3608 +let get_source_listget_source_list160,4105 +let mainmain173,4448 ./parserUtils.ml,124 ParserUtils1,0 @@ -274,228 +274,204 @@ let iter_constsiter_consts89,2317 let iter_opersiter_opers90,2375 let dumpdump92,2432 -./syntaxTab.ml,873 +./syntaxTab.ml,15 SyntaxTab1,0 -type pack_mngpack_mng46,1419 - pm_lxmpm_lxm48,1462 - pm_raw_srcpm_raw_src50,1503 - pm_actual_srcpm_actual_src52,1566 - pm_user_itemspm_user_items55,1680 - pm_body_stabpm_body_stab57,1813 - pm_provide_stabpm_provide_stab59,1903 -tt74,2380 - st_listst_list76,2432 - st_raw_mod_tabst_raw_mod_tab77,2476 - 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,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 let put_in_tabput_in_tab7,85 -./syntaxTree.ml,6128 +./syntaxTree.ml,6133 SyntaxTree1,0 -type 'a errorerror15,397 - OkOk16,415 - | ErrorError17,428 -tt23,582 - PRPackBodyPRPackBody24,592 - | PRPack_or_modelsPRPack_or_models25,619 - pack_or_modelpack_or_model27,666 - NSPackNSPack28,684 - | NSModelNSModel29,721 - model_infomodel_info31,763 - mo_namemo_name32,780 - mo_usesmo_uses33,813 - mo_needsmo_needs34,861 - mo_providesmo_provides36,950 - mo_bodymo_body37,1001 -and pack_infopack_info39,1030 - pa_namepa_name40,1048 - pa_defpa_def41,1080 - pack_defpack_def44,1112 - PackGivenPackGiven45,1126 - | PackInstancePackInstance46,1154 - pack_givenpack_given48,1192 - pg_usespg_uses49,1210 - pg_providespg_provides51,1302 - pg_bodypg_body52,1353 - pack_instancepack_instance55,1386 - pi_modelpi_model56,1406 - pi_argspi_args57,1431 - packbodypackbody65,1656 - pk_const_tablepk_const_table66,1671 - pk_type_tablepk_type_table67,1737 - pk_oper_tablepk_oper_table68,1803 - pk_def_listpk_def_list69,1869 - item_identitem_ident72,1917 - ConstItemConstItem76,2024 - | TypeItemTypeItem77,2049 - | OperItemOperItem78,2074 - item_infoitem_info80,2103 - ConstInfoConstInfo81,2117 - | TypeInfoTypeInfo82,2145 - | OperInfoOperInfo83,2172 - const_infoconst_info88,2369 - ExternalConstExternalConst89,2385 - | EnumConstEnumConst90,2428 - | DefinedConstDefinedConst91,2471 - type_infotype_info96,2696 - ExternalTypeExternalType97,2710 - | AliasedTypeAliasedType98,2740 - | EnumTypeEnumType99,2781 - | StructTypeStructType101,2896 - struct_type_infostruct_type_info111,3385 - st_namest_name112,3408 - st_flistst_flist113,3432 - st_ftablest_ftable114,3462 -and field_infofield_info116,3527 - fd_namefd_name117,3546 - fd_typefd_type118,3569 - fd_valuefd_value119,3593 - type_exptype_exp127,3955 - type_exp_coretype_exp_core129,3996 - Bool_type_expBool_type_exp130,4014 - | Int_type_expInt_type_exp131,4032 - | Real_type_expReal_type_exp132,4049 - | Named_type_expNamed_type_exp133,4067 - | Array_type_expArray_type_exp134,4103 - oper_infooper_info140,4369 - NodeNode141,4383 - | FuncFunc142,4406 - func_infofunc_info147,4596 - fn_namefn_name148,4612 - fn_inparsfn_inpars149,4639 - fn_outparsfn_outpars150,4691 - node_infonode_info157,4955 - ni_nameni_name158,4971 - ni_staticlistni_staticlist159,5001 - ni_valueni_value160,5051 -and node_profilenode_profile162,5079 -and node_defnode_def163,5150 - NodeExternNodeExtern164,5165 - | NodeBodyNodeBody165,5196 - | NodeAliasNodeAlias166,5223 -and node_bodynode_body173,5593 - nbdy_inlistnbdy_inlist174,5611 - nbdy_outlistnbdy_outlist175,5645 - nbdy_loclistnbdy_loclist176,5679 - nbdy_vartablenbdy_vartable177,5713 - nbdy_assertsnbdy_asserts178,5749 - nbdy_eqsnbdy_eqs179,5795 -and var_info_tablevar_info_table181,5841 -and static_paramstatic_param182,5903 - StaticParamTypeStaticParamType183,5922 - | StaticParamConstStaticParamConst184,5954 - | StaticParamNodeStaticParamNode185,5999 -and var_infovar_info186,6085 - va_natureva_nature187,6102 - va_nameva_name188,6128 - va_typeva_type189,6151 - va_clockva_clock190,6175 -and var_naturevar_nature192,6202 - VarInputVarInput193,6219 - | VarOutputVarOutput194,6232 - | VarLocalVarLocal195,6246 -and eq_infoeq_info196,6259 - eq_lefteq_left197,6275 - eq_righteq_right198,6304 -and clock_expclock_exp201,6386 - BaseClockBaseClock202,6402 - | NamedClockNamedClock203,6416 -and left_partleft_part204,6452 - LeftVarLeftVar206,6523 - | LeftFieldLeftField207,6558 - | LeftArrayLeftArray208,6609 - | LeftSliceLeftSlice209,6662 -and slice_infoslice_info210,6716 - si_firstsi_first211,6735 - si_lastsi_last212,6758 - si_stepsi_step213,6781 -and val_expval_exp226,7325 - CallByPosCallByPos227,7339 - | CallByNameCallByName228,7397 -and by_pos_opby_pos_op231,7522 - NULL_expNULL_exp233,7557 - | TRUE_nTRUE_n234,7570 - | FALSE_nFALSE_n235,7581 - | ICONST_nICONST_n236,7593 - | RCONST_nRCONST_n237,7617 - | IDENT_nIDENT_n238,7641 - | NOT_nNOT_n240,7686 - | UMINUS_nUMINUS_n241,7696 - | PRE_nPRE_n242,7709 - | CURRENT_nCURRENT_n243,7719 - | REAL2INT_nREAL2INT_n244,7733 - | INT2REAL_nINT2REAL_n245,7748 - | ARROW_nARROW_n247,7784 - | FBY_nFBY_n248,7796 - | WHEN_nWHEN_n249,7806 - | AND_nAND_n250,7817 - | OR_nOR_n251,7827 - | XOR_nXOR_n252,7836 - | IMPL_nIMPL_n253,7846 - | EQ_nEQ_n254,7857 - | NEQ_nNEQ_n255,7866 - | LT_nLT_n256,7876 - | LTE_nLTE_n257,7885 - | GT_nGT_n258,7895 - | GTE_nGTE_n259,7904 - | DIV_nDIV_n260,7914 - | MOD_nMOD_n261,7924 - | MINUS_nMINUS_n262,7934 - | PLUS_nPLUS_n263,7946 - | SLASH_nSLASH_n264,7957 - | TIMES_nTIMES_n265,7969 - | POWER_nPOWER_n266,7981 - | HAT_nHAT_n267,7993 - | CONCAT_nCONCAT_n268,8003 - | IF_nIF_n270,8038 - | WITH_nWITH_n271,8047 - | NOR_nNOR_n273,8078 - | DIESE_nDIESE_n274,8088 - | TUPLE_nTUPLE_n275,8100 - | ARRAY_nARRAY_n276,8112 - | PROJ_nPROJ_n282,8383 - | CALL_nCALL_n284,8448 - | ARRAY_ACCES_nARRAY_ACCES_n286,8523 - | ARRAY_SLICE_nARRAY_SLICE_n287,8552 - | STRUCT_ACCESS_nSTRUCT_ACCESS_n289,8628 -and by_name_opby_name_op295,8781 - BYNAME_CALL_nBYNAME_CALL_n296,8798 - | STRUCT_EXP_nSTRUCT_EXP_n298,8863 -and oper_expoper_exp300,8921 - CallPreDefCallPreDef301,8936 - | CallUsrDefCallUsrDef302,8964 -and static_argstatic_arg310,9230 - StaticArgIdentStaticArgIdent311,9247 - | StaticArgConstStaticArgConst312,9281 - | StaticArgTypeStaticArgType313,9311 - | StaticArgNodeStaticArgNode314,9342 -let give_pack_this_namegive_pack_this_name321,9512 -let leafexpleafexp336,9821 -let unexpunexp340,9893 -let binexpbinexp344,9968 -let ternexpternexp348,10052 -let naryexpnaryexp352,10144 -let bynameexpbynameexp356,10223 -let make_packbodymake_packbody371,10742 -let add_infoadd_info390,11310 -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 +type 'a errorerror18,456 + OkOk19,474 + | ErrorError20,487 +tt26,641 + PRPackBodyPRPackBody27,651 + | PRPack_or_modelsPRPack_or_models28,678 + pack_or_modelpack_or_model30,725 + NSPackNSPack31,743 + | NSModelNSModel32,780 + model_infomodel_info34,822 + mo_namemo_name35,839 + mo_usesmo_uses36,872 + mo_needsmo_needs37,920 + mo_providesmo_provides39,1009 + mo_bodymo_body40,1060 +and pack_infopack_info42,1089 + pa_namepa_name43,1107 + pa_defpa_def44,1139 + pack_defpack_def47,1171 + PackGivenPackGiven48,1185 + | PackInstancePackInstance49,1213 + pack_givenpack_given51,1251 + pg_usespg_uses52,1269 + pg_providespg_provides54,1361 + pg_bodypg_body55,1412 + pack_instancepack_instance58,1445 + pi_modelpi_model59,1465 + pi_argspi_args60,1490 + packbodypackbody68,1715 + pk_const_tablepk_const_table69,1730 + pk_type_tablepk_type_table70,1796 + pk_oper_tablepk_oper_table71,1862 + pk_def_listpk_def_list72,1928 + item_identitem_ident75,1976 + ConstItemConstItem79,2083 + | TypeItemTypeItem80,2108 + | OperItemOperItem81,2133 + item_infoitem_info83,2162 + ConstInfoConstInfo84,2176 + | TypeInfoTypeInfo85,2204 + | OperInfoOperInfo86,2231 + const_infoconst_info91,2428 + ExternalConstExternalConst92,2444 + | EnumConstEnumConst93,2487 + | DefinedConstDefinedConst94,2530 + type_infotype_info99,2755 + ExternalTypeExternalType100,2769 + | AliasedTypeAliasedType101,2799 + | EnumTypeEnumType102,2840 + | StructTypeStructType104,2955 + struct_type_infostruct_type_info114,3444 + st_namest_name115,3467 + st_flistst_flist116,3491 + st_ftablest_ftable117,3521 +and field_infofield_info119,3586 + fd_namefd_name120,3605 + fd_typefd_type121,3628 + fd_valuefd_value122,3652 + type_exptype_exp130,4014 + type_exp_coretype_exp_core132,4055 + Bool_type_expBool_type_exp133,4073 + | Int_type_expInt_type_exp134,4091 + | Real_type_expReal_type_exp135,4108 + | Named_type_expNamed_type_exp136,4126 + | Array_type_expArray_type_exp137,4162 + oper_infooper_info143,4428 + NodeNode144,4442 + | FuncFunc145,4465 + func_infofunc_info150,4655 + fn_namefn_name151,4671 + fn_inparsfn_inpars152,4698 + fn_outparsfn_outpars153,4750 + node_infonode_info160,5014 + ni_nameni_name161,5030 + ni_staticlistni_staticlist162,5060 + ni_valueni_value163,5110 +and node_profilenode_profile165,5138 +and node_defnode_def166,5209 + NodeExternNodeExtern167,5224 + | NodeBodyNodeBody168,5255 + | NodeAliasNodeAlias169,5282 +and node_bodynode_body176,5652 + nbdy_inlistnbdy_inlist177,5670 + nbdy_outlistnbdy_outlist178,5704 + nbdy_loclistnbdy_loclist179,5738 + nbdy_vartablenbdy_vartable180,5772 + nbdy_assertsnbdy_asserts181,5808 + nbdy_eqsnbdy_eqs182,5854 +and var_info_tablevar_info_table184,5900 +and static_paramstatic_param185,5962 + StaticParamTypeStaticParamType186,5981 + | StaticParamConstStaticParamConst187,6013 + | StaticParamNodeStaticParamNode188,6058 +and var_infovar_info189,6144 + va_natureva_nature190,6161 + va_nameva_name191,6187 + va_typeva_type192,6210 + va_clockva_clock193,6234 +and var_naturevar_nature195,6261 + VarInputVarInput196,6278 + | VarOutputVarOutput197,6291 + | VarLocalVarLocal198,6305 +and eq_infoeq_info199,6318 + eq_lefteq_left200,6334 + eq_righteq_right201,6363 +and clock_expclock_exp204,6445 + BaseClockBaseClock205,6461 + | NamedClockNamedClock206,6475 +and left_partleft_part207,6511 + LeftVarLeftVar209,6582 + | LeftFieldLeftField210,6617 + | LeftArrayLeftArray211,6668 + | LeftSliceLeftSlice212,6721 +and slice_infoslice_info213,6775 + si_firstsi_first214,6794 + si_lastsi_last215,6817 + si_stepsi_step216,6840 +and val_expval_exp229,7384 + CallByPosCallByPos230,7398 + | CallByNameCallByName231,7456 +and by_pos_opby_pos_op234,7581 + NULL_expNULL_exp236,7616 + | TRUE_nTRUE_n237,7629 + | FALSE_nFALSE_n238,7640 + | ICONST_nICONST_n239,7652 + | RCONST_nRCONST_n240,7676 + | IDENT_nIDENT_n241,7700 + | NOT_nNOT_n243,7745 + | UMINUS_nUMINUS_n244,7755 + | PRE_nPRE_n245,7768 + | CURRENT_nCURRENT_n246,7778 + | REAL2INT_nREAL2INT_n247,7792 + | INT2REAL_nINT2REAL_n248,7807 + | ARROW_nARROW_n250,7843 + | FBY_nFBY_n251,7855 + | WHEN_nWHEN_n252,7865 + | AND_nAND_n253,7876 + | OR_nOR_n254,7886 + | XOR_nXOR_n255,7895 + | IMPL_nIMPL_n256,7905 + | EQ_nEQ_n257,7916 + | NEQ_nNEQ_n258,7925 + | LT_nLT_n259,7935 + | LTE_nLTE_n260,7944 + | GT_nGT_n261,7954 + | GTE_nGTE_n262,7963 + | DIV_nDIV_n263,7973 + | MOD_nMOD_n264,7983 + | MINUS_nMINUS_n265,7993 + | PLUS_nPLUS_n266,8005 + | SLASH_nSLASH_n267,8016 + | TIMES_nTIMES_n268,8028 + | POWER_nPOWER_n269,8040 + | HAT_nHAT_n270,8052 + | CONCAT_nCONCAT_n271,8062 + | IF_nIF_n273,8097 + | WITH_nWITH_n274,8106 + | NOR_nNOR_n276,8137 + | DIESE_nDIESE_n277,8147 + | TUPLE_nTUPLE_n278,8159 + | ARRAY_nARRAY_n279,8171 + | PROJ_nPROJ_n285,8442 + | CALL_nCALL_n287,8507 + | ARRAY_ACCES_nARRAY_ACCES_n289,8582 + | ARRAY_SLICE_nARRAY_SLICE_n290,8611 + | STRUCT_ACCESS_nSTRUCT_ACCESS_n292,8687 +and by_name_opby_name_op298,8840 + BYNAME_CALL_nBYNAME_CALL_n299,8857 + | STRUCT_EXP_nSTRUCT_EXP_n301,8922 +and oper_expoper_exp303,8980 + CallPreDefCallPreDef304,8995 + | CallUsrDefCallUsrDef305,9023 +and static_argstatic_arg313,9289 + StaticArgIdentStaticArgIdent314,9306 + | StaticArgConstStaticArgConst315,9340 + | StaticArgTypeStaticArgType316,9370 + | StaticArgNodeStaticArgNode317,9401 +let give_pack_this_namegive_pack_this_name324,9571 +let leafexpleafexp339,9880 +let unexpunexp343,9952 +let binexpbinexp347,10027 +let ternexpternexp351,10111 +let naryexpnaryexp355,10203 +let bynameexpbynameexp359,10282 +let make_packbodymake_packbody374,10801 +let add_infoadd_info393,11369 +let lexeme_of_val_explexeme_of_val_exp425,12305 +let rec lexeme_of_left_partlexeme_of_left_part429,12435 +let lexeme_of_pack_or_modellexeme_of_pack_or_model436,12647 ./syntaxTreeDump.ml,1938 SyntaxTreeDump1,0 diff --git a/src/compile.ml b/src/compile.ml index d3610d04de0b57e5829cd8955997691ef19b0788..131a2d0a654091892beee928a2c10f929d3ba073 100644 --- a/src/compile.ml +++ b/src/compile.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 21/12/2007 (at 14:34) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/01/2008 (at 14:10) by Erwan Jahier> *) open Lxm @@ -26,7 +26,7 @@ let (doit : SyntaxTree.pack_or_model list -> Ident.idref -> unit) = CompiledData.make_simple_node_key (Ident.long_of_idref main_node) in - Verbose.put + Verbose.printf "-- MAIN NODE: \"%s\"\n" (CompiledData.string_of_node_key main_node_key); (* Pour chaque package, on a un solveur de références diff --git a/src/main.ml b/src/main.ml index b79a04d242e51312a57915f607cb6076ebfe22e2..7554fad7902deddaf2d861e9a55e2ac7b0e7b146 100644 --- a/src/main.ml +++ b/src/main.ml @@ -1,24 +1,31 @@ -(** Time-stamp: <modified the 19/12/2007 (at 11:16) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/01/2008 (at 14:10) by Erwan Jahier> *) (** Here follows a description of the different modules used by this lus2lic compiler. -(1) First, the Lustre files are parsed, +(1) First of all, the Lustre files are parsed, + lexer.mll parser.mly parserUtils.ml lxm.mli/ml which results into a parse tree containing raw source expressions. - SyntaxTree.ml -> shoudl rather be called rawSyntaxTab.ml ? + + syntaxTree.ml -> should rather be called rawSyntaxTab.ml ? syntaxTreedump.ml -(2) Reference checking at module level + model expansion +(2) Then, we perform reference checking at module level + model expansion. + syntaxTab.mli/ml syntaxTabUtil.ml/mli expandPack.mli/ml symbolTab.mli/ml (type/const/oper) -(3) Finally, the compilation (checking+const/type evaluation) is performed . +syntaxTab is a kind of layer above syntaxTree to make things easier afterwards. + + +(3) Finally, the compilation (checking+const/type evaluation) is performed. + compile.ml lazyCompiler.mli/ml evalConst.mli/ml @@ -136,11 +143,11 @@ let dump_ns (ns: SyntaxTree.pack_or_model) = ( let os = Format.formatter_of_out_channel stdout in match ns with NSPack pf -> ( - (* Verbose.put (lazy ("DUMP PACKDEF\n")); *) + (* Verbose.printf (lazy ("DUMP PACKDEF\n")); *) SyntaxTreeDump.packinfo os pf ) | NSModel mf -> ( - (* Verbose.put (lazy ("DUMP MODDEF\n")); *) + (* Verbose.printf (lazy ("DUMP MODDEF\n")); *) SyntaxTreeDump.modelinfo os mf ) ) diff --git a/src/syntaxTab.ml b/src/syntaxTab.ml index 7a7f71198cfead147819da39afa85e6ad73dcc0e..56bb62638bd8b04a1638e14e8695068fd42238ea 100644 --- a/src/syntaxTab.ml +++ b/src/syntaxTab.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 18/12/2007 (at 11:13) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/01/2008 (at 14:16) by Erwan Jahier> *) (** Table des infos sources : une couche au dessus de SyntaxTree pour mieux @@ -39,12 +39,15 @@ open SyntaxTabUtils dans la partie provide ou body. Il contient aussi une table des items exportés pour faciliter le - traitement des "use" du package. C'est une correspondance nature+nom - simple -> nom complet (c.a.d. SyntaxTree.item_ident -> Ident.long) + traitement des "use" du package. C'est une correspondance + + nature + nom simple -> nom complet + + (c.a.d. ??? + SyntaxTree.item_ident -> Ident.long) *) type pack_mng = { - (* le lexeme de ref *) + (* le lexeme associé au package? *) pm_lxm : Lxm.t; (* le source brut *) pm_raw_src : SyntaxTree.pack_info; @@ -74,27 +77,30 @@ type pack_mng = { type t = { (* liste + tables des sources bruts *) st_list : SyntaxTree.pack_or_model list ; - st_raw_mod_tab : (Ident.t , model_info srcflaged) Hashtbl.t ; + st_raw_mod_tab : (Ident.t , model_info srcflaged) Hashtbl.t ; st_raw_pack_tab : (Ident.pack_name , pack_info srcflaged) Hashtbl.t ; (* table des managers de packs *) st_pack_mng_tab : (Ident.pack_name , pack_mng) Hashtbl.t; -} - - +} -let pack_list this = - Hashtbl.fold (fun n p l -> n::l) this.st_pack_mng_tab [] +(* exported *) +let (pack_list:t -> Ident.pack_name list) = + fun this -> + Hashtbl.fold (fun n p l -> n::l) this.st_pack_mng_tab [] -(* accès aux infos *) -let pack_body_env this p = - try (Hashtbl.find this.st_pack_mng_tab p).pm_body_stab - with Not_found -> assert false +(* exported *) +let (pack_body_env: t -> Ident.pack_name -> SymbolTab.t) = + fun this p -> + try (Hashtbl.find this.st_pack_mng_tab p).pm_body_stab + with Not_found -> assert false -let pack_prov_env this p = - try (Hashtbl.find this.st_pack_mng_tab p).pm_provide_stab - with Not_found -> assert false +(* exported *) +let (pack_prov_env: t -> Ident.pack_name -> SymbolTab.t option) = + fun this p -> + try (Hashtbl.find this.st_pack_mng_tab p).pm_provide_stab + with Not_found -> assert false @@ -108,7 +114,7 @@ let init_user_items (this: pack_mng) = ( (s:Ident.t) (xci: SyntaxTree.const_info srcflaged) = ( - Verbose.put " export const %s\n" (Ident.to_string s); + Verbose.printf " export const %s\n" (Ident.to_string s); put_in_tab "const" this.pm_user_items (ConstItem s) (Lxm.flagit (Ident.make_long pname s) xci.src) @@ -118,37 +124,37 @@ let init_user_items (this: pack_mng) = ( let export_type (s: Ident.t) (xti: SyntaxTree.type_info srcflaged) - = ( - let _ = match (xti.it) with - EnumType (_, ecl) -> ( - (* Cas particulier des types enums *) - (* on exporte les constantes ... *) - let treat_enum_const ec = ( - let s = ec.it in - let lxm = ec.src in - Verbose.put " export enum const %s\n" (Ident.to_string s); - put_in_tab "const" this.pm_user_items - (ConstItem s) - (Lxm.flagit (Ident.make_long pname s) lxm) - ) in - List.iter treat_enum_const ecl - ) - | ExternalType _ - | AliasedType _ - | StructType _ -> () - in - Verbose.put " export type %s\n" (Ident.to_string s); - put_in_tab "type" this.pm_user_items - (TypeItem s) - (Lxm.flagit (Ident.make_long pname s) xti.src) - ) + = + ( match (xti.it) with + EnumType (_, ecl) -> ( + (* Cas particulier des types enums *) + (* on exporte les constantes ... *) + let treat_enum_const ec = ( + let s = ec.it in + let lxm = ec.src in + Verbose.printf " export enum const %s\n" (Ident.to_string s); + put_in_tab "const" this.pm_user_items + (ConstItem s) + (Lxm.flagit (Ident.make_long pname s) lxm) + ) in + List.iter treat_enum_const ecl + ) + | ExternalType _ + | AliasedType _ + | StructType _ -> () + ); + + Verbose.printf " export type %s\n" (Ident.to_string s); + put_in_tab "type" this.pm_user_items + (TypeItem s) + (Lxm.flagit (Ident.make_long pname s) xti.src) in (* EXPORTATION D'UN oper_info *) let export_oper (s: Ident.t) (xoi: SyntaxTree.oper_info srcflaged) = ( - Verbose.put " export oper %s\n" (Ident.to_string s); + Verbose.printf " export oper %s\n" (Ident.to_string s); put_in_tab "oper" this.pm_user_items (OperItem s) (Lxm.flagit (Ident.make_long pname s) xoi.src) @@ -219,147 +225,145 @@ Se fait en plusieurs passes : (pour la partie provide et pour la partie body) ****************************************************************************) -let rec create (sl : SyntaxTree.pack_or_model list) = ( - (* liste + tables des sources bruts *) - let res = { - st_list = sl ; - st_raw_mod_tab = Hashtbl.create 50; - st_raw_pack_tab = Hashtbl.create 50; - st_pack_mng_tab = Hashtbl.create 50; - } in - - Verbose.put "*** SyntaxTab.create pass 1\n"; - (* passe 1 *) - init_raw_tabs res sl ; - (* passe 2 *) - Verbose.put "*** SyntaxTab.create pass 2\n"; - let init_pack_mng pname pdata = ( - Verbose.put " init pack %s\n" (Ident.pack_name_to_string pname); - let pg = ExpandPack.doit res.st_raw_mod_tab pdata in - Hashtbl.add res.st_pack_mng_tab - pname - (create_pack_mng pdata pg) - ) in - Hashtbl.iter init_pack_mng res.st_raw_pack_tab ; - (* passe 3 *) - Verbose.put "*** SyntaxTab.create pass 3\n"; - Hashtbl.iter (init_pack_mng_stabs res) res.st_pack_mng_tab ; - (* resultat *) - Verbose.put "*** SyntaxTab.create done\n"; - res -) -and - (***** PASSE 1 *****) - (* init des tables string -> mod ou pack *) - init_raw_tabs (this : t) (sl : SyntaxTree.pack_or_model list) = - (* on itère pour chaque pack_or_model : *) - let treat_ns ns = - match ns with - (* cas d'un package *) - | SyntaxTree.NSPack pi -> - let lxm = pi.Lxm.src in - let nme = (Lxm.pack_name lxm) in - put_in_tab "package" this.st_raw_pack_tab nme pi - - | SyntaxTree.NSModel mi -> (* cas d'un modele *) - let lxm = mi.Lxm.src in - let nme = (Lxm.id lxm) in - put_in_tab "model" this.st_raw_mod_tab nme mi - in - List.iter treat_ns sl -and - (***** PASSE 3 *****) - (* Essentiellement le remplissage des champs de pack_mng : - - pm_provide_stab : SymbolTab.t - table qui permettra de résoudre les refs. simples - à l'intérieur de la partie provides. - - pm_body_stab : SymbolTab.t ; - table qui permettra de résoudre les refs. simples - à l'intérieur de la partie body. - - N.B. s'il n'y a pas de provides explicite, on construit - une unique table qui sert pour les deux ! - - Comment ça marche : - - on traite en premier les éventuels "use", - - puis les déclaration locales qui peuvent éventuellement - masquer les précédentes (warning ?) - *) - init_pack_mng_stabs (this: t) (pname: Ident.pack_name) (pm: pack_mng) = ( - let pg = pm.pm_actual_src in - - Verbose.put " symbol tables for pack %s\n" - (Ident.pack_name_to_string pname); - (* ON COMMENCE PAR TRAITER LE PG_USES *) - let treat_uses px = ( - let pname = px.it in - let lxm = px.src in - let pum = try ( - Hashtbl.find this.st_pack_mng_tab pname - ) with Not_found -> ( - raise(Compile_error(lxm, "unknown package")) - ) in - let fill_used_item - (ii: SyntaxTree.item_ident) - (iks: Ident.long Lxm.srcflaged) = - ( - match ii with - | ConstItem n -> ( - SymbolTab.add_import_const pm.pm_body_stab n iks.it; - match pm.pm_provide_stab with - Some pt -> SymbolTab.add_import_const pt n iks.it - | None -> () - ) - | TypeItem n -> ( - SymbolTab.add_import_type pm.pm_body_stab n iks.it; - match pm.pm_provide_stab with - Some pt -> SymbolTab.add_import_type pt n iks.it - | None -> () - ) - | OperItem n -> ( - SymbolTab.add_import_oper pm.pm_body_stab n iks.it; - match pm.pm_provide_stab with - Some pt -> SymbolTab.add_import_oper pt n iks.it - | None -> () - ) - ) in - Hashtbl.iter fill_used_item pum.pm_user_items - ) in - List.iter treat_uses pg.pg_uses ; - - (* PUIS LES DECLARATION LOCALES *) - (* ... dans le body : *) - Hashtbl.iter (SymbolTab.add_type pm.pm_body_stab) - pg.pg_body.pk_type_table; - Hashtbl.iter (SymbolTab.add_const pm.pm_body_stab) - pg.pg_body.pk_const_table; - Hashtbl.iter (SymbolTab.add_oper pm.pm_body_stab) - pg.pg_body.pk_oper_table; - (* ... dans le provide : *) - match pg.pg_provides with - | None -> () - | Some spflg -> ( - let pptab = match pm.pm_provide_stab with - Some pt -> pt - | None -> assert false - in - let treat_prov x = ( - let lxm = x.src in - let s = (Lxm.id lxm) in - match (x.it) with - | TypeInfo xti -> - SymbolTab.add_type pptab s (Lxm.flagit xti lxm) - | ConstInfo xci -> - SymbolTab.add_const pptab s (Lxm.flagit xci lxm) - | OperInfo xoi -> - SymbolTab.add_oper pptab s (Lxm.flagit xoi lxm) - - ) in - List.iter treat_prov spflg +let rec (create : SyntaxTree.pack_or_model list -> t) = + fun sl -> + (* liste + tables des sources bruts *) + let res = { + st_list = sl ; + st_raw_mod_tab = Hashtbl.create 50; + st_raw_pack_tab = Hashtbl.create 50; + st_pack_mng_tab = Hashtbl.create 50; + } + in + Verbose.printf "*** SyntaxTab.create pass 1\n"; + (* passe 1 *) + init_raw_tabs res sl ; + (* passe 2 *) + Verbose.printf "*** SyntaxTab.create pass 2\n"; + let init_pack_mng pname pdata = ( + Verbose.printf " init pack %s\n" (Ident.pack_name_to_string pname); + let pg = ExpandPack.doit res.st_raw_mod_tab pdata in + Hashtbl.add res.st_pack_mng_tab + pname + (create_pack_mng pdata pg) + ) in + Hashtbl.iter init_pack_mng res.st_raw_pack_tab ; + (* passe 3 *) + Verbose.printf "*** SyntaxTab.create pass 3\n"; + Hashtbl.iter (init_pack_mng_stabs res) res.st_pack_mng_tab ; + (* resultat *) + Verbose.printf "*** SyntaxTab.create done\n"; + res + and +(***** PASSE 1 *****) +(* init des tables string -> mod ou pack *) +init_raw_tabs (this : t) (sl : SyntaxTree.pack_or_model list) = + (* on itère pour chaque pack_or_model : *) + let treat_ns ns = + match ns with + (* cas d'un package *) + | SyntaxTree.NSPack pi -> + let lxm = pi.Lxm.src in + let nme = (Lxm.pack_name lxm) in + put_in_tab "package" this.st_raw_pack_tab nme pi + + | SyntaxTree.NSModel mi -> (* cas d'un modele *) + let lxm = mi.Lxm.src in + let nme = (Lxm.id lxm) in + put_in_tab "model" this.st_raw_mod_tab nme mi + in + List.iter treat_ns sl + and +(***** PASSE 3 *****) +(* Essentiellement le remplissage des champs de pack_mng : + + pm_provide_stab : SymbolTab.t + table qui permettra de résoudre les refs simples + à l'intérieur de la partie provides. + + pm_body_stab : SymbolTab.t ; + table qui permettra de résoudre les refs simples + à l'intérieur de la partie body. + + N.B. s'il n'y a pas de provides explicite, on construit + une unique table qui sert pour les deux ! + + Comment ça marche : + - on traite en premier les éventuels "use", + - puis les déclarations locales qui peuvent éventuellement + masquer les précédentes (warning ?) +*) +init_pack_mng_stabs (this: t) (pname: Ident.pack_name) (pm: pack_mng) = ( + let pg = pm.pm_actual_src in + + Verbose.printf " init symbol tables for pack %s\n" + (Ident.pack_name_to_string pname); + (* ON COMMENCE PAR TRAITER LE PG_USES *) + let treat_uses px = ( + let pname = px.it in + let lxm = px.src in + let pum = try ( + Hashtbl.find this.st_pack_mng_tab pname + ) with Not_found -> ( + raise(Compile_error(lxm, "unknown package")) + ) in + let fill_used_item + (ii: SyntaxTree.item_ident) + (iks: Ident.long Lxm.srcflaged) = + ( + match ii with + | ConstItem n -> ( + SymbolTab.add_import_const pm.pm_body_stab n iks.it; + match pm.pm_provide_stab with + Some pt -> SymbolTab.add_import_const pt n iks.it + | None -> () ) - ) + | TypeItem n -> ( + SymbolTab.add_import_type pm.pm_body_stab n iks.it; + match pm.pm_provide_stab with + Some pt -> SymbolTab.add_import_type pt n iks.it + | None -> () + ) + | OperItem n -> ( + SymbolTab.add_import_oper pm.pm_body_stab n iks.it; + match pm.pm_provide_stab with + Some pt -> SymbolTab.add_import_oper pt n iks.it + | None -> () + ) + ) in + Hashtbl.iter fill_used_item pum.pm_user_items + ) + in + List.iter treat_uses pg.pg_uses ; + + (* PUIS LES DECLARATION LOCALES *) + (* ... dans le body : *) + Hashtbl.iter (SymbolTab.add_type pm.pm_body_stab) pg.pg_body.pk_type_table; + Hashtbl.iter (SymbolTab.add_const pm.pm_body_stab) pg.pg_body.pk_const_table; + Hashtbl.iter (SymbolTab.add_oper pm.pm_body_stab) pg.pg_body.pk_oper_table; + (* ... dans le provide : *) + match pg.pg_provides with + | None -> () + | Some spflg -> ( + let pptab = match pm.pm_provide_stab with + Some pt -> pt + | None -> assert false + in + let treat_prov x = ( + let lxm = x.src in + let s = (Lxm.id lxm) in + match (x.it) with + | TypeInfo xti -> + SymbolTab.add_type pptab s (Lxm.flagit xti lxm) + | ConstInfo xci -> + SymbolTab.add_const pptab s (Lxm.flagit xci lxm) + | OperInfo xoi -> + SymbolTab.add_oper pptab s (Lxm.flagit xoi lxm) + + ) in + List.iter treat_prov spflg + ) +) (**************************************************************************** Associations : @@ -384,4 +388,33 @@ let find_oper (genv: t) (pck: string) (idr: Ident.t) = (* exported *) -let dump x = print_string "XXX dump: finishme!" +let (dump : t -> unit) = + fun x -> + let p = Verbose.print_string in + p "*** « Syntax table dump:\n"; + + p " \t - Package or model list:\n\t\t"; + (* st_list : SyntaxTree.pack_or_model list ; *) + List.iter + (fun pm -> p (SyntaxTree.pack_or_model_to_string pm); p "\n\t\t") + x.st_list ; + + p "\n\t - Raw module table: "; + (* st_raw_mod_tab : (Ident.t , model_info srcflaged) Hashtbl.t ; *) + Hashtbl.iter + (fun id _mi -> p ((Ident.to_string id) ^ " ")) + x.st_raw_mod_tab; + + p "\n\t - Raw Package table: "; + (* st_raw_pack_tab : (Ident.pack_name , pack_info srcflaged) Hashtbl.t ; *) + Hashtbl.iter + (fun pn pi -> p ((Ident.pack_name_to_string pn) ^ " ")) + x.st_raw_pack_tab; + + p "\n\t - Package manager table: "; + (* st_pack_mng_tab : (Ident.pack_name , pack_mng) Hashtbl.t; *) + Hashtbl.iter + (fun pn pm -> p ((Ident.pack_name_to_string pn) ^ " ")) + x.st_pack_mng_tab; + + p "\nEnd of Syntax table dump. »\n" diff --git a/src/syntaxTree.ml b/src/syntaxTree.ml index 9c4a90680fec615154b3277f7dd0128f05e1c697..bd1927bc5dadb64fc73090fa004a0e0330a1ac74 100644 --- a/src/syntaxTree.ml +++ b/src/syntaxTree.ml @@ -1,7 +1,10 @@ -(** Time-stamp: <modified the 17/12/2007 (at 17:54) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/01/2008 (at 14:01) by Erwan Jahier> *) -(** Abstract syntax of source programs *) +(** (Raw) Abstract syntax tree of source programs. + +This syntax tree represented by Hash tables. +*) open Printf open Lxm (* pour la remontée au source *) @@ -435,3 +438,9 @@ let lexeme_of_pack_or_model = ( NSPack p -> p.src | NSModel m -> m.src ) + +(********************************************) +let (pack_or_model_to_string: pack_or_model -> string) = + function + | NSPack pi -> Ident.pack_name_to_string pi.it.pa_name ^ " (pack) " + | NSModel mi -> Ident.pack_name_to_string mi.it.mo_name ^ " (model) " diff --git a/src/test/test.res b/src/test/test.res index e80d5b376d7e5457ce2224a7431bd5038dd9d457..86852591d0806e6e189c593c820fe003beb2cb95 100644 --- a/src/test/test.res +++ b/src/test/test.res @@ -19,13 +19,25 @@ Non-regression tests 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -45,9 +57,16 @@ package inter export type Toto export oper bibi *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "struct0::main" + « Syntax table dump: + Package or model list:struct0 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "struct0::main" package dummy type Toto -> dummy::Toto @@ -60,9 +79,16 @@ package dummy export oper min_n export oper max *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t0::main" + « Syntax table dump: + Package or model list:t0 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t0::main" package dummy ====> ../lus2lic -vl 3 t2.lus @@ -75,9 +101,16 @@ package dummy export oper consensus_bis export oper consensus *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t2::main" + « Syntax table dump: + Package or model list:t2 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t2::main" package dummy ====> ../lus2lic -vl 3 test.lus @@ -87,9 +120,16 @@ package dummy export const y export type titi *** SyntaxTab.create pass 3 - symbol tables for pack P1 + init symbol tables for pack P1 *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "P1::main" + « Syntax table dump: + Package or model list:P1 (pack) + + Raw module table: + Raw Package table: P1 + Package manager table: P1 +End of Syntax table dump. » +-- MAIN NODE: "P1::main" package P1 type titi -> P1::titi @@ -99,9 +139,16 @@ package P1 init pack dummy export oper trivial *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "trivial::main" + « Syntax table dump: + Package or model list:trivial (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "trivial::main" package dummy ====> ../lus2lic -vl 3 x.lus @@ -114,9 +161,16 @@ package dummy export const x export const y *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "x::main" + « Syntax table dump: + Package or model list:x (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "x::main" package dummy ====> ../lus2lic -vl 3 consensus.lus @@ -128,9 +182,16 @@ package dummy export oper consensus export oper c8 *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "consensus::main" + « Syntax table dump: + Package or model list:consensus (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "consensus::main" package dummy ====> ../lus2lic -vl 3 left.lus @@ -140,9 +201,16 @@ package dummy export type truc export oper toto *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "left::main" + « Syntax table dump: + Package or model list:left (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "left::main" package dummy type truc -> dummy::truc @@ -175,13 +243,25 @@ package dummy 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -217,13 +297,25 @@ package inter 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -245,9 +337,16 @@ package inter export oper map2 export oper toto *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t::main" + « Syntax table dump: + Package or model list:t (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t::main" package dummy ====> ../lus2lic -vl 3 trivial.lus @@ -256,9 +355,16 @@ package dummy init pack dummy export oper trivial *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "trivial::main" + « Syntax table dump: + Package or model list:trivial (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "trivial::main" package dummy ====> ../lus2lic -vl 3 t1.lus @@ -269,7 +375,14 @@ package dummy export oper consensus export oper bt_void *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t1::main" + « Syntax table dump: + Package or model list:t1 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t1::main" package dummy diff --git a/src/test/test.res.exp b/src/test/test.res.exp index e80d5b376d7e5457ce2224a7431bd5038dd9d457..86852591d0806e6e189c593c820fe003beb2cb95 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -19,13 +19,25 @@ Non-regression tests 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -45,9 +57,16 @@ package inter export type Toto export oper bibi *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "struct0::main" + « Syntax table dump: + Package or model list:struct0 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "struct0::main" package dummy type Toto -> dummy::Toto @@ -60,9 +79,16 @@ package dummy export oper min_n export oper max *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t0::main" + « Syntax table dump: + Package or model list:t0 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t0::main" package dummy ====> ../lus2lic -vl 3 t2.lus @@ -75,9 +101,16 @@ package dummy export oper consensus_bis export oper consensus *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t2::main" + « Syntax table dump: + Package or model list:t2 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t2::main" package dummy ====> ../lus2lic -vl 3 test.lus @@ -87,9 +120,16 @@ package dummy export const y export type titi *** SyntaxTab.create pass 3 - symbol tables for pack P1 + init symbol tables for pack P1 *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "P1::main" + « Syntax table dump: + Package or model list:P1 (pack) + + Raw module table: + Raw Package table: P1 + Package manager table: P1 +End of Syntax table dump. » +-- MAIN NODE: "P1::main" package P1 type titi -> P1::titi @@ -99,9 +139,16 @@ package P1 init pack dummy export oper trivial *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "trivial::main" + « Syntax table dump: + Package or model list:trivial (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "trivial::main" package dummy ====> ../lus2lic -vl 3 x.lus @@ -114,9 +161,16 @@ package dummy export const x export const y *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "x::main" + « Syntax table dump: + Package or model list:x (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "x::main" package dummy ====> ../lus2lic -vl 3 consensus.lus @@ -128,9 +182,16 @@ package dummy export oper consensus export oper c8 *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "consensus::main" + « Syntax table dump: + Package or model list:consensus (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "consensus::main" package dummy ====> ../lus2lic -vl 3 left.lus @@ -140,9 +201,16 @@ package dummy export type truc export oper toto *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "left::main" + « Syntax table dump: + Package or model list:left (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "left::main" package dummy type truc -> dummy::truc @@ -175,13 +243,25 @@ package dummy 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -217,13 +297,25 @@ package inter 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 + init symbol tables for pack inter + init symbol tables for pack mainPack + init symbol tables for pack pint + init symbol tables for pack pbool + init symbol tables for pack preal *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "pint::main" + « Syntax table dump: + Package or model list:modSimple (model) + pint (pack) + pbool (pack) + preal (pack) + inter (pack) + mainPack (pack) + + Raw module table: modSimple + Raw Package table: inter mainPack pint pbool preal + Package manager table: inter mainPack pint pbool preal +End of Syntax table dump. » +-- MAIN NODE: "pint::main" package preal type t -> real package pbool @@ -245,9 +337,16 @@ package inter export oper map2 export oper toto *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t::main" + « Syntax table dump: + Package or model list:t (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t::main" package dummy ====> ../lus2lic -vl 3 trivial.lus @@ -256,9 +355,16 @@ package dummy init pack dummy export oper trivial *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "trivial::main" + « Syntax table dump: + Package or model list:trivial (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "trivial::main" package dummy ====> ../lus2lic -vl 3 t1.lus @@ -269,7 +375,14 @@ package dummy export oper consensus export oper bt_void *** SyntaxTab.create pass 3 - symbol tables for pack dummy + init symbol tables for pack dummy *** SyntaxTab.create done -XXX dump: finishme!-- MAIN NODE: "t1::main" + « Syntax table dump: + Package or model list:t1 (pack) + + Raw module table: + Raw Package table: dummy + Package manager table: dummy +End of Syntax table dump. » +-- MAIN NODE: "t1::main" package dummy diff --git a/src/verbose.ml b/src/verbose.ml index 50bf8ccb9cdaf9fb434a180a2804ad06b77e1afa..9761f4ea8f3bc119ba0f880301b1dc11e8cfdfda 100644 --- a/src/verbose.ml +++ b/src/verbose.ml @@ -30,9 +30,12 @@ let set_level (l:int) = ( _level := l ) let get_level () = !_level (**** VERSION PAS TROP GORE *****) -let put ?(level=1) s = Printf.kprintf +let printf ?(level=1) s = Printf.kprintf (fun t -> if (!_level >= level) then (print_string t) else ()) s +let print_string ?(level=1) s = + if (!_level >= level) then (print_string s) + (**** VERSION GORE *****) (* diff --git a/src/verbose.mli b/src/verbose.mli index c94ed0710fdc03c9a9f74c459178cc4d4ba0b4c3..3124d327dacccb78e1db7248ac72de38f9658750 100644 --- a/src/verbose.mli +++ b/src/verbose.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 18/12/2007 (at 14:29) by Erwan Jahier> *) +(** Time-stamp: <modified the 28/01/2008 (at 14:13) by Erwan Jahier> *) (*---------------------------------------------------------------------- module : Verbose @@ -16,4 +16,5 @@ Verbose.put "format" args... val set_level : int -> unit val get_level : unit -> int -val put : ?level:int -> ('a, unit, string, unit) format4 -> 'a +val printf : ?level:int -> ('a, unit, string, unit) format4 -> 'a +val print_string : ?level:int -> string -> unit diff --git a/src/version.ml b/src/version.ml index 8702233f67a0e65da9c717b390265be33386c5d2..a4071868963ab295be7dfa7dc84283e0fe2606dd 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 = "10" -let sha_1 = "a2f521dd15d3377a8a10e46fefdf415ad68effa9" +let commit = "11" +let sha_1 = "cbec21161346256d244e19c3f507170352f9bb4f" let str = (branch ^ "." ^ commit)