Skip to content

Commit

Permalink
feat(eo-phi-normalizer): update atoms list
Browse files Browse the repository at this point in the history
- add missing atoms (without implementation)
- mark deprecated atoms
  • Loading branch information
deemp committed Dec 6, 2024
1 parent ed33d4e commit 636fc27
Showing 1 changed file with 74 additions and 15 deletions.
89 changes: 74 additions & 15 deletions eo-phi-normalizer/src/Language/EO/Phi/Dataize/Atoms.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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)
,
Expand All @@ -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
Expand Down

0 comments on commit 636fc27

Please sign in to comment.