From 636fc278c6942c00ef3903be5954406b9c555de5 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 6 Dec 2024 19:13:34 +0300 Subject: [PATCH] feat(eo-phi-normalizer): update atoms list - add missing atoms (without implementation) - mark deprecated atoms --- .../src/Language/EO/Phi/Dataize/Atoms.hs | 89 +++++++++++++++---- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Dataize/Atoms.hs b/eo-phi-normalizer/src/Language/EO/Phi/Dataize/Atoms.hs index 4c33797b..4881a7c4 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Dataize/Atoms.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Dataize/Atoms.hs @@ -34,11 +34,17 @@ import Language.EO.Phi.Syntax knownAtomsList :: [(String, String -> Object -> EvaluationState -> DataizeChain (Object, EvaluationState))] knownAtomsList = - [ ("Lorg_eolang_int_gt", evaluateIntIntBoolFunChain (>)) + [ ("Lorg_eolang_as_phi", _) + , ("Lorg_eolang_int_gt", evaluateIntIntBoolFunChain (>)) , ("Lorg_eolang_int_plus", evaluateIntIntIntFunChain (+)) , ("Lorg_eolang_int_times", evaluateIntIntIntFunChain (*)) , ("Lorg_eolang_int_div", evaluateIntIntIntFunChain quot) + , ("Lorg_eolang_bytes_and", evaluateBytesBytesBytesFunChain (.&.)) + , ("Lorg_eolang_bytes_concat", evaluateBinaryDataizationFunChain id id wrapBytesInBytes extractRho (extractLabel "b") concatBytes) , ("Lorg_eolang_bytes_eq", evaluateBinaryDataizationFunChain boolToBytes bytesToInt wrapBytesAsBool extractRho (extractLabel "b") (==)) + , ("Lorg_eolang_bytes_not", evaluateBytesBytesFunChain complement) + , ("Lorg_eolang_bytes_or", evaluateBytesBytesBytesFunChain (.|.)) + , ("Lorg_eolang_bytes_right", evaluateBinaryDataizationFunChain intToBytes bytesToInt wrapBytesInBytes extractRho (extractLabel "x") (\x i -> shift x (-i))) , ( "Lorg_eolang_bytes_size" , let f = evaluateUnaryDataizationFunChain intToBytes id wrapBytesInBytes extractRho (\(Bytes bytes) -> length (words (map dashToSpace bytes))) @@ -56,21 +62,68 @@ knownAtomsList = AsObject _ -> fail "Couldn't find bytes" evaluateBinaryDataizationFunChain id bytesToInt wrapBytesInBytes (extractLabel "start") (extractLabel "len") (sliceBytes bytes) name obj state ) - , ("Lorg_eolang_bytes_and", evaluateBytesBytesBytesFunChain (.&.)) - , ("Lorg_eolang_bytes_or", evaluateBytesBytesBytesFunChain (.|.)) , ("Lorg_eolang_bytes_xor", evaluateBytesBytesBytesFunChain (.^.)) - , ("Lorg_eolang_bytes_not", evaluateBytesBytesFunChain complement) - , ("Lorg_eolang_bytes_right", evaluateBinaryDataizationFunChain intToBytes bytesToInt wrapBytesInBytes extractRho (extractLabel "x") (\x i -> shift x (-i))) - , ("Lorg_eolang_bytes_concat", evaluateBinaryDataizationFunChain id id wrapBytesInBytes extractRho (extractLabel "b") concatBytes) + , -- deprecated + ("Lorg_eolang_dataized", evaluateUnaryDataizationFunChain id id wrapBytesInBytes (extractLabel "target") id) + , ("Lorg_eolang_cage_encaged_encage", _) + , ("Lorg_eolang_cage_encaged_φ", _) + , ("Lorg_eolang_cage_φ", _) + , ("Lorg_eolang_error", evaluateUnaryDataizationFunChain stringToBytes bytesToString wrapBytesInBytes (extractLabel "message") error) , -- float + -- deprecated ("Lorg_eolang_float_gt", evaluateBinaryDataizationFunChain boolToBytes bytesToFloat wrapBytesInBytes extractRho (extractLabel "x") (>)) - , ("Lorg_eolang_float_times", evaluateFloatFloatFloatFunChain (*)) - , ("Lorg_eolang_float_plus", evaluateFloatFloatFloatFunChain (+)) - , ("Lorg_eolang_float_div", evaluateFloatFloatFloatFunChain (/)) - , ("Lorg_eolang_float_gt", evaluateBinaryDataizationFunChain boolToBytes bytesToFloat wrapBytesInBytes extractRho (extractLabel "x") (>)) - , ("Lorg_eolang_float_times", evaluateFloatFloatFloatFunChain (*)) - , ("Lorg_eolang_float_plus", evaluateFloatFloatFloatFunChain (+)) - , ("Lorg_eolang_float_div", evaluateFloatFloatFloatFunChain (/)) + , -- deprecated + ("Lorg_eolang_float_times", evaluateFloatFloatFloatFunChain (*)) + , -- deprecated + ("Lorg_eolang_float_plus", evaluateFloatFloatFloatFunChain (+)) + , -- deprecated + ("Lorg_eolang_float_div", evaluateFloatFloatFloatFunChain (/)) + , -- deprecated + ("Lorg_eolang_float_gt", evaluateBinaryDataizationFunChain boolToBytes bytesToFloat wrapBytesInBytes extractRho (extractLabel "x") (>)) + , -- deprecated + ("Lorg_eolang_float_times", evaluateFloatFloatFloatFunChain (*)) + , -- deprecated + ("Lorg_eolang_float_plus", evaluateFloatFloatFloatFunChain (+)) + , -- deprecated + ("Lorg_eolang_float_div", evaluateFloatFloatFloatFunChain (/)) + , ("Lorg_eolang_fs_dir_made_mkdir", _) + , ("Lorg_eolang_fs_dir_tmpfile_touch", _) + , ("Lorg_eolang_fs_dir_walk", _) + , ("Lorg_eolang_fs_file_deleted_delete", _) + , ("Lorg_eolang_fs_file_exists", _) + , ("Lorg_eolang_fs_file_is_directory", _) + , ("Lorg_eolang_fs_file_moved_move", _) + , ("Lorg_eolang_fs_file_open_file_stream_read_read_bytes", _) + , ("Lorg_eolang_fs_file_open_file_stream_write_written_bytes", _) + , ("Lorg_eolang_fs_file_open_process_file", _) + , ("Lorg_eolang_fs_file_size", _) + , ("Lorg_eolang_fs_file_touched_touch", _) + , ("Lorg_eolang_i16_as_i32", _) + , ("Lorg_eolang_i32_as_i64", _) + , ("Lorg_eolang_i64_as_number", _) + , ("Lorg_eolang_i64_div", _) + , ("Lorg_eolang_i64_gt", _) + , ("Lorg_eolang_i64_plus", _) + , ("Lorg_eolang_i64_times", _) + , ("Lorg_eolang_malloc_of_allocated_read", _) + , ("Lorg_eolang_malloc_of_allocated_resize", _) + , ("Lorg_eolang_malloc_of_allocated_size", _) + , ("Lorg_eolang_malloc_of_allocated_write", _) + , ("Lorg_eolang_malloc_of_φ", _) + , ("Lorg_eolang_math_angle_cos", _) + , ("Lorg_eolang_math_angle_sin", _) + , ("Lorg_eolang_math_real_acos", _) + , ("Lorg_eolang_math_real_asin", _) + , ("Lorg_eolang_math_real_ln", _) + , ("Lorg_eolang_math_real_pow", _) + , ("Lorg_eolang_math_real_sqrt", _) + , ("Lorg_eolang_number_as_i64", _) + , ("Lorg_eolang_number_div", _) + , ("Lorg_eolang_number_floor", _) + , ("Lorg_eolang_number_gt", _) + , ("Lorg_eolang_number_plus", _) + , ("Lorg_eolang_number_times", _) + , ("Lorg_eolang_rust", _) , -- string ("Lorg_eolang_string_length", evaluateUnaryDataizationFunChain intToBytes bytesToString wrapBytesInConstInt extractRho length) , @@ -83,8 +136,14 @@ knownAtomsList = evaluateBinaryDataizationFunChain stringToBytes bytesToInt wrapBytesInConstString (extractLabel "start") (extractLabel "len") (\start len -> take len (drop start string)) name obj state ) , -- others - ("Lorg_eolang_dataized", evaluateUnaryDataizationFunChain id id wrapBytesInBytes (extractLabel "target") id) - , ("Lorg_eolang_error", evaluateUnaryDataizationFunChain stringToBytes bytesToString wrapBytesInBytes (extractLabel "message") error) + ("Lorg_eolang_sys_os_name", _) + , ("Lorg_eolang_sys_posix_φ", _) + , ("Lorg_eolang_sys_win32_φ", _) + , ("Lorg_eolang_try", _) + , ("Lorg_eolang_txt_regex_compiled", _) + , ("Lorg_eolang_txt_regex_pattern_match_matched_from_index", _) + , ("Lorg_eolang_txt_sprintf", _) + , ("Lorg_eolang_txt_sscanf", _) , ( "Package" , let