From 85e2f310c170aabadbbaae9093d25c56ceef3d55 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 6 Dec 2024 15:34:56 +0300 Subject: [PATCH 01/69] fix(scripts): use the same tag for --parser and --home-tag --- scripts/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index 9f3ce85ed..174c3172c 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -183,7 +183,7 @@ function commit_and_push_if_changed { export -f commit_and_push_if_changed function eo { - npx eoc --parser="$EO" --home-tag="0.41.1" --batch --no-color "$@" + npx eoc --parser="$EO" --home-tag="$EO" --batch --no-color "$@" } export -f eo From 210ab864eba080349acaace255e585e25513a107 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Mon, 16 Dec 2024 22:27:29 +0300 Subject: [PATCH 02/69] chore(eo): switch from 0.41.2 to 0.49.1 --- eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo b/eo index 0757c993a..afbac6c44 160000 --- a/eo +++ b/eo @@ -1 +1 @@ -Subproject commit 0757c993acee2fdd1cb8363b6d0191825091827b +Subproject commit afbac6c447de20a81e20f44a8259d28a1a4547c9 From f942083abc0b018925425dcaeb0cdc136b79334a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Dec 2024 19:33:07 +0000 Subject: [PATCH 03/69] Update pipeline/pipeline.lock --- pipeline/pipeline.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index 56d98e55c..8af881342 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ -EO_HEAD_HASH="0757c993acee2fdd1cb8363b6d0191825091827b" +EO_HEAD_HASH="afbac6c447de20a81e20f44a8259d28a1a4547c9" PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" From cb7f1bcd6ee435bbd457710e5b65e99c6233ceee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Dec 2024 19:33:08 +0000 Subject: [PATCH 04/69] Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.49.1/dependencies.md | 3933 +++++++++++++++++ .../data/0.49.1/org/eolang/as-phi.phi | 11 + .../data/0.49.1/org/eolang/bytes.phi | 95 + .../data/0.49.1/org/eolang/cti.phi | 11 + .../data/0.49.1/org/eolang/dataized.phi | 18 + .../data/0.49.1/org/eolang/error.phi | 11 + .../data/0.49.1/org/eolang/false.phi | 21 + .../data/0.49.1/org/eolang/fs/dir.phi | 71 + .../data/0.49.1/org/eolang/fs/file.phi | 164 + .../data/0.49.1/org/eolang/fs/path.phi | 273 ++ .../data/0.49.1/org/eolang/fs/tmpdir.phi | 39 + .../data/0.49.1/org/eolang/go.phi | 34 + .../data/0.49.1/org/eolang/i16.phi | 67 + .../data/0.49.1/org/eolang/i32.phi | 79 + .../data/0.49.1/org/eolang/i64.phi | 59 + .../0.49.1/org/eolang/io/bytes-as-input.phi | 36 + .../data/0.49.1/org/eolang/io/console.phi | 122 + .../data/0.49.1/org/eolang/io/dead-input.phi | 22 + .../data/0.49.1/org/eolang/io/dead-output.phi | 22 + .../0.49.1/org/eolang/io/input-length.phi | 21 + .../0.49.1/org/eolang/io/malloc-as-output.phi | 30 + .../data/0.49.1/org/eolang/io/stdin.phi | 45 + .../data/0.49.1/org/eolang/io/stdout.phi | 18 + .../data/0.49.1/org/eolang/io/tee-input.phi | 34 + .../data/0.49.1/org/eolang/malloc.phi | 52 + .../data/0.49.1/org/eolang/math/angle.phi | 30 + .../data/0.49.1/org/eolang/math/e.phi | 12 + .../data/0.49.1/org/eolang/math/integral.phi | 66 + .../data/0.49.1/org/eolang/math/numbers.phi | 42 + .../data/0.49.1/org/eolang/math/pi.phi | 12 + .../data/0.49.1/org/eolang/math/random.phi | 53 + .../data/0.49.1/org/eolang/math/real.phi | 49 + .../data/0.49.1/org/eolang/nan.phi | 44 + .../0.49.1/org/eolang/negative-infinity.phi | 61 + .../data/0.49.1/org/eolang/net/socket.phi | 535 +++ .../data/0.49.1/org/eolang/number.phi | 74 + .../0.49.1/org/eolang/positive-infinity.phi | 61 + .../data/0.49.1/org/eolang/rust.phi | 11 + .../data/0.49.1/org/eolang/seq.phi | 17 + .../data/0.49.1/org/eolang/string.phi | 155 + .../org/eolang/structs/bytes-as-array.phi | 23 + .../org/eolang/structs/hash-code-of.phi | 30 + .../data/0.49.1/org/eolang/structs/list.phi | 194 + .../data/0.49.1/org/eolang/structs/map.phi | 122 + .../org/eolang/structs/range-of-ints.phi | 26 + .../data/0.49.1/org/eolang/structs/range.phi | 23 + .../data/0.49.1/org/eolang/structs/set.phi | 37 + .../data/0.49.1/org/eolang/switch.phi | 18 + .../data/0.49.1/org/eolang/sys/getenv.phi | 19 + .../0.49.1/org/eolang/sys/line-separator.phi | 14 + .../data/0.49.1/org/eolang/sys/os.phi | 23 + .../data/0.49.1/org/eolang/sys/posix.phi | 35 + .../data/0.49.1/org/eolang/sys/win32.phi | 38 + .../data/0.49.1/org/eolang/true.phi | 21 + .../data/0.49.1/org/eolang/try.phi | 11 + .../data/0.49.1/org/eolang/tuple.phi | 39 + .../data/0.49.1/org/eolang/txt/regex.phi | 56 + .../data/0.49.1/org/eolang/txt/sprintf.phi | 14 + .../data/0.49.1/org/eolang/txt/sscanf.phi | 14 + .../data/0.49.1/org/eolang/txt/text.phi | 275 ++ .../data/0.49.1/org/eolang/while.phi | 22 + 61 files changed, 7564 insertions(+) create mode 100644 eo-phi-normalizer/data/0.49.1/dependencies.md create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/as-phi.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/bytes.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/cti.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/dataized.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/error.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/false.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/fs/dir.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/fs/file.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/fs/path.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/fs/tmpdir.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/go.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/i16.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/i32.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/i64.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/bytes-as-input.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/console.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-input.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-output.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/input-length.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/malloc-as-output.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/stdin.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/stdout.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/io/tee-input.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/malloc.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/angle.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/e.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/integral.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/numbers.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/pi.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/random.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/math/real.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/nan.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/negative-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/net/socket.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/number.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/positive-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/rust.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/seq.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/string.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/bytes-as-array.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/hash-code-of.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/list.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/map.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/range-of-ints.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/range.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/structs/set.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/switch.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/sys/getenv.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/sys/line-separator.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/sys/os.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/sys/posix.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/sys/win32.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/true.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/try.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/tuple.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/txt/regex.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/txt/sprintf.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/txt/sscanf.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/txt/text.phi create mode 100644 eo-phi-normalizer/data/0.49.1/org/eolang/while.phi diff --git a/eo-phi-normalizer/data/0.49.1/dependencies.md b/eo-phi-normalizer/data/0.49.1/dependencies.md new file mode 100644 index 000000000..4ffb4e607 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/dependencies.md @@ -0,0 +1,3933 @@ +# Dependencies + +## [org/eolang/as-phi.phi](./org/eolang/as-phi.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + as-phi(x) ↦ ⟦ + λ ⤍ Lorg_eolang_as_phi + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/bytes.phi](./org/eolang/bytes.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/cti.phi](./org/eolang/cti.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/dataized.phi](./org/eolang/dataized.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/error.phi](./org/eolang/error.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/false.phi](./org/eolang/false.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + false ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/dir.phi](./org/eolang/fs/dir.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/file.phi](./org/eolang/fs/file.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/path.phi](./org/eolang/fs/path.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-356-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-356-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/tmpdir.phi](./org/eolang/fs/tmpdir.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + tmpdir ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1 ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/go.phi](./org/eolang/go.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + go ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i16.phi](./org/eolang/i16.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32 ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i32.phi](./org/eolang/i32.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i64.phi](./org/eolang/i64.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/bytes-as-input.phi](./org/eolang/io/bytes-as-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/console.phi](./org/eolang/io/console.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + console ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-input ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-output ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/input-length.phi](./org/eolang/io/input-length.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/malloc-as-output.phi](./org/eolang/io/malloc-as-output.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdin.phi](./org/eolang/io/stdin.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdin ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdout.phi](./org/eolang/io/stdout.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/tee-input.phi](./org/eolang/io/tee-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/malloc.phi](./org/eolang/malloc.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + malloc ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/angle.phi](./org/eolang/math/angle.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/e.phi](./org/eolang/math/e.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/integral.phi](./org/eolang/math/integral.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/numbers.phi](./org/eolang/math/numbers.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/pi.phi](./org/eolang/math/pi.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/random.phi](./org/eolang/math/random.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/real.phi](./org/eolang/math/real.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/nan.phi](./org/eolang/nan.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + nan ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + negative-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/net/socket.phi](./org/eolang/net/socket.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + net ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/number.phi](./org/eolang/number.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + positive-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/rust.phi](./org/eolang/rust.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + rust(code, portal, params) ↦ ⟦ + λ ⤍ Lorg_eolang_rust + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/seq.phi](./org/eolang/seq.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/string.phi](./org/eolang/string.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/bytes-as-array.phi](./org/eolang/structs/bytes-as-array.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/hash-code-of.phi](./org/eolang/structs/hash-code-of.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/list.phi](./org/eolang/structs/list.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/map.phi](./org/eolang/structs/map.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54 ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12 ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6 ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18 ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range-of-ints.phi](./org/eolang/structs/range-of-ints.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8 ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range.phi](./org/eolang/structs/range.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/set.phi](./org/eolang/structs/set.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/switch.phi](./org/eolang/switch.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/getenv.phi](./org/eolang/sys/getenv.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/line-separator.phi](./org/eolang/sys/line-separator.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + line-separator ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/os.phi](./org/eolang/sys/os.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + os ↦ ⟦ + φ ↦ ξ.name, + is-windows ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/posix.phi](./org/eolang/sys/posix.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/win32.phi](./org/eolang/sys/win32.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/true.phi](./org/eolang/true.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + true ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/try.phi](./org/eolang/try.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/tuple.phi](./org/eolang/tuple.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/regex.phi](./org/eolang/txt/regex.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sprintf.phi](./org/eolang/txt/sprintf.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sscanf.phi](./org/eolang/txt/sscanf.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/text.phi](./org/eolang/txt/text.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/while.phi](./org/eolang/while.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/as-phi.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/as-phi.phi new file mode 100644 index 000000000..e7fe44c8f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/as-phi.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + as-phi(x) ↦ ⟦ + λ ⤍ Lorg_eolang_as_phi + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/bytes.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/bytes.phi new file mode 100644 index 000000000..263333ea7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/bytes.phi @@ -0,0 +1,95 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/cti.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/cti.phi new file mode 100644 index 000000000..23e09d15e --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/cti.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/dataized.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/dataized.phi new file mode 100644 index 000000000..4831387b5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/dataized.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/error.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/error.phi new file mode 100644 index 000000000..c09492f93 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/error.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/false.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/false.phi new file mode 100644 index 000000000..934a84ea8 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/false.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + false ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/fs/dir.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/dir.phi new file mode 100644 index 000000000..065da5041 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/dir.phi @@ -0,0 +1,71 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/fs/file.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/file.phi new file mode 100644 index 000000000..9d791cb4f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/file.phi @@ -0,0 +1,164 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/fs/path.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/path.phi new file mode 100644 index 000000000..03d79350c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/path.phi @@ -0,0 +1,273 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-356-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-356-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/fs/tmpdir.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/tmpdir.phi new file mode 100644 index 000000000..901568f23 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/fs/tmpdir.phi @@ -0,0 +1,39 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + tmpdir ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1 ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/go.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/go.phi new file mode 100644 index 000000000..02ad1de6a --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/go.phi @@ -0,0 +1,34 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + go ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/i16.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/i16.phi new file mode 100644 index 000000000..84002c9b7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/i16.phi @@ -0,0 +1,67 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32 ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/i32.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/i32.phi new file mode 100644 index 000000000..140963159 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/i32.phi @@ -0,0 +1,79 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/i64.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/i64.phi new file mode 100644 index 000000000..12ab7c0d4 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/i64.phi @@ -0,0 +1,59 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/bytes-as-input.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/bytes-as-input.phi new file mode 100644 index 000000000..a145375e4 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/bytes-as-input.phi @@ -0,0 +1,36 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/console.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/console.phi new file mode 100644 index 000000000..393d7fba7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/console.phi @@ -0,0 +1,122 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + console ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-input.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-input.phi new file mode 100644 index 000000000..f3fe02859 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-input.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-input ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-output.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-output.phi new file mode 100644 index 000000000..56c5c73e0 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/dead-output.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-output ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/input-length.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/input-length.phi new file mode 100644 index 000000000..1ed2e1bea --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/input-length.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/malloc-as-output.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/malloc-as-output.phi new file mode 100644 index 000000000..fb787712d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/malloc-as-output.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdin.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdin.phi new file mode 100644 index 000000000..281cb68df --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdin.phi @@ -0,0 +1,45 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdin ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdout.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdout.phi new file mode 100644 index 000000000..4151c8f91 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/stdout.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/io/tee-input.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/io/tee-input.phi new file mode 100644 index 000000000..c139df912 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/io/tee-input.phi @@ -0,0 +1,34 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/malloc.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/malloc.phi new file mode 100644 index 000000000..a51907980 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/malloc.phi @@ -0,0 +1,52 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + malloc ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/angle.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/angle.phi new file mode 100644 index 000000000..dac88cf76 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/angle.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/e.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/e.phi new file mode 100644 index 000000000..fd09f7146 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/e.phi @@ -0,0 +1,12 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/integral.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/integral.phi new file mode 100644 index 000000000..9587279e6 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/integral.phi @@ -0,0 +1,66 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/numbers.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/numbers.phi new file mode 100644 index 000000000..0633156a8 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/numbers.phi @@ -0,0 +1,42 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/pi.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/pi.phi new file mode 100644 index 000000000..05ab9d147 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/pi.phi @@ -0,0 +1,12 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/random.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/random.phi new file mode 100644 index 000000000..d93af88d1 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/random.phi @@ -0,0 +1,53 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/math/real.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/math/real.phi new file mode 100644 index 000000000..9005a4d27 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/math/real.phi @@ -0,0 +1,49 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/nan.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/nan.phi new file mode 100644 index 000000000..5bd65cdf5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/nan.phi @@ -0,0 +1,44 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + nan ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/negative-infinity.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/negative-infinity.phi new file mode 100644 index 000000000..622952c70 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/negative-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + negative-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/net/socket.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/net/socket.phi new file mode 100644 index 000000000..03ba5b913 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/net/socket.phi @@ -0,0 +1,535 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + net ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi new file mode 100644 index 000000000..18ff8c183 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi @@ -0,0 +1,74 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/positive-infinity.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/positive-infinity.phi new file mode 100644 index 000000000..4d0d34134 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/positive-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + positive-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/rust.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/rust.phi new file mode 100644 index 000000000..c9bea13a5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/rust.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + rust(code, portal, params) ↦ ⟦ + λ ⤍ Lorg_eolang_rust + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/seq.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/seq.phi new file mode 100644 index 000000000..a1de0ce03 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/seq.phi @@ -0,0 +1,17 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/string.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/string.phi new file mode 100644 index 000000000..b50ac6c96 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/string.phi @@ -0,0 +1,155 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/bytes-as-array.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/bytes-as-array.phi new file mode 100644 index 000000000..7329c2169 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/bytes-as-array.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/hash-code-of.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/hash-code-of.phi new file mode 100644 index 000000000..b792ec697 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/hash-code-of.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/list.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/list.phi new file mode 100644 index 000000000..616a110ed --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/list.phi @@ -0,0 +1,194 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/map.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/map.phi new file mode 100644 index 000000000..9ead205f5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/map.phi @@ -0,0 +1,122 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54 ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12 ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6 ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18 ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range-of-ints.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range-of-ints.phi new file mode 100644 index 000000000..269e097c3 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range-of-ints.phi @@ -0,0 +1,26 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8 ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range.phi new file mode 100644 index 000000000..a9b7f2048 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/range.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/structs/set.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/set.phi new file mode 100644 index 000000000..b4aaab41c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/structs/set.phi @@ -0,0 +1,37 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/switch.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/switch.phi new file mode 100644 index 000000000..74d59bd77 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/switch.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/sys/getenv.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/getenv.phi new file mode 100644 index 000000000..86fe10af2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/getenv.phi @@ -0,0 +1,19 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/sys/line-separator.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/line-separator.phi new file mode 100644 index 000000000..96e7398eb --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/line-separator.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + line-separator ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/sys/os.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/os.phi new file mode 100644 index 000000000..ce101948a --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/os.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + os ↦ ⟦ + φ ↦ ξ.name, + is-windows ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/sys/posix.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/posix.phi new file mode 100644 index 000000000..34f897976 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/posix.phi @@ -0,0 +1,35 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/sys/win32.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/win32.phi new file mode 100644 index 000000000..16fb1772d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/sys/win32.phi @@ -0,0 +1,38 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/true.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/true.phi new file mode 100644 index 000000000..5adeeff26 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/true.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + true ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/try.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/try.phi new file mode 100644 index 000000000..45859a8cf --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/try.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/tuple.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/tuple.phi new file mode 100644 index 000000000..ceb401fa2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/tuple.phi @@ -0,0 +1,39 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/txt/regex.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/regex.phi new file mode 100644 index 000000000..5aecce4f1 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/regex.phi @@ -0,0 +1,56 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sprintf.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sprintf.phi new file mode 100644 index 000000000..5add6db64 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sprintf.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sscanf.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sscanf.phi new file mode 100644 index 000000000..25f4ed513 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/sscanf.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/txt/text.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/text.phi new file mode 100644 index 000000000..3736295c5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/txt/text.phi @@ -0,0 +1,275 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/while.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/while.phi new file mode 100644 index 000000000..66ba4c723 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/while.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file From 0e0edf7779dcb2fe7e15075f0bd19e24dded5a6b Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Mon, 16 Dec 2024 22:46:59 +0300 Subject: [PATCH 05/69] chore(node): update eolang to 0.28.0 --- package-lock.json | 24 ++++++++++++------------ package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4920cd377..45a95a8e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "eo-phi-normalizer", "devDependencies": { - "eolang": "^0.24.0", + "eolang": "^0.28.0", "prettier": "^3.2.5" } }, @@ -198,9 +198,9 @@ } }, "node_modules/eolang": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/eolang/-/eolang-0.24.0.tgz", - "integrity": "sha512-Uv+KGtC8VAGk8AgDBfbJmX6k2vbh51cfpo19iP+nxpm2wqZFYdwbQoHmzjW+Rbwu+TVAEZvnpinbGpjZWxGE4Q==", + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/eolang/-/eolang-0.28.0.tgz", + "integrity": "sha512-Wa6DH7ZU/GYOLnr7kt8Kzd46BlmJ7npg/EhxFiIuB7mxwDwf/y8J2uNk0wTF83SJHAVZwZcAU+FdU4xDSux3GA==", "dev": true, "license": "MIT", "os": [ @@ -212,8 +212,8 @@ "colors": "1.4.0", "commander": "12.1.0", "eo2js": "0.0.7", - "fast-xml-parser": "4.5.0", - "node": "23.2.0", + "fast-xml-parser": "4.5.1", + "node": "23.4.0", "relative": "3.0.2", "semver": "7.6.3", "sync-request": "6.1.0", @@ -237,9 +237,9 @@ } }, "node_modules/fast-xml-parser": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz", - "integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.1.tgz", + "integrity": "sha512-y655CeyUQ+jj7KBbYMc4FG01V8ZQqjN+gDYGJ50RtfsUB8iG9AmwmwoAgeKLJdmueKKMrH1RJ7yXHTSoczdv5w==", "dev": true, "funding": [ { @@ -460,9 +460,9 @@ } }, "node_modules/node": { - "version": "23.2.0", - "resolved": "https://registry.npmjs.org/node/-/node-23.2.0.tgz", - "integrity": "sha512-o2LBqSz7WpETv9RP+E9pIELw5xpwYkCn7Dk+v+MoQMk3YxHUgOXr8R9XiyXJf6mEwfHwFrzjNm7YYeG2VEdasw==", + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/node/-/node-23.4.0.tgz", + "integrity": "sha512-uzDNv0OyY8xC7x1/CuYx2c9G3g33GznkhPFs89Q2trrk7M9JzYFj8nlEbv9E666ihJdop+WaeCQST2Hbm/iKuw==", "dev": true, "hasInstallScript": true, "license": "ISC", diff --git a/package.json b/package.json index 106da4dc9..4ba71419e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eo-phi-normalizer", "devDependencies": { - "eolang": "^0.24.0", + "eolang": "^0.28.0", "prettier": "^3.2.5" } } From a34269fc3933b5e8708d7d53f6b8c10c11b7059a Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 17 Dec 2024 08:40:13 +0300 Subject: [PATCH 06/69] fix(scripts): ignore warnings --- scripts/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index fbf77e034..0531ef2f8 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -183,7 +183,7 @@ function commit_and_push_if_changed { export -f commit_and_push_if_changed function eo { - npx eoc --parser="$EO" --home-tag="$EO" --batch --no-color "$@" + npx eoc --parser="$EO" --home-tag="$EO" --batch --no-color --easy "$@" } export -f eo From b953999e300e22868ccba9f9c1da35d5b184e6d1 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 17 Dec 2024 16:17:05 +0300 Subject: [PATCH 07/69] =?UTF-8?q?feat(eo-phi-normalizer):=20support=20"?= =?UTF-8?q?=CE=A6=CC=87=20=20"=20instead=20of=20"=CE=A6.org.eolang"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eo-phi-normalizer/app/Main.hs | 5 ++-- eo-phi-normalizer/grammar/EO/Phi/Syntax.cf | 29 ++++++++++--------- .../src/Language/EO/Phi/Normalize.hs | 1 + .../src/Language/EO/Phi/Rules/Common.hs | 21 +++++++++----- .../src/Language/EO/Phi/Rules/Fast.hs | 2 ++ .../src/Language/EO/Phi/Rules/Yaml.hs | 9 +++++- .../src/Language/EO/Phi/Syntax.hs | 1 + .../src/Language/EO/Phi/ToLaTeX.hs | 1 + .../test/eo/phi/dataization.yaml | 4 +-- 9 files changed, 47 insertions(+), 26 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 8d77f7106..09c59ccc0 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -556,9 +556,10 @@ wrapRawBytesIn = \case ] ObjectDispatch obj a -> ObjectDispatch (wrapRawBytesIn obj) a - GlobalObject -> GlobalObject - ThisObject -> ThisObject Termination -> wrapTermination + obj@GlobalObject -> obj + obj@GlobalObjectPhiOrg -> obj + obj@ThisObject -> obj obj@MetaSubstThis{} -> obj obj@MetaContextualize{} -> obj obj@MetaObject{} -> obj diff --git a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf index 7e5736f4d..4519cde65 100644 --- a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf +++ b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf @@ -48,20 +48,21 @@ MetaIdBindings. MetaId ::= BindingsMetaId ; MetaIdObject. MetaId ::= ObjectMetaId ; MetaIdBytes. MetaId ::= BytesMetaId ; -Formation. Object ::= "⟦" [Binding] "⟧" ; -Application. Object ::= Object "(" [Binding] ")" ; -ObjectDispatch. Object ::= Object "." Attribute ; -GlobalObject. Object ::= "Φ"; -ThisObject. Object ::= "ξ"; -Termination. Object ::= "⊥" ; -ConstString. Object ::= String ; -ConstInt. Object ::= Integer ; -ConstFloat. Object ::= Double ; -MetaSubstThis. Object ::= Object "[" "ξ" "↦" Object "]" ; -MetaContextualize. Object ::= "⌈" Object "," Object "⌉" ; -MetaObject. Object ::= ObjectMetaId ; -MetaTailContext. Object ::= Object "*" TailMetaId ; -MetaFunction. Object ::= MetaFunctionName "(" Object ")" ; +Formation. Object ::= "⟦" [Binding] "⟧" ; +Application. Object ::= Object "(" [Binding] ")" ; +ObjectDispatch. Object ::= Object "." Attribute ; +GlobalObject. Object ::= "Φ"; +GlobalObjectPhiOrg. Object ::= "Φ̇"; +ThisObject. Object ::= "ξ"; +Termination. Object ::= "⊥" ; +ConstString. Object ::= String ; +ConstInt. Object ::= Integer ; +ConstFloat. Object ::= Double ; +MetaSubstThis. Object ::= Object "[" "ξ" "↦" Object "]" ; +MetaContextualize. Object ::= "⌈" Object "," Object "⌉" ; +MetaObject. Object ::= ObjectMetaId ; +MetaTailContext. Object ::= Object "*" TailMetaId ; +MetaFunction. Object ::= MetaFunctionName "(" Object ")" ; AlphaBinding. Binding ::= Attribute "↦" Object ; EmptyBinding. Binding ::= Attribute "↦" "∅" ; diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs index 021129206..7e613416c 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs @@ -71,6 +71,7 @@ peelObject = \case Application object bindings -> peelObject object `followedBy` ActionApplication bindings ObjectDispatch object attr -> peelObject object `followedBy` ActionDispatch attr GlobalObject -> PeeledObject HeadGlobal [] + obj@GlobalObjectPhiOrg -> peelObject (desugar obj) ThisObject -> PeeledObject HeadThis [] Termination -> PeeledObject HeadTermination [] MetaObject _ -> PeeledObject HeadTermination [] diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs index a85dbac47..bdfba2208 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs @@ -118,6 +118,7 @@ withSubObject f ctx root = ] ObjectDispatch obj a -> propagateName2 ObjectDispatch <$> withSubObject f subctx obj <*> pure a GlobalObject{} -> [] + GlobalObjectPhiOrg{} -> [] ThisObject{} -> [] Termination -> [] MetaObject _ -> [] @@ -188,13 +189,19 @@ objectSize = \case Application obj bindings -> 1 + objectSize obj + sum (map bindingSize bindings) ObjectDispatch obj _attr -> 1 + objectSize obj GlobalObject -> 1 + -- TODO #617:30m + -- @fizruk, why desugar here and not assume the object is desugared? + -- Is it because we sometimes bounce between sugared and desugared versions? + -- + -- Should we introduce a smart constructor with a desugared object inside? + obj@GlobalObjectPhiOrg -> objectSize (desugar obj) ThisObject -> 1 Termination -> 1 - MetaObject{} -> 1 -- should be impossible - MetaFunction{} -> 1 -- should be impossible - MetaSubstThis{} -> 1 -- should be impossible - MetaContextualize{} -> 1 -- should be impossible - MetaTailContext{} -> 1 -- should be impossible + obj@MetaObject{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + obj@MetaFunction{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + obj@MetaSubstThis{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + obj@MetaContextualize{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + obj@MetaTailContext{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@ConstString{} -> objectSize (desugar obj) obj@ConstInt{} -> objectSize (desugar obj) obj@ConstFloat{} -> objectSize (desugar obj) @@ -206,8 +213,8 @@ bindingSize = \case DeltaBinding _bytes -> 1 DeltaEmptyBinding -> 1 LambdaBinding _lam -> 1 - MetaDeltaBinding{} -> 1 -- should be impossible - MetaBindings{} -> 1 -- should be impossible + obj@MetaDeltaBinding{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + obj@MetaBindings{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) -- | A variant of `applyRules` with a maximum application depth. applyRulesWith :: ApplicationLimits -> Context -> Object -> [Object] diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs index 8abae456c..48f39f4c8 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs @@ -205,6 +205,8 @@ fastYegorInsideOut ctx = \case AlphaBinding a (fastYegorInsideOut ctx' objA) _ -> binding ] + -- TODO #617:30m Should this be error? + obj@GlobalObjectPhiOrg -> fastYegorInsideOut ctx (desugar obj) Termination -> Termination MetaSubstThis{} -> error "impossible MetaSubstThis!" MetaContextualize{} -> error "impossible MetaContextualize!" diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index f00e22ada..a3f9d539c 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -228,6 +228,7 @@ usedLabelIds Context{..} = objectLabelIds globalObject objectLabelIds :: Object -> Set LabelId objectLabelIds = \case GlobalObject -> mempty + obj@GlobalObjectPhiOrg -> objectLabelIds (desugar obj) ThisObject -> mempty Formation bindings -> foldMap bindingLabelIds bindings ObjectDispatch obj a -> objectLabelIds obj <> attrLabelIds a @@ -278,6 +279,7 @@ objectMetaIds (Formation bindings) = foldMap bindingMetaIds bindings objectMetaIds (Application object bindings) = objectMetaIds object <> foldMap bindingMetaIds bindings objectMetaIds (ObjectDispatch object attr) = objectMetaIds object <> attrMetaIds attr objectMetaIds GlobalObject = mempty +objectMetaIds GlobalObjectPhiOrg = mempty objectMetaIds ThisObject = mempty objectMetaIds Termination = mempty objectMetaIds (MetaObject x) = Set.singleton (MetaIdObject x) @@ -310,6 +312,7 @@ objectHasMetavars (Formation bindings) = any bindingHasMetavars bindings objectHasMetavars (Application object bindings) = objectHasMetavars object || any bindingHasMetavars bindings objectHasMetavars (ObjectDispatch object attr) = objectHasMetavars object || attrHasMetavars attr objectHasMetavars GlobalObject = False +objectHasMetavars GlobalObjectPhiOrg = False objectHasMetavars ThisObject = False objectHasMetavars Termination = False objectHasMetavars (MetaObject _) = True @@ -436,6 +439,7 @@ applySubst subst@Subst{..} = \case ObjectDispatch obj a -> ObjectDispatch (applySubst subst obj) (applySubstAttr subst a) GlobalObject -> GlobalObject + obj@GlobalObjectPhiOrg -> applySubst subst (desugar obj) ThisObject -> ThisObject obj@(MetaObject x) -> fromMaybe obj $ lookup x objectMetas Termination -> Termination @@ -522,7 +526,8 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart ConstString{} -> [] ConstInt{} -> [] ConstFloat{} -> [] - -- should cases below be errors? + -- TODO #617:30m Should cases below be errors? + GlobalObjectPhiOrg -> [] MetaSubstThis{} -> [] MetaContextualize{} -> [] MetaObject{} -> [] @@ -629,6 +634,7 @@ substThis thisObj = go Application obj bindings -> Application (go obj) (map (substThisBinding thisObj) bindings) ObjectDispatch obj a -> ObjectDispatch (go obj) a GlobalObject -> GlobalObject + obj@GlobalObjectPhiOrg -> go (desugar obj) Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) @@ -662,6 +668,7 @@ contextualize thisObj = go ObjectDispatch obj a -> ObjectDispatch (go obj) a Application obj bindings -> Application (go obj) (map (contextualizeBinding thisObj) bindings) GlobalObject -> GlobalObject -- TODO: Change to what GlobalObject is attached to + obj@GlobalObjectPhiOrg -> go (desugar obj) -- TODO: Change to what GlobalObject is attached to Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to contextualize " <> printTree obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 69b690251..11f3550ad 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -108,6 +108,7 @@ desugar = \case Application obj bindings -> Application (desugar obj) (map desugarBinding bindings) ObjectDispatch obj a -> ObjectDispatch (desugar obj) a GlobalObject -> GlobalObject + GlobalObjectPhiOrg -> ObjectDispatch (ObjectDispatch GlobalObject (Label (LabelId "org"))) (Label (LabelId "eolang")) ThisObject -> ThisObject Termination -> Termination MetaSubstThis obj this -> MetaSubstThis (desugar obj) (desugar this) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index 241b64b07..869204e9c 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -76,6 +76,7 @@ instance ToLatex Object where toLatex (ObjectDispatch obj attr) = toLatex obj <> "." <> toLatex attr toLatex GlobalObject = "Q" + toLatex GlobalObjectPhiOrg = "QQ" toLatex ThisObject = "\\xi" toLatex Termination = "\\dead" toLatex (MetaObject (ObjectMetaId metaId)) = LaTeX metaId diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index 3ca516121..5ba2d08e6 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -29,7 +29,7 @@ tests: input: | {⟦ c ↦ Φ.org.eolang.number( - as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ 40-39-00-00-00-00-00-00) + as-bytes ↦ Φ̇.bytes(Δ ⤍ 40-39-00-00-00-00-00-00) ), // 25.0 φ ↦ ξ.c.times(x ↦ ⟦ Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD ⟧) // 1.8 .plus(x ↦ ⟦ Δ ⤍ 40-40-00-00-00-00-00-00 ⟧), // 32.0 @@ -43,7 +43,7 @@ tests: - ./data/0.41.2/org/eolang/true.phi - ./data/0.41.2/org/eolang/false.phi input: | - {⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ.org.eolang.true) ⟧} + {⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ̇.true) ⟧} output: bytes: "01-" From 13ee05ce3c174616ba064e3096a8390c31f1f43b Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Mon, 16 Dec 2024 21:49:45 +0300 Subject: [PATCH 08/69] fix(eo-phi-normalizer): remove yegor.yaml and use new.yaml --- eo-phi-normalizer/app/Main.hs | 6 +- .../src/Language/EO/Phi/Rules/RunYegor.hs | 2 +- .../test/Language/EO/Phi/DataizeSpec.hs | 2 +- .../test/Language/EO/Rules/PhiPaperSpec.hs | 3 +- .../test/Language/EO/YamlSpec.hs | 3 +- .../test/eo/phi/rules/yegor.yaml | 288 ------------------ scripts/lib.sh | 2 +- site/docs/src/eo-phi-normalizer/dataize.md | 10 +- .../docs/src/eo-phi-normalizer/print-rules.md | 2 +- site/docs/src/eo-phi-normalizer/rewrite.md | 16 +- site/docs/src/eo-phi-normalizer/test.md | 4 +- site/docs/src/quick-start.md | 2 +- site/docs/src/user-defined-rules.md | 4 +- 13 files changed, 28 insertions(+), 316 deletions(-) delete mode 100644 eo-phi-normalizer/test/eo/phi/rules/yegor.yaml diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 09c59ccc0..305d34e05 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -275,6 +275,8 @@ data CommandParser = CommandParser , test :: Parser CLI'Test } +rulesFile = "new.yaml" + commandParser :: CommandParser commandParser = CommandParser{..} @@ -285,7 +287,7 @@ commandParser = bindingsPath <- bindingsPathOption pure CLI'MetricsPhi{..} printRules = do - rulesPath <- optional $ strOption (long "rules" <> short 'r' <> metavar.file <> help [fmt|{metavarName.file} with user-defined rules. If unspecified, yegor.yaml is rendered.|]) + rulesPath <- optional $ strOption (long "rules" <> short 'r' <> metavar.file <> help [fmt|{metavarName.file} with user-defined rules. If unspecified, {rulesFile} is rendered.|]) latex <- latexSwitch compact <- compactSwitch pure CLI'PrintRules{..} @@ -601,7 +603,7 @@ main = withCorrectLocale do -- Temporary hack while rules are not stabilized. -- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule]) Nothing -> do - ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml") + ruleSet :: RuleSet <- decodeThrow $(embedFileRelative [fmt|test/eo/phi/rules/{rulesFile}|]) return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) unless (single || json || latex) $ logStrLn ruleSetTitle bindingsWithDeps <- case deepMergePrograms (program' : deps) of diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs index a057f9819..ffe95167a 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs @@ -37,7 +37,7 @@ yegorRuleSet :: Yaml.RuleSet {-# NOINLINE yegorRuleSet #-} yegorRuleSet = unsafePerformIO $ - Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/yegor.yaml" + Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/new.yaml" yegorRules :: [NamedRule] yegorRules = map Yaml.convertRuleNamed (Yaml.rules yegorRuleSet) diff --git a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs index f55cc633e..594443964 100644 --- a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs @@ -62,7 +62,7 @@ getProgram inputFile = do spec :: Spec spec = do DataizeTestGroup{..} <- runIO (dataizationTests "test/eo/phi/dataization.yaml") - ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/yegor.yaml" + ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/new.yaml" let rules = map convertRuleNamed ruleset.rules describe title $ forM_ tests $ diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 0ba0891b9..1eb55293f 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -330,8 +330,7 @@ parseTests = Yaml.decodeFileThrow spec :: Spec spec = forM_ - [ ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml") - , ("New Yegor's rules", "test/eo/phi/rules/new.yaml") + [ ("New Yegor's rules", "test/eo/phi/rules/new.yaml") ] $ \(name, rulesFile) -> do ruleset <- runIO $ parseRuleSetFromFile rulesFile diff --git a/eo-phi-normalizer/test/Language/EO/YamlSpec.hs b/eo-phi-normalizer/test/Language/EO/YamlSpec.hs index 16134213e..e01713e15 100644 --- a/eo-phi-normalizer/test/Language/EO/YamlSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/YamlSpec.hs @@ -31,7 +31,6 @@ import Test.Hspec (Spec) spec :: Spec spec = Test.spec - [ "test/eo/phi/rules/yegor.yaml" - , "test/eo/phi/rules/new.yaml" + [ "test/eo/phi/rules/new.yaml" , "test/eo/phi/rules/streams.yaml" ] diff --git a/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml b/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml deleted file mode 100644 index e5d72e3d2..000000000 --- a/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml +++ /dev/null @@ -1,288 +0,0 @@ -# The MIT License (MIT) - -# Copyright (c) 2016-2024 Objectionary.com - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -title: "Rule set based on Yegor's draft" -rules: - - - name: Phi - description: 'Φ-dispatch' - context: - global_object: '!b' - pattern: | - Φ - result: | - !b - when: - - apply_in_subformations: false - tests: [] - - - name: xi - description: 'ξ-dispatch' - context: - current_object: '!b' - pattern: | - ξ - result: | - !b - when: - - apply_in_subformations: false - tests: - - name: Does not replace ξ inside a subformation - input: '⟦ a ↦ ⟦ ⟧, x ↦ ξ.a, ρ ↦ ⟦ ⟧ ⟧' - output: [] - # How to test replacing without already having context? - - - name: DOT - description: 'Accessing an α-binding' - pattern: | - ⟦ !τ ↦ !b, !B ⟧.!τ - result: | - !b[ ξ ↦ ⟦ !τ ↦ !b, !B ⟧ ] - when: - - apply_in_abstract_subformations: false - - nf_inside_formation: '!b' - - nf: '⟦ !B ⟧' - - not_equal: ['!τ', 'ρ'] - tests: - - name: Should match - input: ⟦ hello ↦ ⟦⟧ ⟧.hello - output: ['⟦ ρ ↦ ⟦ hello ↦ ⟦⟧ ⟧ ⟧'] - - name: Shouldn't match - input: ⟦ ⟧.hello - output: [] - - name: Shouldn't match - input: ⟦ ρ ↦ ⟦⟧ ⟧.ρ - output: [] - - name: Should apply in subformations - input: ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ⟦⟧ ⟧ ⟧.b ⟧ - output: ['⟦ a ↦ ⟦ c ↦ ⟦⟧, ρ ↦ ⟦ b ↦ ⟦ c ↦ ⟦⟧ ⟧ ⟧ ⟧ ⟧'] - - name: Should respect surrounding context - input: ⟦ hello ↦ ⟦⟧, goodbye ↦ ⟦ a ↦ ⟦⟧ ⟧ ⟧.hello - output: ['⟦ ρ ↦ ⟦ hello ↦ ⟦⟧, goodbye ↦ ⟦ a ↦ ⟦⟧ ⟧ ⟧ ⟧'] - - - name: DOTrho - description: 'Accessing ρ-binding' - pattern: | - ⟦ ρ ↦ !b, !B ⟧.ρ - result: | - !b - when: - - nf: '⟦ !B ⟧' - tests: - - name: Should match - input: ⟦ ρ ↦ ⟦ ⟧ ⟧.ρ - output: ['⟦ ⟧'] - - - name: phi - description: 'Accessing a decorated object' - pattern: | - ⟦!B ⟧.!τ - result: | - ⟦!B ⟧.φ.!τ - when: - - present_attrs: - attrs: ['φ'] - bindings: ['!B'] - - absent_attrs: - attrs: ['!τ'] - bindings: ['!B'] - tests: - - name: 'Attribute does not exist' - input: '⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.b' - output: ['⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.φ.b'] - - name: 'Attribute exists' - input: '⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.a' - output: [] - - name: 'Both attributes do not exist' - input: '⟦ b ↦ ⟦⟧ ⟧.a' - output: [] - - - name: COPY - description: 'Application of α-binding' - context: - current_object: "!b2" - pattern: | - ⟦ !τ ↦ ∅, !B1 ⟧(!τ ↦ !b1, !B2) - result: | - ⟦ !τ ↦ !b1[ ξ ↦ !b2 ], !B1 ⟧(!B2) - when: - - apply_in_subformations: false - - nf: '!b1' - tests: - - name: Should match - input: ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) - output: ['⟦ a ↦ ⟦ ρ ↦ ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) ⟧ ⟧()'] - - name: Should not match in subformations - input: ⟦ a ↦ ⟦b ↦ ∅⟧(b ↦ ⟦⟧) ⟧ - output: [] - - - name: COPY1 - description: 'Application of α-binding' - # Warning: this is not correct for the chain variant because it only matches the first binding - # i.e., doesn't match an empty binding after an attached one. - # We should instead match the first empty binding. - context: - current_object: "!b2" - pattern: | - ⟦ !τ ↦ ∅, !B ⟧(α0 ↦ !b1) - result: | - ⟦ !τ ↦ !b1[ ξ ↦ !b2 ], !B ⟧ - when: - - apply_in_subformations: false - - nf: '!b1' - tests: - - name: Should match first void attribute - input: ⟦ hello ↦ ⟦⟧, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧) - output: ['⟦ bye ↦ ⟦ ρ ↦ ⟦ hello ↦ ⟦⟧, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧) ⟧, hello ↦ ⟦⟧, hey ↦ ∅ ⟧'] - options: - - take_one: true - - - name: COPY2 - description: 'Application of α-binding' - # Warning: this is not correct for the chain variant because it only matches the first two bindings - # i.e., doesn't match an empty binding after an attached one. - # We should instead match the first two empty bindings. - context: - current_object: "!b3" - pattern: | - ⟦ !τ1 ↦ ∅, !τ2 ↦ ∅, !B ⟧(α0 ↦ !b1, α1 ↦ !b2) - result: | - ⟦ !τ1 ↦ !b1[ ξ ↦ !b3 ], !τ2 ↦ !b2[ ξ ↦ !b3 ], !B ⟧ - when: - - apply_in_subformations: false - - nf: '!b1' - - nf: '!b2' - tests: - - name: Should match positional arguments - input: ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) - output: ['⟦ hello ↦ ⟦ ρ ↦ ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) ⟧, bye ↦ ⟦ a ↦ ⟦⟧, ρ ↦ ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) ⟧, hey ↦ ∅ ⟧'] - options: - - take_one: true - - - name: COPYdelta - description: 'Application of Δ-binding' - pattern: | - ⟦ Δ ⤍ ∅, !B ⟧(Δ ⤍ !y) - result: | - ⟦ Δ ⤍ !y, !B ⟧ - when: - - apply_in_abstract_subformations: false - tests: [] - - - name: EMPTY - description: 'Empty application' - pattern: | - ⟦ !B1 ⟧() - result: | - ⟦ !B1 ⟧ - when: [] - tests: - - name: Should match - input: ⟦ a ↦ ⟦⟧ ⟧() - output: ['⟦ a ↦ ⟦⟧ ⟧'] - - name: Should not match - input: ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) - output: [] - - name: Should match in subformation - input: ⟦ a ↦ ⟦ b ↦ ⟦⟧() ⟧ ⟧ - output: ['⟦ a ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧'] - - name: Should work with empty formation - input: ⟦⟧() - output: ['⟦⟧'] - - - name: OVER - description: 'Invalid application (attribute already attached)' - pattern: ⟦ !τ ↦ !b1, !B1 ⟧(!τ ↦ !b2, !B2) - result: ⊥ - when: [] - tests: - - name: '' - input: '⟦ t ↦ ⟦ a ↦ ∅ ⟧ ⟧(t ↦ ⟦ b ↦ ∅ ⟧)' - output: ['⊥'] - - - name: STOP - description: 'Invalid attribute access' - pattern: | - ⟦ !B ⟧.!τ - result: | - ⊥ - when: - - absent_attrs: - attrs: ['!τ', 'φ', 'λ'] - bindings: ['!B'] - - present_attrs: - attrs: ['ρ'] - bindings: ['!B'] - - nf: '⟦ !B ⟧' - tests: - - name: 'Accessing nonexistent attribute' - input: '⟦ ρ ↦ ⟦ ⟧ ⟧.x' - output: ['⊥'] - - - name: MISS - description: 'Invalid application (absent attribute)' - pattern: ⟦ !B1 ⟧(!τ ↦ !b, !B2) - result: ⊥ - when: - - absent_attrs: - attrs: ['!τ', 'φ', 'λ'] - bindings: ['!B1'] - tests: - - name: '' - input: '⟦ t1 ↦ ⟦ a ↦ ∅ ⟧ ⟧(t ↦ ⟦ b ↦ ∅ ⟧)' - output: ['⊥'] - - name: Should not match if attr is present - input: ⟦ t ↦ ⟦⟧ ⟧(t ↦ ⟦ a ↦ ∅ ⟧) - output: [] - - name: Should not match if phi is present - input: ⟦ φ ↦ ⟦⟧, a ↦ ⟦⟧ ⟧(t ↦ ⟦ a ↦ ∅ ⟧) - output: [] - - name: Should apply in subformations - input: ⟦ a ↦ ⟦ b ↦ ⟦⟧(t ↦ ⟦⟧) ⟧ ⟧ - output: ['⟦ a ↦ ⟦ b ↦ ⊥ ⟧ ⟧'] - - - name: DD - description: 'Accessing an attribute on bottom' - pattern: | - ⊥.!τ - result: | - ⊥ - when: [] - tests: - - name: 'Dispatch on bottom is bottom' - input: '⊥.a' - output: ['⊥'] - - name: 'Dispatch on anything else is not touched' - input: '⟦ ⟧.a' - output: [] - - - name: DC - description: 'Application on bottom is bottom' - pattern: | - ⊥(!B) - result: | - ⊥ - when: [] - tests: - - name: Should apply in subformations - input: ⟦ a ↦ ⟦ b ↦ ⊥(t ↦ ⟦⟧, u ↦ ⟦⟧) ⟧ ⟧ - output: ['⟦ a ↦ ⟦ b ↦ ⊥ ⟧ ⟧'] diff --git a/scripts/lib.sh b/scripts/lib.sh index 0531ef2f8..ef5ee460c 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -37,7 +37,7 @@ PIPELINE_EO_PHI_NORMALIZER_DATA_DIR="$PIPELINE_EO_PHI_NORMALIZER_DIR/data" PIPELINE_REPORT_DIR="$PWD/report" PIPELINE_EO_YAML_DIR="$PIPELINE_DIR/eo-yaml" -PIPELINE_EO_PHI_NORMALIZER_RULES="" # "--rules '$PIPELINE_EO_PHI_NORMALIZER_DIR/test/eo/phi/rules/yegor.yaml'" +PIPELINE_EO_PHI_NORMALIZER_RULES="" # "--rules '$PIPELINE_EO_PHI_NORMALIZER_DIR/test/eo/phi/rules/new.yaml'" SCRIPTS_DIR="$PWD_DIR/scripts" PIPELINE_SCRIPT="$SCRIPTS_DIR/pipeline.sh" diff --git a/site/docs/src/eo-phi-normalizer/dataize.md b/site/docs/src/eo-phi-normalizer/dataize.md index 49496fbf7..e083c42e4 100644 --- a/site/docs/src/eo-phi-normalizer/dataize.md +++ b/site/docs/src/eo-phi-normalizer/dataize.md @@ -76,7 +76,7 @@ Similar to `--rules` for the `transform` subcommand, this argument accepts the p If the `--chain` argument is passed, all the intermediate steps of normalization + dataization are printed to the console (or the output file if chosen). ```$ as console -eo-phi-normalizer dataize --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer dataize --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -1299,7 +1299,7 @@ Can be used multiple times to inject multiple dependencies. Applies the normalization+dataization process recursively until it reaches bytes or no longer modifies the object (stalls). ```$ as console -eo-phi-normalizer dataize --recursive --rules eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer dataize --recursive --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -1429,7 +1429,7 @@ Can be combined with `--chain` to print all the intermediate steps of both norma Enable an atom by name. ```$ as console -eo-phi-normalizer dataize --minimize-stuck-terms --recursive --enable-atom "Lorg_eolang_dataized" --rules eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer dataize --minimize-stuck-terms --recursive --enable-atom "Lorg_eolang_dataized" --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -1454,7 +1454,7 @@ eo-phi-normalizer dataize --minimize-stuck-terms --recursive --enable-atom "Lorg Disable an atom by name. ```$ as console -eo-phi-normalizer dataize --minimize-stuck-terms --recursive --disable-atom "Lorg_eolang_dataized" --rules eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer dataize --minimize-stuck-terms --recursive --disable-atom "Lorg_eolang_dataized" --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -1479,7 +1479,7 @@ eo-phi-normalizer dataize --minimize-stuck-terms --recursive --disable-atom "Lor If no argument is given for the input file, `stdin` is consumed until `EOF`. ```$ as console -cat celsius.phi | eo-phi-normalizer dataize --recursive --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml +cat celsius.phi | eo-phi-normalizer dataize --recursive --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml ``` ```console diff --git a/site/docs/src/eo-phi-normalizer/print-rules.md b/site/docs/src/eo-phi-normalizer/print-rules.md index c4ee4d1be..643a3afed 100644 --- a/site/docs/src/eo-phi-normalizer/print-rules.md +++ b/site/docs/src/eo-phi-normalizer/print-rules.md @@ -23,7 +23,7 @@ Available options: ### Default version -The command below prints to the console rules from `yegor.yaml`, listing each condition of the rules on a separate line. +The command below prints to the console rules from [new.yaml](https://github.com/objectionary/eo-phi-normalizer/blob/master/eo-phi-normalizer/test/eo/phi/rules/new.yaml), listing each condition of the rules on a separate line. ![rules-latex](../media/print-rules-tex.png) diff --git a/site/docs/src/eo-phi-normalizer/rewrite.md b/site/docs/src/eo-phi-normalizer/rewrite.md index a6292ae1e..9e39ed31e 100644 --- a/site/docs/src/eo-phi-normalizer/rewrite.md +++ b/site/docs/src/eo-phi-normalizer/rewrite.md @@ -53,13 +53,13 @@ Available options: ### `--rules FILE` -Normalize a 𝜑-expression from `celsius.phi` using the rules from a given file (e.g. [yegor.yaml](#yegoryaml)). +Normalize a 𝜑-expression from `celsius.phi` using the rules from a given file. The output may contain multiple numbered results that correspond to different possible rule application sequences (even if the final result is the same). ```$ as console -eo-phi-normalizer rewrite --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -103,7 +103,7 @@ Result 1 out of 1: Use `--chain` to see numbered normalization steps for each normalization result. ```$ as console -eo-phi-normalizer rewrite --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -190,7 +190,7 @@ This is the 2nd possible chain of normalizing rewritings: ### `--json` ```$ as json -eo-phi-normalizer rewrite --json --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --json --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```json @@ -210,7 +210,7 @@ eo-phi-normalizer rewrite --json --chain --rules ./eo-phi-normalizer/test/eo/phi ### `--single` ```$ as console -eo-phi-normalizer rewrite --single --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --single --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -233,7 +233,7 @@ eo-phi-normalizer rewrite --single --rules ./eo-phi-normalizer/test/eo/phi/rules ### `--single --single-line` ```$ as console -eo-phi-normalizer rewrite --single --single-line --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --single --single-line --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -243,7 +243,7 @@ eo-phi-normalizer rewrite --single --single-line --rules ./eo-phi-normalizer/tes ### `--single` `--json` ```$ as console -eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml celsius.phi +eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml celsius.phi ``` ```console @@ -282,7 +282,7 @@ Can be used multiple times to inject multiple dependencies. ### `FILE` not specified (read from stdin) ```$ as console -cat celsius.phi | eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml +cat celsius.phi | eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml ``` ```console diff --git a/site/docs/src/eo-phi-normalizer/test.md b/site/docs/src/eo-phi-normalizer/test.md index 161c83a5c..7118adf1e 100644 --- a/site/docs/src/eo-phi-normalizer/test.md +++ b/site/docs/src/eo-phi-normalizer/test.md @@ -21,7 +21,7 @@ Available options: ### Run tests in a file ```console -eo-phi-normalizer test --rules eo-phi-normalizer/test/eo/phi/rules/yegor.yaml +eo-phi-normalizer test --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml ``` +`$ eo-phi-normalizer test --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml | sed -e 's/\(Finished in\) \([0-9]\.[0-9]\+\)/\1 0.0062/'` as console --> ```console User-defined rules unit tests diff --git a/site/docs/src/quick-start.md b/site/docs/src/quick-start.md index bb18f72f8..2b9f069b9 100644 --- a/site/docs/src/quick-start.md +++ b/site/docs/src/quick-start.md @@ -11,7 +11,7 @@ Dataize the program recursively. ```$ as console eo-phi-normalizer dataize \ --recursive \ - --rules eo-phi-normalizer/test/eo/phi/rules/yegor.yaml \ + --rules eo-phi-normalizer/test/eo/phi/rules/new.yaml \ --dependency-file 'eo-phi-normalizer/data/0.38.0/org/eolang/float.phi' \ --dependency-file 'eo-phi-normalizer/data/0.38.0/org/eolang/bytes.phi' \ celsius.phi diff --git a/site/docs/src/user-defined-rules.md b/site/docs/src/user-defined-rules.md index a79f18294..085f5a2cd 100644 --- a/site/docs/src/user-defined-rules.md +++ b/site/docs/src/user-defined-rules.md @@ -12,9 +12,9 @@ Currently, the `eo-phi-normalizer` supports rules defined in an unpublished pape ![Rules](media/rules.jpg) -## yegor.yaml +## new.yaml -The rules are defined in [yegor.yaml](https://github.com/objectionary/eo-phi-normalizer/blob/master/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml). +The rules are defined in [new.yaml](https://github.com/objectionary/eo-phi-normalizer/blob/master/eo-phi-normalizer/test/eo/phi/rules/new.yaml). Each rule has the following structure: From 6026f59f587f848affbbd1c3e3837f644d93dd73 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Mon, 16 Dec 2024 21:56:27 +0300 Subject: [PATCH 09/69] feat(eo-phi-normalizer): add TODOs --- .../test/eo/phi/dataization.yaml | 31 ++++++++++--------- eo-phi-normalizer/test/eo/phi/rules/new.yaml | 6 ++-- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index 5ba2d08e6..d411c41fd 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -167,7 +167,7 @@ tests: object: | ⟦ a ↦ ⟦ Δ ⤍ 01- ⟧, b ↦ ⟦ Δ ⤍ 01- ⟧, c ↦ ⟦ Δ ⤍ 01- ⟧, d ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference (1)" # dependencies: [] # input: | @@ -176,7 +176,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference (2)" # dependencies: [] # input: | @@ -185,7 +185,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (1)" # dependencies: [] # input: | @@ -194,7 +194,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (1)" # dependencies: [] # input: | @@ -203,7 +203,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (2)" # dependencies: [] # input: | @@ -212,7 +212,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (3)" # dependencies: [] # input: | @@ -221,7 +221,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "interleaving ρ and other dispatches" # dependencies: [] # input: | @@ -309,7 +309,7 @@ tests: output: bytes: "00-" - # Missing int tests: div + # TODO #636:30min Missing int tests: div - name: "bitwise and" dependencies: @@ -373,7 +373,7 @@ tests: output: bytes: "01-" - # Missing bytes tests: or, xor, slice, concat + # TODO #636:30min Missing bytes tests: or, xor, slice, concat - name: "float times and plus (raw bytes)" dependencies: @@ -413,7 +413,7 @@ tests: output: object: "69.42" - # Missing float tests: gt, div + # TODO #636:30min Missing float tests: gt, div - name: "string slice (raw bytes)" dependencies: @@ -478,7 +478,10 @@ tests: output: object: "11" # == 11 - # Missing malloc tests: (all) - # Missing cage tests: (all) - # Missing io tests: (all) - # Other missing tests: dataized, error, seq, as_phi, rust, try + # TODO #636:30min Missing malloc tests: (all) + + # TODO #636:30min Missing cage tests: (all) + + # TODO #636:30min Missing io tests: (all) + + # TODO #636:30min Other missing tests: dataized, error, seq, as_phi, rust, try diff --git a/eo-phi-normalizer/test/eo/phi/rules/new.yaml b/eo-phi-normalizer/test/eo/phi/rules/new.yaml index 562f5d2f3..083acdd7c 100644 --- a/eo-phi-normalizer/test/eo/phi/rules/new.yaml +++ b/eo-phi-normalizer/test/eo/phi/rules/new.yaml @@ -31,7 +31,8 @@ rules: ⌈ !b , ⟦ !τ ↦ !b, !B ⟧ ⌉(ρ ↦ ⟦ !τ ↦ !b, !B ⟧) when: - nf: '!b' - - nf: '⟦ !B ⟧' #TODO: change the condition, every object in !B should be in the nf + # TODO #636:30min Change the condition, every object in !B should be in the nf + - nf: '⟦ !B ⟧' tests: - name: 'Contextualization changes ξ' input: ⟦ a ↦ ξ ⟧.a @@ -80,7 +81,6 @@ rules: output: ['⟦ a ↦ ⟦ b ↦ ⟦ a ↦ ⟦ b ↦ ∅ ⟧ (b ↦ ξ) ⟧ ⟧ ().a ⟧'] - name: Phi Paper - Example E1 input: ⟦ k ↦ ⟦ x ↦ ξ.t, t ↦ ∅ ⟧(t ↦ ⟦ρ ↦ ⟦⟧⟧) ⟧ - # output: ['⟦ k ↦ ⟦ x ↦ ξ.t, t ↦ ⟦ρ ↦ ⟦⟧⟧ ⟧() ⟧'] output: ['⟦ k ↦ ⟦ t ↦ ⟦ρ ↦ ⟦⟧⟧, x ↦ ξ.t ⟧() ⟧'] - name: Phi Paper - Example E4 - dispatch on y input: ⟦ k ↦ ⟦ x ↦ ∅, y ↦ ξ.x ⟧(x ↦ ⟦ρ ↦ ⟦⟧⟧).y ⟧ @@ -124,7 +124,7 @@ rules: input: ⟦ m ↦ ⟦ x ↦ ξ.t, φ ↦ ⟦ t ↦ ⟦⟧ ⟧ ⟧.t(ρ ↦ ⟦ x ↦ ξ.t, φ ↦ ⟦ t ↦ ⟦⟧ ⟧ ⟧) ⟧ output: ['⟦ m ↦ ⟦ x ↦ ξ.t, φ ↦ ⟦ t ↦ ⟦⟧ ⟧ ⟧.φ.t(ρ ↦ ⟦ x ↦ ξ.t, φ ↦ ⟦ t ↦ ⟦⟧ ⟧ ⟧) ⟧'] - # there's no B2 in the result + # TODO #636:30min There's no B2 in the result - name: STAY description: 'Application of a ρ-binding when ρ already exists' pattern: | From 2f7336d26a4709939c6bd3db399d8301527f8229 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 18 Dec 2024 16:06:32 +0300 Subject: [PATCH 10/69] fix(eo-phi-nomralizer): embedding the file with rules --- eo-phi-normalizer/app/Main.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 305d34e05..a7cecd57f 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -79,7 +79,7 @@ import Language.EO.Phi.Pipeline.Dataize.PrintConfigs as PrintConfigs import Language.EO.Phi.Pipeline.EOTests.PrepareTests as PrepareTests import Language.EO.Phi.Report.Data (makeProgramReport, makeReport) import Language.EO.Phi.Report.Html (reportCSS, reportJS, toStringReport) -import Language.EO.Phi.Rules.Common +import Language.EO.Phi.Rules.Common (ApplicationLimits (ApplicationLimits), Context (..), LogEntry (..), applyRulesChainWith', applyRulesWith, objectSize) import Language.EO.Phi.Rules.Fast (fastYegorInsideOut, fastYegorInsideOutAsRule) import Language.EO.Phi.Rules.RunYegor (yegorRuleSet) import Language.EO.Phi.Rules.Yaml (RuleSet (rules, title), convertRuleNamed, parseRuleSetFromFile) @@ -275,6 +275,7 @@ data CommandParser = CommandParser , test :: Parser CLI'Test } +rulesFile :: String rulesFile = "new.yaml" commandParser :: CommandParser @@ -603,7 +604,7 @@ main = withCorrectLocale do -- Temporary hack while rules are not stabilized. -- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule]) Nothing -> do - ruleSet :: RuleSet <- decodeThrow $(embedFileRelative [fmt|test/eo/phi/rules/{rulesFile}|]) + ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml") return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) unless (single || json || latex) $ logStrLn ruleSetTitle bindingsWithDeps <- case deepMergePrograms (program' : deps) of From 59e1cda74b8e09cbcd3a48039bdcea0bbad686f5 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 18 Dec 2024 16:08:03 +0300 Subject: [PATCH 11/69] fix(eo-phi-normalizer): remove old rules file from .cabal --- eo-phi-normalizer/eo-phi-normalizer.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index abd62532e..287e05540 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -191,7 +191,6 @@ extra-source-files: data/0.41.2/org/eolang/while.phi test/eo/phi/rules/new.yaml test/eo/phi/rules/streams.yaml - test/eo/phi/rules/yegor.yaml source-repository head type: git From 8ecfd2847952a09bf0d7551baf781fd711801efd Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 19 Dec 2024 17:57:22 +0300 Subject: [PATCH 12/69] fix(dartaization): use dependencies for EO 0.49.1 --- .../test/eo/phi/dataization.yaml | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index d411c41fd..f58dfe588 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -24,8 +24,8 @@ title: Dataization tests tests: - name: "Celsius example" dependencies: - - ./data/0.41.2/org/eolang/number.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/number.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ c ↦ Φ.org.eolang.number( @@ -39,9 +39,9 @@ tests: - name: "Equality of booleans (via equality of bytes)" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi - - ./data/0.41.2/org/eolang/true.phi - - ./data/0.41.2/org/eolang/false.phi + - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/true.phi + - ./data/0.49.1/org/eolang/false.phi input: | {⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ̇.true) ⟧} output: @@ -232,7 +232,7 @@ tests: - name: "Dataize in siblings of Package" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ org ↦ ⟦ @@ -275,8 +275,8 @@ tests: - name: "int times and plus" dependencies: - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -294,10 +294,10 @@ tests: - name: "int greater than" dependencies: - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi - - ./data/0.41.2/org/eolang/false.phi - - ./data/0.41.2/org/eolang/true.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/false.phi + - ./data/0.49.1/org/eolang/true.phi input: | {⟦ φ ↦ ⟦ @@ -313,7 +313,7 @@ tests: - name: "bitwise and" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -327,7 +327,7 @@ tests: - name: "bitwise not" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -340,8 +340,8 @@ tests: - name: "bytes size" dependencies: - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -354,10 +354,10 @@ tests: - name: "bytes shift and equal" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi - - ./data/0.41.2/org/eolang/true.phi - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/false.phi + - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/true.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/false.phi input: | {⟦ φ ↦ ⟦ @@ -377,8 +377,8 @@ tests: - name: "float times and plus (raw bytes)" dependencies: - - ./data/0.41.2/org/eolang/number.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/number.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -396,8 +396,8 @@ tests: - name: "float times and plus" dependencies: - - ./data/0.41.2/org/eolang/number.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/number.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -417,8 +417,8 @@ tests: - name: "string slice (raw bytes)" dependencies: - - ./data/0.41.2/org/eolang/string.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/string.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -433,9 +433,9 @@ tests: - name: "string slice" dependencies: - - ./data/0.41.2/org/eolang/string.phi - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/string.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -450,9 +450,9 @@ tests: - name: "string length (raw bytes)" dependencies: - - ./data/0.41.2/org/eolang/string.phi - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/string.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -465,9 +465,9 @@ tests: - name: "string length" dependencies: - - ./data/0.41.2/org/eolang/string.phi - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.1/org/eolang/string.phi + - ./data/0.49.1/org/eolang/i64.phi + - ./data/0.49.1/org/eolang/bytes.phi input: | {⟦ φ ↦ ⟦ @@ -479,7 +479,7 @@ tests: object: "11" # == 11 # TODO #636:30min Missing malloc tests: (all) - + # TODO #636:30min Missing cage tests: (all) # TODO #636:30min Missing io tests: (all) From fe71b93fbcaeddaa5fa32d6e7d1e5dc78be663cb Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 19 Dec 2024 19:31:01 +0300 Subject: [PATCH 13/69] feat(gitignore): ignore tmp --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9655aa2b6..dbc760e05 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ pipeline/* node_modules try-unphi +tmp From 4bddea98b3034919a8211b33f2503b8c58bc967b Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:21:32 +0300 Subject: [PATCH 14/69] fix(eo-phi-normalizer): extend syntax with sugar - signed integers - signed doubles - literals inside applications - attributes --- eo-phi-normalizer/grammar/EO/Phi/Syntax.cf | 12 +- .../src/Language/EO/Phi/Syntax/Abs.hs | 93 +- .../src/Language/EO/Phi/Syntax/Doc.txt | 26 +- .../src/Language/EO/Phi/Syntax/Lex.x | 39 +- .../src/Language/EO/Phi/Syntax/Par.info | 1928 +++++++++++++++++ .../src/Language/EO/Phi/Syntax/Par.y | 53 +- .../src/Language/EO/Phi/Syntax/Print.hs | 125 +- 7 files changed, 2134 insertions(+), 142 deletions(-) create mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info diff --git a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf index 4519cde65..80e4db791 100644 --- a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf +++ b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf @@ -39,6 +39,8 @@ token BindingsMetaId {"!B"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; token ObjectMetaId {"!b"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; token BytesMetaId {"!y"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; token MetaFunctionName {"@"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; +token IntegerSigned ('-'? digit+) ; +token DoubleSigned ('-'? digit+ '.' digit+ ('e' '-'? digit+)?) ; Program. Program ::= "{" "⟦" [Binding] "⟧" "}" ; @@ -56,15 +58,19 @@ GlobalObjectPhiOrg. Object ::= "Φ̇"; ThisObject. Object ::= "ξ"; Termination. Object ::= "⊥" ; ConstString. Object ::= String ; -ConstInt. Object ::= Integer ; -ConstFloat. Object ::= Double ; +ConstIntRaw. Object ::= IntegerSigned ; +ConstFloatRaw. Object ::= DoubleSigned ; MetaSubstThis. Object ::= Object "[" "ξ" "↦" Object "]" ; MetaContextualize. Object ::= "⌈" Object "," Object "⌉" ; MetaObject. Object ::= ObjectMetaId ; MetaTailContext. Object ::= Object "*" TailMetaId ; MetaFunction. Object ::= MetaFunctionName "(" Object ")" ; +internal ConstFloat. Object ::= Double; +internal ConstInt. Object ::= Integer; + AlphaBinding. Binding ::= Attribute "↦" Object ; +AlphaBindingSugar. Binding ::= Object ; EmptyBinding. Binding ::= Attribute "↦" "∅" ; DeltaBinding. Binding ::= "Δ" "⤍" Bytes ; DeltaEmptyBinding. Binding ::= "Δ" "⤍" "∅" ; @@ -78,6 +84,8 @@ Rho. Attribute ::= "ρ" ; -- parent object Label. Attribute ::= LabelId ; Alpha. Attribute ::= AlphaIndex ; MetaAttr. Attribute ::= LabelMetaId ; +AttrSugar. Attribute ::= "~" LabelId "(" [LabelId] ")"; +separator LabelId ","; -- Additional symbols used as attributes in the rules ObjectAttr. RuleAttribute ::= Attribute ; diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index 84c5e858b..f964669e9 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs @@ -30,65 +30,73 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} + -- File generated by the BNF Converter (bnfc 2.9.5). + {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -- | The abstract syntax of language Syntax. + module Language.EO.Phi.Syntax.Abs where -import Data.String qualified import Prelude (Double, Integer, String) -import Prelude qualified as C (Eq, Ord, Read, Show) +import qualified Prelude as C (Eq, Ord, Show, Read) +import qualified Data.String -import Data.Data qualified as C (Data, Typeable) -import GHC.Generics qualified as C (Generic) +import qualified Data.Data as C (Data, Typeable) +import qualified GHC.Generics as C (Generic) data Program = Program [Binding] deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data MetaId - = MetaIdLabel LabelMetaId - | MetaIdTail TailMetaId - | MetaIdBindings BindingsMetaId - | MetaIdObject ObjectMetaId - | MetaIdBytes BytesMetaId + = MetaIdLabel LabelMetaId + | MetaIdTail TailMetaId + | MetaIdBindings BindingsMetaId + | MetaIdObject ObjectMetaId + | MetaIdBytes BytesMetaId deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data Object - = Formation [Binding] - | Application Object [Binding] - | ObjectDispatch Object Attribute - | GlobalObject - | ThisObject - | Termination - | ConstString String - | ConstInt Integer - | ConstFloat Double - | MetaSubstThis Object Object - | MetaContextualize Object Object - | MetaObject ObjectMetaId - | MetaTailContext Object TailMetaId - | MetaFunction MetaFunctionName Object + = Formation [Binding] + | Application Object [Binding] + | ObjectDispatch Object Attribute + | GlobalObject + | GlobalObjectPhiOrg + | ThisObject + | Termination + | ConstString String + | ConstIntRaw IntegerSigned + | ConstFloatRaw DoubleSigned + | MetaSubstThis Object Object + | MetaContextualize Object Object + | MetaObject ObjectMetaId + | MetaTailContext Object TailMetaId + | MetaFunction MetaFunctionName Object + | ConstFloat Double + | ConstInt Integer deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data Binding - = AlphaBinding Attribute Object - | EmptyBinding Attribute - | DeltaBinding Bytes - | DeltaEmptyBinding - | LambdaBinding Function - | MetaBindings BindingsMetaId - | MetaDeltaBinding BytesMetaId + = AlphaBinding Attribute Object + | AlphaBindingSugar Object + | EmptyBinding Attribute + | DeltaBinding Bytes + | DeltaEmptyBinding + | LambdaBinding Function + | MetaBindings BindingsMetaId + | MetaDeltaBinding BytesMetaId deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data Attribute - = Phi - | Rho - | Label LabelId - | Alpha AlphaIndex - | MetaAttr LabelMetaId + = Phi + | Rho + | Label LabelId + | Alpha AlphaIndex + | MetaAttr LabelMetaId + | AttrSugar LabelId [LabelId] deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data RuleAttribute = ObjectAttr Attribute | DeltaAttr | LambdaAttr @@ -98,15 +106,11 @@ data PeeledObject = PeeledObject ObjectHead [ObjectAction] deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data ObjectHead - = HeadFormation [Binding] - | HeadGlobal - | HeadThis - | HeadTermination + = HeadFormation [Binding] | HeadGlobal | HeadThis | HeadTermination deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data ObjectAction - = ActionApplication [Binding] - | ActionDispatch Attribute + = ActionApplication [Binding] | ActionDispatch Attribute deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) newtype Bytes = Bytes String @@ -138,3 +142,10 @@ newtype BytesMetaId = BytesMetaId String newtype MetaFunctionName = MetaFunctionName String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) + +newtype DoubleSigned = DoubleSigned String + deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) + +newtype IntegerSigned = IntegerSigned String + deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) + diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt index 09f7ad2df..ab5f82c84 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt @@ -36,6 +36,8 @@ except ``"`` unless preceded by ``\``. + + Bytes literals are recognized by the regular expression `````{"--"} | ["0123456789ABCDEF"] ["0123456789ABCDEF"] '-' | ["0123456789ABCDEF"] ["0123456789ABCDEF"] ('-' ["0123456789ABCDEF"] ["0123456789ABCDEF"])+````` @@ -74,6 +76,12 @@ MetaFunctionName literals are recognized by the regular expression `````'@' (char - [" !'(),-.:;?[]{|}⟦⟧"])*````` +DoubleSigned literals are recognized by the regular expression +`````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` + +IntegerSigned literals are recognized by the regular expression +`````'-'? digit+````` + ===Reserved words and symbols=== The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions. @@ -84,10 +92,10 @@ The reserved words used in Syntax are the following: The symbols used in Syntax are the following: | { | ⟦ | ⟧ | } - | ( | ) | . | ⊥ - | [ | ↦ | ] | ⌈ - | , | ⌉ | * | ∅ - | ⤍ | | | + | ( | ) | . | Φ̇ + | ⊥ | [ | ↦ | ] + | ⌈ | , | ⌉ | * + | ∅ | ⤍ | ~ | ===Comments=== Single-line comments begin with //.Multiple-line comments are enclosed with /* and */. @@ -108,17 +116,19 @@ All other symbols are terminals. | | **|** | //Object// ``(`` //[Binding]// ``)`` | | **|** | //Object// ``.`` //Attribute// | | **|** | ``Φ`` + | | **|** | ``Φ̇`` | | **|** | ``ξ`` | | **|** | ``⊥`` | | **|** | //String// - | | **|** | //Integer// - | | **|** | //Double// + | | **|** | //IntegerSigned// + | | **|** | //DoubleSigned// | | **|** | //Object// ``[`` ``ξ`` ``↦`` //Object// ``]`` | | **|** | ``⌈`` //Object// ``,`` //Object// ``⌉`` | | **|** | //ObjectMetaId// | | **|** | //Object// ``*`` //TailMetaId// | | **|** | //MetaFunctionName// ``(`` //Object// ``)`` | //Binding// | -> | //Attribute// ``↦`` //Object// + | | **|** | //Object// | | **|** | //Attribute// ``↦`` ``∅`` | | **|** | ``Δ`` ``⤍`` //Bytes// | | **|** | ``Δ`` ``⤍`` ``∅`` @@ -133,6 +143,10 @@ All other symbols are terminals. | | **|** | //LabelId// | | **|** | //AlphaIndex// | | **|** | //LabelMetaId// + | | **|** | ``~`` //LabelId// ``(`` //[LabelId]// ``)`` + | //[LabelId]// | -> | **eps** + | | **|** | //LabelId// + | | **|** | //LabelId// ``,`` //[LabelId]// | //RuleAttribute// | -> | //Attribute// | | **|** | ``Δ`` | | **|** | ``λ`` diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x index 87153f894..c9111df46 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x @@ -28,7 +28,7 @@ $u = [. \n] -- universal: any character -- Symbols and non-identifier-like reserved words -@rsyms = \Φ | \ξ | \Δ | \λ | \φ | \ρ | \{ | \⟦ | \⟧ | \} | \( | \) | \. | \⊥ | \[ | \↦ | \] | \⌈ | \, | \⌉ | \* | \∅ | \⤍ +@rsyms = \Φ | \ξ | \Δ | \λ | \φ | \ρ | \{ | \⟦ | \⟧ | \} | \( | \) | \. | \Φ \̇ | \⊥ | \[ | \↦ | \] | \⌈ | \, | \⌉ | \* | \∅ | \⤍ | \~ :- @@ -85,6 +85,14 @@ $s [$u # [\t \n \r \ \! \' \( \) \, \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * \@ [$u # [\t \n \r \ \! \' \( \) \, \- \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * { tok (eitherResIdent T_MetaFunctionName) } +-- token DoubleSigned +\- ? $d + \. $d + (e \- ? $d +)? + { tok (eitherResIdent T_DoubleSigned) } + +-- token IntegerSigned +\- ? $d + + { tok (eitherResIdent T_IntegerSigned) } + -- Keywords and Ident $l $i* { tok (eitherResIdent TV) } @@ -124,6 +132,8 @@ data Tok | T_ObjectMetaId !String | T_BytesMetaId !String | T_MetaFunctionName !String + | T_DoubleSigned !String + | T_IntegerSigned !String deriving (Eq, Show, Ord) -- | Smart constructor for 'Tok' for the sake of backwards compatibility. @@ -196,6 +206,8 @@ tokenText t = case t of PT _ (T_ObjectMetaId s) -> s PT _ (T_BytesMetaId s) -> s PT _ (T_MetaFunctionName s) -> s + PT _ (T_DoubleSigned s) -> s + PT _ (T_IntegerSigned s) -> s -- | Convert a token to a string. prToken :: Token -> String @@ -222,18 +234,19 @@ eitherResIdent tv s = treeFind resWords -- | The keywords and symbols of the language organized as binary search tree. resWords :: BTree resWords = - b "\955" 12 - (b "[" 6 - (b "*" 3 (b ")" 2 (b "(" 1 N N) N) (b "." 5 (b "," 4 N N) N)) - (b "}" 9 - (b "{" 8 (b "]" 7 N N) N) (b "\934" 11 (b "\916" 10 N N) N))) - (b "\8869" 18 - (b "\966" 15 - (b "\961" 14 (b "\958" 13 N N) N) - (b "\8709" 17 (b "\8614" 16 N N) N)) - (b "\10214" 21 - (b "\8969" 20 (b "\8968" 19 N N) N) - (b "\10509" 23 (b "\10215" 22 N N) N))) + b "\934\775" 13 + (b "]" 7 + (b "," 4 + (b ")" 2 (b "(" 1 N N) (b "*" 3 N N)) (b "[" 6 (b "." 5 N N) N)) + (b "~" 10 + (b "}" 9 (b "{" 8 N N) N) (b "\934" 12 (b "\916" 11 N N) N))) + (b "\8869" 20 + (b "\966" 17 + (b "\958" 15 (b "\955" 14 N N) (b "\961" 16 N N)) + (b "\8709" 19 (b "\8614" 18 N N) N)) + (b "\10214" 23 + (b "\8969" 22 (b "\8968" 21 N N) N) + (b "\10509" 25 (b "\10215" 24 N N) N))) where b s n = B bs (TS bs n) where diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info new file mode 100644 index 000000000..40333dd30 --- /dev/null +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info @@ -0,0 +1,1928 @@ +----------------------------------------------------------------------------- +Info file generated by Happy Version 1.20.1.1 from Par.y +----------------------------------------------------------------------------- + + +rule 12 is unused + +----------------------------------------------------------------------------- +Grammar +----------------------------------------------------------------------------- + %start_pProgram -> Program (0) + %start_pMetaId -> MetaId (1) + %start_pObject -> Object (2) + %start_pBinding -> Binding (3) + %start_pListBinding -> ListBinding (4) + %start_pAttribute -> Attribute (5) + %start_pListLabelId -> ListLabelId (6) + %start_pRuleAttribute -> RuleAttribute (7) + %start_pPeeledObject -> PeeledObject (8) + %start_pObjectHead -> ObjectHead (9) + %start_pObjectAction -> ObjectAction (10) + %start_pListObjectAction -> ListObjectAction (11) + Double -> L_doubl (12) + Integer -> L_integ (13) + String -> L_quoted (14) + Bytes -> L_Bytes (15) + Function -> L_Function (16) + LabelId -> L_LabelId (17) + AlphaIndex -> L_AlphaIndex (18) + LabelMetaId -> L_LabelMetaId (19) + TailMetaId -> L_TailMetaId (20) + BindingsMetaId -> L_BindingsMetaId (21) + ObjectMetaId -> L_ObjectMetaId (22) + BytesMetaId -> L_BytesMetaId (23) + MetaFunctionName -> L_MetaFunctionName (24) + DoubleSigned -> L_DoubleSigned (25) + Program -> '{' '⟦' ListBinding '⟧' '}' (26) + MetaId -> LabelMetaId (27) + MetaId -> TailMetaId (28) + MetaId -> BindingsMetaId (29) + MetaId -> ObjectMetaId (30) + MetaId -> BytesMetaId (31) + Object -> '⟦' ListBinding '⟧' (32) + Object -> Object '(' ListBinding ')' (33) + Object -> Object '.' Attribute (34) + Object -> 'Φ' (35) + Object -> 'Φ̇' (36) + Object -> 'ξ' (37) + Object -> '⊥' (38) + Object -> String (39) + Object -> Integer (40) + Object -> DoubleSigned (41) + Object -> Object '[' 'ξ' '↦' Object ']' (42) + Object -> '⌈' Object ',' Object '⌉' (43) + Object -> ObjectMetaId (44) + Object -> Object '*' TailMetaId (45) + Object -> MetaFunctionName '(' Object ')' (46) + Binding -> Attribute '↦' Object (47) + Binding -> Object (48) + Binding -> Attribute '↦' '∅' (49) + Binding -> 'Δ' '⤍' Bytes (50) + Binding -> 'Δ' '⤍' '∅' (51) + Binding -> 'λ' '⤍' Function (52) + Binding -> BindingsMetaId (53) + Binding -> 'Δ' '⤍' BytesMetaId (54) + ListBinding -> (55) + ListBinding -> Binding (56) + ListBinding -> Binding ',' ListBinding (57) + Attribute -> 'φ' (58) + Attribute -> 'ρ' (59) + Attribute -> LabelId (60) + Attribute -> AlphaIndex (61) + Attribute -> LabelMetaId (62) + Attribute -> '~' LabelId '(' ListLabelId ')' (63) + ListLabelId -> (64) + ListLabelId -> LabelId (65) + ListLabelId -> LabelId ',' ListLabelId (66) + RuleAttribute -> Attribute (67) + RuleAttribute -> 'Δ' (68) + RuleAttribute -> 'λ' (69) + PeeledObject -> ObjectHead ListObjectAction (70) + ObjectHead -> '⟦' ListBinding '⟧' (71) + ObjectHead -> 'Φ' (72) + ObjectHead -> 'ξ' (73) + ObjectHead -> '⊥' (74) + ObjectAction -> '(' ListBinding ')' (75) + ObjectAction -> '.' Attribute (76) + ListObjectAction -> (77) + ListObjectAction -> ObjectAction ListObjectAction (78) + +----------------------------------------------------------------------------- +Terminals +----------------------------------------------------------------------------- + '(' { PT _ (TS _ 1) } + ')' { PT _ (TS _ 2) } + '*' { PT _ (TS _ 3) } + ',' { PT _ (TS _ 4) } + '.' { PT _ (TS _ 5) } + '[' { PT _ (TS _ 6) } + ']' { PT _ (TS _ 7) } + '{' { PT _ (TS _ 8) } + '}' { PT _ (TS _ 9) } + '~' { PT _ (TS _ 10) } + 'Δ' { PT _ (TS _ 11) } + 'Φ' { PT _ (TS _ 12) } + 'Φ̇' { PT _ (TS _ 13) } + 'λ' { PT _ (TS _ 14) } + 'ξ' { PT _ (TS _ 15) } + 'ρ' { PT _ (TS _ 16) } + 'φ' { PT _ (TS _ 17) } + '↦' { PT _ (TS _ 18) } + '∅' { PT _ (TS _ 19) } + '⊥' { PT _ (TS _ 20) } + '⌈' { PT _ (TS _ 21) } + '⌉' { PT _ (TS _ 22) } + '⟦' { PT _ (TS _ 23) } + '⟧' { PT _ (TS _ 24) } + '⤍' { PT _ (TS _ 25) } + L_doubl { PT _ (TD $$) } + L_integ { PT _ (TI $$) } + L_quoted { PT _ (TL $$) } + L_Bytes { PT _ (T_Bytes $$) } + L_Function { PT _ (T_Function $$) } + L_LabelId { PT _ (T_LabelId $$) } + L_AlphaIndex { PT _ (T_AlphaIndex $$) } + L_LabelMetaId { PT _ (T_LabelMetaId $$) } + L_TailMetaId { PT _ (T_TailMetaId $$) } + L_BindingsMetaId{ PT _ (T_BindingsMetaId $$) } + L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } + L_BytesMetaId { PT _ (T_BytesMetaId $$) } + L_MetaFunctionName{ PT _ (T_MetaFunctionName $$) } + L_DoubleSigned { PT _ (T_DoubleSigned $$) } + +----------------------------------------------------------------------------- +Non-terminals +----------------------------------------------------------------------------- + %start_pProgram rule 0 + %start_pMetaId rule 1 + %start_pObject rule 2 + %start_pBinding rule 3 + %start_pListBinding rule 4 + %start_pAttribute rule 5 + %start_pListLabelId rule 6 + %start_pRuleAttribute rule 7 + %start_pPeeledObject rule 8 + %start_pObjectHead rule 9 + %start_pObjectAction rule 10 + %start_pListObjectAction rule 11 + Double rule 12 + Integer rule 13 + String rule 14 + Bytes rule 15 + Function rule 16 + LabelId rule 17 + AlphaIndex rule 18 + LabelMetaId rule 19 + TailMetaId rule 20 + BindingsMetaId rule 21 + ObjectMetaId rule 22 + BytesMetaId rule 23 + MetaFunctionName rule 24 + DoubleSigned rule 25 + Program rule 26 + MetaId rules 27, 28, 29, 30, 31 + Object rules 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 + Binding rules 47, 48, 49, 50, 51, 52, 53, 54 + ListBinding rules 55, 56, 57 + Attribute rules 58, 59, 60, 61, 62, 63 + ListLabelId rules 64, 65, 66 + RuleAttribute rules 67, 68, 69 + PeeledObject rule 70 + ObjectHead rules 71, 72, 73, 74 + ObjectAction rules 75, 76 + ListObjectAction rules 77, 78 + +----------------------------------------------------------------------------- +States +----------------------------------------------------------------------------- +State 0 + + %start_pProgram -> . Program (rule 0) + + '{' shift, and enter state 77 + + Program goto state 76 + +State 1 + + %start_pMetaId -> . MetaId (rule 1) + + L_LabelMetaId shift, and enter state 38 + L_TailMetaId shift, and enter state 74 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_BytesMetaId shift, and enter state 75 + + LabelMetaId goto state 68 + TailMetaId goto state 69 + BindingsMetaId goto state 70 + ObjectMetaId goto state 71 + BytesMetaId goto state 72 + MetaId goto state 73 + +State 2 + + %start_pObject -> . Object (rule 2) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 67 + +State 3 + + %start_pBinding -> . Binding (rule 3) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 66 + Attribute goto state 51 + +State 4 + + %start_pListBinding -> . ListBinding (rule 4) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + %eof reduce using rule 55 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 50 + Attribute goto state 51 + +State 5 + + %start_pAttribute -> . Attribute (rule 5) + + '~' shift, and enter state 31 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + Attribute goto state 41 + +State 6 + + %start_pListLabelId -> . ListLabelId (rule 6) + + L_LabelId shift, and enter state 36 + %eof reduce using rule 64 + + LabelId goto state 39 + ListLabelId goto state 40 + +State 7 + + %start_pRuleAttribute -> . RuleAttribute (rule 7) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 32 + 'λ' shift, and enter state 33 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + Attribute goto state 29 + RuleAttribute goto state 30 + +State 8 + + %start_pPeeledObject -> . PeeledObject (rule 8) + + 'Φ' shift, and enter state 20 + 'ξ' shift, and enter state 21 + '⊥' shift, and enter state 22 + '⟦' shift, and enter state 23 + + PeeledObject goto state 24 + ObjectHead goto state 25 + +State 9 + + %start_pObjectHead -> . ObjectHead (rule 9) + + 'Φ' shift, and enter state 20 + 'ξ' shift, and enter state 21 + '⊥' shift, and enter state 22 + '⟦' shift, and enter state 23 + + ObjectHead goto state 19 + +State 10 + + %start_pObjectAction -> . ObjectAction (rule 10) + + '(' shift, and enter state 16 + '.' shift, and enter state 17 + + ObjectAction goto state 18 + +State 11 + + %start_pListObjectAction -> . ListObjectAction (rule 11) + + '(' shift, and enter state 16 + '.' shift, and enter state 17 + %eof reduce using rule 77 + + ObjectAction goto state 14 + ListObjectActiongoto state 15 + +State 12 + + Double -> . L_doubl (rule 12) + + L_doubl shift, and enter state 13 + + +State 13 + + Double -> L_doubl . (rule 12) + + + +State 14 + + ListObjectAction -> ObjectAction . ListObjectAction (rule 78) + + '(' shift, and enter state 16 + '.' shift, and enter state 17 + %eof reduce using rule 77 + + ObjectAction goto state 14 + ListObjectActiongoto state 96 + +State 15 + + %start_pListObjectAction -> ListObjectAction . (rule 11) + + %eof accept + + +State 16 + + ObjectAction -> '(' . ListBinding ')' (rule 75) + + ')' reduce using rule 55 + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 95 + Attribute goto state 51 + +State 17 + + ObjectAction -> '.' . Attribute (rule 76) + + '~' shift, and enter state 31 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + Attribute goto state 94 + +State 18 + + %start_pObjectAction -> ObjectAction . (rule 10) + + %eof accept + + +State 19 + + %start_pObjectHead -> ObjectHead . (rule 9) + + %eof accept + + +State 20 + + ObjectHead -> 'Φ' . (rule 72) + + '(' reduce using rule 72 + '.' reduce using rule 72 + %eof reduce using rule 72 + + +State 21 + + ObjectHead -> 'ξ' . (rule 73) + + '(' reduce using rule 73 + '.' reduce using rule 73 + %eof reduce using rule 73 + + +State 22 + + ObjectHead -> '⊥' . (rule 74) + + '(' reduce using rule 74 + '.' reduce using rule 74 + %eof reduce using rule 74 + + +State 23 + + ObjectHead -> '⟦' . ListBinding '⟧' (rule 71) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + '⟧' reduce using rule 55 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 93 + Attribute goto state 51 + +State 24 + + %start_pPeeledObject -> PeeledObject . (rule 8) + + %eof accept + + +State 25 + + PeeledObject -> ObjectHead . ListObjectAction (rule 70) + + '(' shift, and enter state 16 + '.' shift, and enter state 17 + %eof reduce using rule 77 + + ObjectAction goto state 14 + ListObjectActiongoto state 92 + +State 26 + + Attribute -> LabelId . (rule 60) + + '(' reduce using rule 60 + ')' reduce using rule 60 + '*' reduce using rule 60 + ',' reduce using rule 60 + '.' reduce using rule 60 + '[' reduce using rule 60 + ']' reduce using rule 60 + '↦' reduce using rule 60 + '⌉' reduce using rule 60 + '⟧' reduce using rule 60 + %eof reduce using rule 60 + + +State 27 + + Attribute -> AlphaIndex . (rule 61) + + '(' reduce using rule 61 + ')' reduce using rule 61 + '*' reduce using rule 61 + ',' reduce using rule 61 + '.' reduce using rule 61 + '[' reduce using rule 61 + ']' reduce using rule 61 + '↦' reduce using rule 61 + '⌉' reduce using rule 61 + '⟧' reduce using rule 61 + %eof reduce using rule 61 + + +State 28 + + Attribute -> LabelMetaId . (rule 62) + + '(' reduce using rule 62 + ')' reduce using rule 62 + '*' reduce using rule 62 + ',' reduce using rule 62 + '.' reduce using rule 62 + '[' reduce using rule 62 + ']' reduce using rule 62 + '↦' reduce using rule 62 + '⌉' reduce using rule 62 + '⟧' reduce using rule 62 + %eof reduce using rule 62 + + +State 29 + + RuleAttribute -> Attribute . (rule 67) + + %eof reduce using rule 67 + + +State 30 + + %start_pRuleAttribute -> RuleAttribute . (rule 7) + + %eof accept + + +State 31 + + Attribute -> '~' . LabelId '(' ListLabelId ')' (rule 63) + + L_LabelId shift, and enter state 36 + + LabelId goto state 91 + +State 32 + + RuleAttribute -> 'Δ' . (rule 68) + + %eof reduce using rule 68 + + +State 33 + + RuleAttribute -> 'λ' . (rule 69) + + %eof reduce using rule 69 + + +State 34 + + Attribute -> 'ρ' . (rule 59) + + '(' reduce using rule 59 + ')' reduce using rule 59 + '*' reduce using rule 59 + ',' reduce using rule 59 + '.' reduce using rule 59 + '[' reduce using rule 59 + ']' reduce using rule 59 + '↦' reduce using rule 59 + '⌉' reduce using rule 59 + '⟧' reduce using rule 59 + %eof reduce using rule 59 + + +State 35 + + Attribute -> 'φ' . (rule 58) + + '(' reduce using rule 58 + ')' reduce using rule 58 + '*' reduce using rule 58 + ',' reduce using rule 58 + '.' reduce using rule 58 + '[' reduce using rule 58 + ']' reduce using rule 58 + '↦' reduce using rule 58 + '⌉' reduce using rule 58 + '⟧' reduce using rule 58 + %eof reduce using rule 58 + + +State 36 + + LabelId -> L_LabelId . (rule 17) + + '(' reduce using rule 17 + ')' reduce using rule 17 + '*' reduce using rule 17 + ',' reduce using rule 17 + '.' reduce using rule 17 + '[' reduce using rule 17 + ']' reduce using rule 17 + '↦' reduce using rule 17 + '⌉' reduce using rule 17 + '⟧' reduce using rule 17 + %eof reduce using rule 17 + + +State 37 + + AlphaIndex -> L_AlphaIndex . (rule 18) + + '(' reduce using rule 18 + ')' reduce using rule 18 + '*' reduce using rule 18 + ',' reduce using rule 18 + '.' reduce using rule 18 + '[' reduce using rule 18 + ']' reduce using rule 18 + '↦' reduce using rule 18 + '⌉' reduce using rule 18 + '⟧' reduce using rule 18 + %eof reduce using rule 18 + + +State 38 + + LabelMetaId -> L_LabelMetaId . (rule 19) + + '(' reduce using rule 19 + ')' reduce using rule 19 + '*' reduce using rule 19 + ',' reduce using rule 19 + '.' reduce using rule 19 + '[' reduce using rule 19 + ']' reduce using rule 19 + '↦' reduce using rule 19 + '⌉' reduce using rule 19 + '⟧' reduce using rule 19 + %eof reduce using rule 19 + + +State 39 + + ListLabelId -> LabelId . (rule 65) + ListLabelId -> LabelId . ',' ListLabelId (rule 66) + + ')' reduce using rule 65 + ',' shift, and enter state 90 + %eof reduce using rule 65 + + +State 40 + + %start_pListLabelId -> ListLabelId . (rule 6) + + %eof accept + + +State 41 + + %start_pAttribute -> Attribute . (rule 5) + + %eof accept + + +State 42 + + Object -> Integer . (rule 40) + + '(' reduce using rule 40 + ')' reduce using rule 40 + '*' reduce using rule 40 + ',' reduce using rule 40 + '.' reduce using rule 40 + '[' reduce using rule 40 + ']' reduce using rule 40 + '⌉' reduce using rule 40 + '⟧' reduce using rule 40 + %eof reduce using rule 40 + + +State 43 + + Object -> String . (rule 39) + + '(' reduce using rule 39 + ')' reduce using rule 39 + '*' reduce using rule 39 + ',' reduce using rule 39 + '.' reduce using rule 39 + '[' reduce using rule 39 + ']' reduce using rule 39 + '⌉' reduce using rule 39 + '⟧' reduce using rule 39 + %eof reduce using rule 39 + + +State 44 + + Binding -> BindingsMetaId . (rule 53) + + ')' reduce using rule 53 + ',' reduce using rule 53 + '⟧' reduce using rule 53 + %eof reduce using rule 53 + + +State 45 + + Object -> ObjectMetaId . (rule 44) + + '(' reduce using rule 44 + ')' reduce using rule 44 + '*' reduce using rule 44 + ',' reduce using rule 44 + '.' reduce using rule 44 + '[' reduce using rule 44 + ']' reduce using rule 44 + '⌉' reduce using rule 44 + '⟧' reduce using rule 44 + %eof reduce using rule 44 + + +State 46 + + Object -> MetaFunctionName . '(' Object ')' (rule 46) + + '(' shift, and enter state 89 + + +State 47 + + Object -> DoubleSigned . (rule 41) + + '(' reduce using rule 41 + ')' reduce using rule 41 + '*' reduce using rule 41 + ',' reduce using rule 41 + '.' reduce using rule 41 + '[' reduce using rule 41 + ']' reduce using rule 41 + '⌉' reduce using rule 41 + '⟧' reduce using rule 41 + %eof reduce using rule 41 + + +State 48 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> Object . '*' TailMetaId (rule 45) + Binding -> Object . (rule 48) + + '(' shift, and enter state 79 + ')' reduce using rule 48 + '*' shift, and enter state 80 + ',' reduce using rule 48 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + '⟧' reduce using rule 48 + %eof reduce using rule 48 + + +State 49 + + ListBinding -> Binding . (rule 56) + ListBinding -> Binding . ',' ListBinding (rule 57) + + ')' reduce using rule 56 + ',' shift, and enter state 88 + '⟧' reduce using rule 56 + %eof reduce using rule 56 + + +State 50 + + %start_pListBinding -> ListBinding . (rule 4) + + %eof accept + + +State 51 + + Binding -> Attribute . '↦' Object (rule 47) + Binding -> Attribute . '↦' '∅' (rule 49) + + '↦' shift, and enter state 87 + + +State 52 + + Binding -> 'Δ' . '⤍' Bytes (rule 50) + Binding -> 'Δ' . '⤍' '∅' (rule 51) + Binding -> 'Δ' . '⤍' BytesMetaId (rule 54) + + '⤍' shift, and enter state 86 + + +State 53 + + Object -> 'Φ' . (rule 35) + + '(' reduce using rule 35 + ')' reduce using rule 35 + '*' reduce using rule 35 + ',' reduce using rule 35 + '.' reduce using rule 35 + '[' reduce using rule 35 + ']' reduce using rule 35 + '⌉' reduce using rule 35 + '⟧' reduce using rule 35 + %eof reduce using rule 35 + + +State 54 + + Object -> 'Φ̇' . (rule 36) + + '(' reduce using rule 36 + ')' reduce using rule 36 + '*' reduce using rule 36 + ',' reduce using rule 36 + '.' reduce using rule 36 + '[' reduce using rule 36 + ']' reduce using rule 36 + '⌉' reduce using rule 36 + '⟧' reduce using rule 36 + %eof reduce using rule 36 + + +State 55 + + Binding -> 'λ' . '⤍' Function (rule 52) + + '⤍' shift, and enter state 85 + + +State 56 + + Object -> 'ξ' . (rule 37) + + '(' reduce using rule 37 + ')' reduce using rule 37 + '*' reduce using rule 37 + ',' reduce using rule 37 + '.' reduce using rule 37 + '[' reduce using rule 37 + ']' reduce using rule 37 + '⌉' reduce using rule 37 + '⟧' reduce using rule 37 + %eof reduce using rule 37 + + +State 57 + + Object -> '⊥' . (rule 38) + + '(' reduce using rule 38 + ')' reduce using rule 38 + '*' reduce using rule 38 + ',' reduce using rule 38 + '.' reduce using rule 38 + '[' reduce using rule 38 + ']' reduce using rule 38 + '⌉' reduce using rule 38 + '⟧' reduce using rule 38 + %eof reduce using rule 38 + + +State 58 + + Object -> '⌈' . Object ',' Object '⌉' (rule 43) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 84 + +State 59 + + Object -> '⟦' . ListBinding '⟧' (rule 32) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + '⟧' reduce using rule 55 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 83 + Attribute goto state 51 + +State 60 + + Integer -> L_integ . (rule 13) + + '(' reduce using rule 13 + ')' reduce using rule 13 + '*' reduce using rule 13 + ',' reduce using rule 13 + '.' reduce using rule 13 + '[' reduce using rule 13 + ']' reduce using rule 13 + '⌉' reduce using rule 13 + '⟧' reduce using rule 13 + %eof reduce using rule 13 + + +State 61 + + String -> L_quoted . (rule 14) + + '(' reduce using rule 14 + ')' reduce using rule 14 + '*' reduce using rule 14 + ',' reduce using rule 14 + '.' reduce using rule 14 + '[' reduce using rule 14 + ']' reduce using rule 14 + '⌉' reduce using rule 14 + '⟧' reduce using rule 14 + %eof reduce using rule 14 + + +State 62 + + BindingsMetaId -> L_BindingsMetaId . (rule 21) + + ')' reduce using rule 21 + ',' reduce using rule 21 + '⟧' reduce using rule 21 + %eof reduce using rule 21 + + +State 63 + + ObjectMetaId -> L_ObjectMetaId . (rule 22) + + '(' reduce using rule 22 + ')' reduce using rule 22 + '*' reduce using rule 22 + ',' reduce using rule 22 + '.' reduce using rule 22 + '[' reduce using rule 22 + ']' reduce using rule 22 + '⌉' reduce using rule 22 + '⟧' reduce using rule 22 + %eof reduce using rule 22 + + +State 64 + + MetaFunctionName -> L_MetaFunctionName . (rule 24) + + '(' reduce using rule 24 + + +State 65 + + DoubleSigned -> L_DoubleSigned . (rule 25) + + '(' reduce using rule 25 + ')' reduce using rule 25 + '*' reduce using rule 25 + ',' reduce using rule 25 + '.' reduce using rule 25 + '[' reduce using rule 25 + ']' reduce using rule 25 + '⌉' reduce using rule 25 + '⟧' reduce using rule 25 + %eof reduce using rule 25 + + +State 66 + + %start_pBinding -> Binding . (rule 3) + + %eof accept + + +State 67 + + %start_pObject -> Object . (rule 2) + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> Object . '*' TailMetaId (rule 45) + + '(' shift, and enter state 79 + '*' shift, and enter state 80 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + %eof accept + + +State 68 + + MetaId -> LabelMetaId . (rule 27) + + %eof reduce using rule 27 + + +State 69 + + MetaId -> TailMetaId . (rule 28) + + %eof reduce using rule 28 + + +State 70 + + MetaId -> BindingsMetaId . (rule 29) + + %eof reduce using rule 29 + + +State 71 + + MetaId -> ObjectMetaId . (rule 30) + + %eof reduce using rule 30 + + +State 72 + + MetaId -> BytesMetaId . (rule 31) + + %eof reduce using rule 31 + + +State 73 + + %start_pMetaId -> MetaId . (rule 1) + + %eof accept + + +State 74 + + TailMetaId -> L_TailMetaId . (rule 20) + + '(' reduce using rule 20 + ')' reduce using rule 20 + '*' reduce using rule 20 + ',' reduce using rule 20 + '.' reduce using rule 20 + '[' reduce using rule 20 + ']' reduce using rule 20 + '⌉' reduce using rule 20 + '⟧' reduce using rule 20 + %eof reduce using rule 20 + + +State 75 + + BytesMetaId -> L_BytesMetaId . (rule 23) + + ')' reduce using rule 23 + ',' reduce using rule 23 + '⟧' reduce using rule 23 + %eof reduce using rule 23 + + +State 76 + + %start_pProgram -> Program . (rule 0) + + %eof accept + + +State 77 + + Program -> '{' . '⟦' ListBinding '⟧' '}' (rule 26) + + '⟦' shift, and enter state 78 + + +State 78 + + Program -> '{' '⟦' . ListBinding '⟧' '}' (rule 26) + + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + '⟧' reduce using rule 55 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 117 + Attribute goto state 51 + +State 79 + + Object -> Object '(' . ListBinding ')' (rule 33) + + ')' reduce using rule 55 + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 116 + Attribute goto state 51 + +State 80 + + Object -> Object '*' . TailMetaId (rule 45) + + L_TailMetaId shift, and enter state 74 + + TailMetaId goto state 115 + +State 81 + + Object -> Object '.' . Attribute (rule 34) + + '~' shift, and enter state 31 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + Attribute goto state 114 + +State 82 + + Object -> Object '[' . 'ξ' '↦' Object ']' (rule 42) + + 'ξ' shift, and enter state 113 + + +State 83 + + Object -> '⟦' ListBinding . '⟧' (rule 32) + + '⟧' shift, and enter state 112 + + +State 84 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> '⌈' Object . ',' Object '⌉' (rule 43) + Object -> Object . '*' TailMetaId (rule 45) + + '(' shift, and enter state 79 + '*' shift, and enter state 80 + ',' shift, and enter state 111 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + + +State 85 + + Binding -> 'λ' '⤍' . Function (rule 52) + + L_Function shift, and enter state 110 + + Function goto state 109 + +State 86 + + Binding -> 'Δ' '⤍' . Bytes (rule 50) + Binding -> 'Δ' '⤍' . '∅' (rule 51) + Binding -> 'Δ' '⤍' . BytesMetaId (rule 54) + + '∅' shift, and enter state 107 + L_Bytes shift, and enter state 108 + L_BytesMetaId shift, and enter state 75 + + Bytes goto state 105 + BytesMetaId goto state 106 + +State 87 + + Binding -> Attribute '↦' . Object (rule 47) + Binding -> Attribute '↦' . '∅' (rule 49) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '∅' shift, and enter state 104 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 103 + +State 88 + + ListBinding -> Binding ',' . ListBinding (rule 57) + + ')' reduce using rule 55 + '~' shift, and enter state 31 + 'Δ' shift, and enter state 52 + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'λ' shift, and enter state 55 + 'ξ' shift, and enter state 56 + 'ρ' shift, and enter state 34 + 'φ' shift, and enter state 35 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + '⟧' reduce using rule 55 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_LabelId shift, and enter state 36 + L_AlphaIndex shift, and enter state 37 + L_LabelMetaId shift, and enter state 38 + L_BindingsMetaIdshift, and enter state 62 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + %eof reduce using rule 55 + + Integer goto state 42 + String goto state 43 + LabelId goto state 26 + AlphaIndex goto state 27 + LabelMetaId goto state 28 + BindingsMetaId goto state 44 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 48 + Binding goto state 49 + ListBinding goto state 102 + Attribute goto state 51 + +State 89 + + Object -> MetaFunctionName '(' . Object ')' (rule 46) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 101 + +State 90 + + ListLabelId -> LabelId ',' . ListLabelId (rule 66) + + ')' reduce using rule 64 + L_LabelId shift, and enter state 36 + %eof reduce using rule 64 + + LabelId goto state 39 + ListLabelId goto state 100 + +State 91 + + Attribute -> '~' LabelId . '(' ListLabelId ')' (rule 63) + + '(' shift, and enter state 99 + + +State 92 + + PeeledObject -> ObjectHead ListObjectAction . (rule 70) + + %eof reduce using rule 70 + + +State 93 + + ObjectHead -> '⟦' ListBinding . '⟧' (rule 71) + + '⟧' shift, and enter state 98 + + +State 94 + + ObjectAction -> '.' Attribute . (rule 76) + + '(' reduce using rule 76 + '.' reduce using rule 76 + %eof reduce using rule 76 + + +State 95 + + ObjectAction -> '(' ListBinding . ')' (rule 75) + + ')' shift, and enter state 97 + + +State 96 + + ListObjectAction -> ObjectAction ListObjectAction . (rule 78) + + %eof reduce using rule 78 + + +State 97 + + ObjectAction -> '(' ListBinding ')' . (rule 75) + + '(' reduce using rule 75 + '.' reduce using rule 75 + %eof reduce using rule 75 + + +State 98 + + ObjectHead -> '⟦' ListBinding '⟧' . (rule 71) + + '(' reduce using rule 71 + '.' reduce using rule 71 + %eof reduce using rule 71 + + +State 99 + + Attribute -> '~' LabelId '(' . ListLabelId ')' (rule 63) + + ')' reduce using rule 64 + L_LabelId shift, and enter state 36 + + LabelId goto state 39 + ListLabelId goto state 123 + +State 100 + + ListLabelId -> LabelId ',' ListLabelId . (rule 66) + + ')' reduce using rule 66 + %eof reduce using rule 66 + + +State 101 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> Object . '*' TailMetaId (rule 45) + Object -> MetaFunctionName '(' Object . ')' (rule 46) + + '(' shift, and enter state 79 + ')' shift, and enter state 122 + '*' shift, and enter state 80 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + + +State 102 + + ListBinding -> Binding ',' ListBinding . (rule 57) + + ')' reduce using rule 57 + '⟧' reduce using rule 57 + %eof reduce using rule 57 + + +State 103 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> Object . '*' TailMetaId (rule 45) + Binding -> Attribute '↦' Object . (rule 47) + + '(' shift, and enter state 79 + ')' reduce using rule 47 + '*' shift, and enter state 80 + ',' reduce using rule 47 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + '⟧' reduce using rule 47 + %eof reduce using rule 47 + + +State 104 + + Binding -> Attribute '↦' '∅' . (rule 49) + + ')' reduce using rule 49 + ',' reduce using rule 49 + '⟧' reduce using rule 49 + %eof reduce using rule 49 + + +State 105 + + Binding -> 'Δ' '⤍' Bytes . (rule 50) + + ')' reduce using rule 50 + ',' reduce using rule 50 + '⟧' reduce using rule 50 + %eof reduce using rule 50 + + +State 106 + + Binding -> 'Δ' '⤍' BytesMetaId . (rule 54) + + ')' reduce using rule 54 + ',' reduce using rule 54 + '⟧' reduce using rule 54 + %eof reduce using rule 54 + + +State 107 + + Binding -> 'Δ' '⤍' '∅' . (rule 51) + + ')' reduce using rule 51 + ',' reduce using rule 51 + '⟧' reduce using rule 51 + %eof reduce using rule 51 + + +State 108 + + Bytes -> L_Bytes . (rule 15) + + ')' reduce using rule 15 + ',' reduce using rule 15 + '⟧' reduce using rule 15 + %eof reduce using rule 15 + + +State 109 + + Binding -> 'λ' '⤍' Function . (rule 52) + + ')' reduce using rule 52 + ',' reduce using rule 52 + '⟧' reduce using rule 52 + %eof reduce using rule 52 + + +State 110 + + Function -> L_Function . (rule 16) + + ')' reduce using rule 16 + ',' reduce using rule 16 + '⟧' reduce using rule 16 + %eof reduce using rule 16 + + +State 111 + + Object -> '⌈' Object ',' . Object '⌉' (rule 43) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 121 + +State 112 + + Object -> '⟦' ListBinding '⟧' . (rule 32) + + '(' reduce using rule 32 + ')' reduce using rule 32 + '*' reduce using rule 32 + ',' reduce using rule 32 + '.' reduce using rule 32 + '[' reduce using rule 32 + ']' reduce using rule 32 + '⌉' reduce using rule 32 + '⟧' reduce using rule 32 + %eof reduce using rule 32 + + +State 113 + + Object -> Object '[' 'ξ' . '↦' Object ']' (rule 42) + + '↦' shift, and enter state 120 + + +State 114 + + Object -> Object '.' Attribute . (rule 34) + + '(' reduce using rule 34 + ')' reduce using rule 34 + '*' reduce using rule 34 + ',' reduce using rule 34 + '.' reduce using rule 34 + '[' reduce using rule 34 + ']' reduce using rule 34 + '⌉' reduce using rule 34 + '⟧' reduce using rule 34 + %eof reduce using rule 34 + + +State 115 + + Object -> Object '*' TailMetaId . (rule 45) + + '(' reduce using rule 45 + ')' reduce using rule 45 + '*' reduce using rule 45 + ',' reduce using rule 45 + '.' reduce using rule 45 + '[' reduce using rule 45 + ']' reduce using rule 45 + '⌉' reduce using rule 45 + '⟧' reduce using rule 45 + %eof reduce using rule 45 + + +State 116 + + Object -> Object '(' ListBinding . ')' (rule 33) + + ')' shift, and enter state 119 + + +State 117 + + Program -> '{' '⟦' ListBinding . '⟧' '}' (rule 26) + + '⟧' shift, and enter state 118 + + +State 118 + + Program -> '{' '⟦' ListBinding '⟧' . '}' (rule 26) + + '}' shift, and enter state 127 + + +State 119 + + Object -> Object '(' ListBinding ')' . (rule 33) + + '(' reduce using rule 33 + ')' reduce using rule 33 + '*' reduce using rule 33 + ',' reduce using rule 33 + '.' reduce using rule 33 + '[' reduce using rule 33 + ']' reduce using rule 33 + '⌉' reduce using rule 33 + '⟧' reduce using rule 33 + %eof reduce using rule 33 + + +State 120 + + Object -> Object '[' 'ξ' '↦' . Object ']' (rule 42) + + 'Φ' shift, and enter state 53 + 'Φ̇' shift, and enter state 54 + 'ξ' shift, and enter state 56 + '⊥' shift, and enter state 57 + '⌈' shift, and enter state 58 + '⟦' shift, and enter state 59 + L_integ shift, and enter state 60 + L_quoted shift, and enter state 61 + L_ObjectMetaId shift, and enter state 63 + L_MetaFunctionNameshift, and enter state 64 + L_DoubleSigned shift, and enter state 65 + + Integer goto state 42 + String goto state 43 + ObjectMetaId goto state 45 + MetaFunctionNamegoto state 46 + DoubleSigned goto state 47 + Object goto state 126 + +State 121 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> '⌈' Object ',' Object . '⌉' (rule 43) + Object -> Object . '*' TailMetaId (rule 45) + + '(' shift, and enter state 79 + '*' shift, and enter state 80 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + '⌉' shift, and enter state 125 + + +State 122 + + Object -> MetaFunctionName '(' Object ')' . (rule 46) + + '(' reduce using rule 46 + ')' reduce using rule 46 + '*' reduce using rule 46 + ',' reduce using rule 46 + '.' reduce using rule 46 + '[' reduce using rule 46 + ']' reduce using rule 46 + '⌉' reduce using rule 46 + '⟧' reduce using rule 46 + %eof reduce using rule 46 + + +State 123 + + Attribute -> '~' LabelId '(' ListLabelId . ')' (rule 63) + + ')' shift, and enter state 124 + + +State 124 + + Attribute -> '~' LabelId '(' ListLabelId ')' . (rule 63) + + '(' reduce using rule 63 + ')' reduce using rule 63 + '*' reduce using rule 63 + ',' reduce using rule 63 + '.' reduce using rule 63 + '[' reduce using rule 63 + ']' reduce using rule 63 + '↦' reduce using rule 63 + '⌉' reduce using rule 63 + '⟧' reduce using rule 63 + %eof reduce using rule 63 + + +State 125 + + Object -> '⌈' Object ',' Object '⌉' . (rule 43) + + '(' reduce using rule 43 + ')' reduce using rule 43 + '*' reduce using rule 43 + ',' reduce using rule 43 + '.' reduce using rule 43 + '[' reduce using rule 43 + ']' reduce using rule 43 + '⌉' reduce using rule 43 + '⟧' reduce using rule 43 + %eof reduce using rule 43 + + +State 126 + + Object -> Object . '(' ListBinding ')' (rule 33) + Object -> Object . '.' Attribute (rule 34) + Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) + Object -> Object '[' 'ξ' '↦' Object . ']' (rule 42) + Object -> Object . '*' TailMetaId (rule 45) + + '(' shift, and enter state 79 + '*' shift, and enter state 80 + '.' shift, and enter state 81 + '[' shift, and enter state 82 + ']' shift, and enter state 128 + + +State 127 + + Program -> '{' '⟦' ListBinding '⟧' '}' . (rule 26) + + %eof reduce using rule 26 + + +State 128 + + Object -> Object '[' 'ξ' '↦' Object ']' . (rule 42) + + '(' reduce using rule 42 + ')' reduce using rule 42 + '*' reduce using rule 42 + ',' reduce using rule 42 + '.' reduce using rule 42 + '[' reduce using rule 42 + ']' reduce using rule 42 + '⌉' reduce using rule 42 + '⟧' reduce using rule 42 + %eof reduce using rule 42 + + +----------------------------------------------------------------------------- +Grammar Totals +----------------------------------------------------------------------------- +Number of rules: 79 +Number of terminals: 39 +Number of non-terminals: 38 +Number of states: 129 diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index 26c6a8ee4..f11ca5326 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y @@ -14,6 +14,7 @@ module Language.EO.Phi.Syntax.Par , pBinding , pListBinding , pAttribute + , pListLabelId , pRuleAttribute , pPeeledObject , pObjectHead @@ -34,6 +35,7 @@ import Language.EO.Phi.Syntax.Lex %name pBinding Binding %name pListBinding ListBinding %name pAttribute Attribute +%name pListLabelId ListLabelId %name pRuleAttribute RuleAttribute %name pPeeledObject PeeledObject %name pObjectHead ObjectHead @@ -52,20 +54,22 @@ import Language.EO.Phi.Syntax.Lex ']' { PT _ (TS _ 7) } '{' { PT _ (TS _ 8) } '}' { PT _ (TS _ 9) } - 'Δ' { PT _ (TS _ 10) } - 'Φ' { PT _ (TS _ 11) } - 'λ' { PT _ (TS _ 12) } - 'ξ' { PT _ (TS _ 13) } - 'ρ' { PT _ (TS _ 14) } - 'φ' { PT _ (TS _ 15) } - '↦' { PT _ (TS _ 16) } - '∅' { PT _ (TS _ 17) } - '⊥' { PT _ (TS _ 18) } - '⌈' { PT _ (TS _ 19) } - '⌉' { PT _ (TS _ 20) } - '⟦' { PT _ (TS _ 21) } - '⟧' { PT _ (TS _ 22) } - '⤍' { PT _ (TS _ 23) } + '~' { PT _ (TS _ 10) } + 'Δ' { PT _ (TS _ 11) } + 'Φ' { PT _ (TS _ 12) } + 'Φ̇' { PT _ (TS _ 13) } + 'λ' { PT _ (TS _ 14) } + 'ξ' { PT _ (TS _ 15) } + 'ρ' { PT _ (TS _ 16) } + 'φ' { PT _ (TS _ 17) } + '↦' { PT _ (TS _ 18) } + '∅' { PT _ (TS _ 19) } + '⊥' { PT _ (TS _ 20) } + '⌈' { PT _ (TS _ 21) } + '⌉' { PT _ (TS _ 22) } + '⟦' { PT _ (TS _ 23) } + '⟧' { PT _ (TS _ 24) } + '⤍' { PT _ (TS _ 25) } L_doubl { PT _ (TD $$) } L_integ { PT _ (TI $$) } L_quoted { PT _ (TL $$) } @@ -79,6 +83,8 @@ import Language.EO.Phi.Syntax.Lex L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } L_BytesMetaId { PT _ (T_BytesMetaId $$) } L_MetaFunctionName { PT _ (T_MetaFunctionName $$) } + L_DoubleSigned { PT _ (T_DoubleSigned $$) } + L_IntegerSigned { PT _ (T_IntegerSigned $$) } %% @@ -121,6 +127,12 @@ BytesMetaId : L_BytesMetaId { Language.EO.Phi.Syntax.Abs.BytesMetaId $1 } MetaFunctionName :: { Language.EO.Phi.Syntax.Abs.MetaFunctionName } MetaFunctionName : L_MetaFunctionName { Language.EO.Phi.Syntax.Abs.MetaFunctionName $1 } +DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } +DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } + +IntegerSigned :: { Language.EO.Phi.Syntax.Abs.IntegerSigned } +IntegerSigned : L_IntegerSigned { Language.EO.Phi.Syntax.Abs.IntegerSigned $1 } + Program :: { Language.EO.Phi.Syntax.Abs.Program } Program : '{' '⟦' ListBinding '⟧' '}' { Language.EO.Phi.Syntax.Abs.Program $3 } @@ -139,11 +151,12 @@ Object | Object '(' ListBinding ')' { Language.EO.Phi.Syntax.Abs.Application $1 $3 } | Object '.' Attribute { Language.EO.Phi.Syntax.Abs.ObjectDispatch $1 $3 } | 'Φ' { Language.EO.Phi.Syntax.Abs.GlobalObject } + | 'Φ̇' { Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg } | 'ξ' { Language.EO.Phi.Syntax.Abs.ThisObject } | '⊥' { Language.EO.Phi.Syntax.Abs.Termination } | String { Language.EO.Phi.Syntax.Abs.ConstString $1 } - | Integer { Language.EO.Phi.Syntax.Abs.ConstInt $1 } - | Double { Language.EO.Phi.Syntax.Abs.ConstFloat $1 } + | IntegerSigned { Language.EO.Phi.Syntax.Abs.ConstIntRaw $1 } + | DoubleSigned { Language.EO.Phi.Syntax.Abs.ConstFloatRaw $1 } | Object '[' 'ξ' '↦' Object ']' { Language.EO.Phi.Syntax.Abs.MetaSubstThis $1 $5 } | '⌈' Object ',' Object '⌉' { Language.EO.Phi.Syntax.Abs.MetaContextualize $2 $4 } | ObjectMetaId { Language.EO.Phi.Syntax.Abs.MetaObject $1 } @@ -153,6 +166,7 @@ Object Binding :: { Language.EO.Phi.Syntax.Abs.Binding } Binding : Attribute '↦' Object { Language.EO.Phi.Syntax.Abs.AlphaBinding $1 $3 } + | Object { Language.EO.Phi.Syntax.Abs.AlphaBindingSugar $1 } | Attribute '↦' '∅' { Language.EO.Phi.Syntax.Abs.EmptyBinding $1 } | 'Δ' '⤍' Bytes { Language.EO.Phi.Syntax.Abs.DeltaBinding $3 } | 'Δ' '⤍' '∅' { Language.EO.Phi.Syntax.Abs.DeltaEmptyBinding } @@ -173,6 +187,13 @@ Attribute | LabelId { Language.EO.Phi.Syntax.Abs.Label $1 } | AlphaIndex { Language.EO.Phi.Syntax.Abs.Alpha $1 } | LabelMetaId { Language.EO.Phi.Syntax.Abs.MetaAttr $1 } + | '~' LabelId '(' ListLabelId ')' { Language.EO.Phi.Syntax.Abs.AttrSugar $2 $4 } + +ListLabelId :: { [Language.EO.Phi.Syntax.Abs.LabelId] } +ListLabelId + : {- empty -} { [] } + | LabelId { (:[]) $1 } + | LabelId ',' ListLabelId { (:) $1 $3 } RuleAttribute :: { Language.EO.Phi.Syntax.Abs.RuleAttribute } RuleAttribute diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs index 8698e9be6..19d1c25d2 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs @@ -30,7 +30,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} + -- File generated by the BNF Converter (bnfc 2.9.5). + {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} @@ -39,40 +41,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif -- | Pretty-printer for Language. + module Language.EO.Phi.Syntax.Print where -import Data.Char (Char, isSpace) -import Language.EO.Phi.Syntax.Abs qualified -import Prelude ( - Bool (..), - Double, - Int, - Integer, - ShowS, - String, - all, - elem, - foldr, - id, - map, - null, - replicate, - showChar, - showString, - shows, - span, - ($), - (*), - (+), - (++), - (-), - (.), - (<), - (==), - ) +import Prelude + ( ($), (.) + , Bool(..), (==), (<) + , Int, Integer, Double, (+), (-), (*) + , String, (++) + , ShowS, showChar, showString + , all, elem, foldr, id, map, null, replicate, shows, span + ) +import Data.Char ( Char, isSpace ) +import qualified Language.EO.Phi.Syntax.Abs -- | The top-level printing method. -printTree :: (Print a) => a -> String + +printTree :: Print a => a -> String printTree = render . prt 0 type Doc = [ShowS] -> [ShowS] @@ -82,28 +67,25 @@ doc = (:) render :: Doc -> String render d = rend 0 False (map ($ "") $ d []) "" - where - rend :: - Int -> - -- \^ Indentation level. - Bool -> - -- \^ Pending indentation to be output before next character? - [String] -> - ShowS + where + rend + :: Int -- ^ Indentation level. + -> Bool -- ^ Pending indentation to be output before next character? + -> [String] + -> ShowS rend i p = \case - "[" : ts -> char '[' . rend i False ts - "(" : ts -> char '(' . rend i False ts - "{" : ts -> onNewLine i p . showChar '{' . new (i + 1) ts - "}" : ";" : ts -> onNewLine (i - 1) p . showString "};" . new (i - 1) ts - "}" : ts -> onNewLine (i - 1) p . showChar '}' . new (i - 1) ts - [";"] -> char ';' - ";" : ts -> char ';' . new i ts - t : ts@(s : _) - | closingOrPunctuation s -> - pending . showString t . rend i False ts - t : ts -> pending . space t . rend i False ts - [] -> id - where + "[" :ts -> char '[' . rend i False ts + "(" :ts -> char '(' . rend i False ts + "{" :ts -> onNewLine i p . showChar '{' . new (i+1) ts + "}" : ";":ts -> onNewLine (i-1) p . showString "};" . new (i-1) ts + "}" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts + [";"] -> char ';' + ";" :ts -> char ';' . new i ts + t : ts@(s:_) | closingOrPunctuation s + -> pending . showString t . rend i False ts + t :ts -> pending . space t . rend i False ts + [] -> id + where -- Output character after pending indentation. char :: Char -> ShowS char c = pending . showChar c @@ -114,7 +96,7 @@ render d = rend 0 False (map ($ "") $ d []) "" -- Indentation (spaces) for given indentation level. indent :: Int -> ShowS - indent i = replicateS (2 * i) (showChar ' ') + indent i = replicateS (2*i) (showChar ' ') -- Continue rendering in new line with new indentation. new :: Int -> [String] -> ShowS @@ -128,16 +110,16 @@ render d = rend 0 False (map ($ "") $ d []) "" space :: String -> ShowS space t s = case (all isSpace t, null spc, null rest) of - (True, _, True) -> [] -- remove trailing space - (False, _, True) -> t -- remove trailing space - (False, True, False) -> t ++ ' ' : s -- add space if none - _ -> t ++ s - where - (spc, rest) = span isSpace s + (True , _ , True ) -> [] -- remove trailing space + (False, _ , True ) -> t -- remove trailing space + (False, True, False) -> t ++ ' ' : s -- add space if none + _ -> t ++ s + where + (spc, rest) = span isSpace s closingOrPunctuation :: String -> Bool closingOrPunctuation [c] = c `elem` closerOrPunct - closingOrPunctuation _ = False + closingOrPunctuation _ = False closerOrPunct :: String closerOrPunct = ")],;" @@ -155,10 +137,11 @@ replicateS :: Int -> ShowS -> ShowS replicateS n f = concatS (replicate n f) -- | The printer class does the job. + class Print a where prt :: Int -> a -> Doc -instance {-# OVERLAPPABLE #-} (Print a) => Print [a] where +instance {-# OVERLAPPABLE #-} Print a => Print [a] where prt i = concatD . map (prt i) instance Print Char where @@ -207,6 +190,10 @@ instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where + prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where + prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.Program where prt i = \case Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")]) @@ -225,20 +212,24 @@ instance Print Language.EO.Phi.Syntax.Abs.Object where Language.EO.Phi.Syntax.Abs.Application object bindings -> prPrec i 0 (concatD [prt 0 object, doc (showString "("), prt 0 bindings, doc (showString ")")]) Language.EO.Phi.Syntax.Abs.ObjectDispatch object attribute -> prPrec i 0 (concatD [prt 0 object, doc (showString "."), prt 0 attribute]) Language.EO.Phi.Syntax.Abs.GlobalObject -> prPrec i 0 (concatD [doc (showString "\934")]) + Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg -> prPrec i 0 (concatD [doc (showString "\934\775")]) Language.EO.Phi.Syntax.Abs.ThisObject -> prPrec i 0 (concatD [doc (showString "\958")]) Language.EO.Phi.Syntax.Abs.Termination -> prPrec i 0 (concatD [doc (showString "\8869")]) Language.EO.Phi.Syntax.Abs.ConstString str -> prPrec i 0 (concatD [printString str]) - Language.EO.Phi.Syntax.Abs.ConstInt n -> prPrec i 0 (concatD [prt 0 n]) - Language.EO.Phi.Syntax.Abs.ConstFloat d -> prPrec i 0 (concatD [prt 0 d]) + Language.EO.Phi.Syntax.Abs.ConstIntRaw integersigned -> prPrec i 0 (concatD [prt 0 integersigned]) + Language.EO.Phi.Syntax.Abs.ConstFloatRaw doublesigned -> prPrec i 0 (concatD [prt 0 doublesigned]) Language.EO.Phi.Syntax.Abs.MetaSubstThis object1 object2 -> prPrec i 0 (concatD [prt 0 object1, doc (showString "["), doc (showString "\958"), doc (showString "\8614"), prt 0 object2, doc (showString "]")]) Language.EO.Phi.Syntax.Abs.MetaContextualize object1 object2 -> prPrec i 0 (concatD [doc (showString "\8968"), prt 0 object1, doc (showString ","), prt 0 object2, doc (showString "\8969")]) Language.EO.Phi.Syntax.Abs.MetaObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) Language.EO.Phi.Syntax.Abs.MetaTailContext object tailmetaid -> prPrec i 0 (concatD [prt 0 object, doc (showString "*"), prt 0 tailmetaid]) Language.EO.Phi.Syntax.Abs.MetaFunction metafunctionname object -> prPrec i 0 (concatD [prt 0 metafunctionname, doc (showString "("), prt 0 object, doc (showString ")")]) + Language.EO.Phi.Syntax.Abs.ConstFloat d -> prPrec i 0 (concatD [prt 0 d]) + Language.EO.Phi.Syntax.Abs.ConstInt n -> prPrec i 0 (concatD [prt 0 n]) instance Print Language.EO.Phi.Syntax.Abs.Binding where prt i = \case Language.EO.Phi.Syntax.Abs.AlphaBinding attribute object -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), prt 0 object]) + Language.EO.Phi.Syntax.Abs.AlphaBindingSugar object -> prPrec i 0 (concatD [prt 0 object]) Language.EO.Phi.Syntax.Abs.EmptyBinding attribute -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), doc (showString "\8709")]) Language.EO.Phi.Syntax.Abs.DeltaBinding bytes -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytes]) Language.EO.Phi.Syntax.Abs.DeltaEmptyBinding -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), doc (showString "\8709")]) @@ -249,7 +240,7 @@ instance Print Language.EO.Phi.Syntax.Abs.Binding where instance Print [Language.EO.Phi.Syntax.Abs.Binding] where prt _ [] = concatD [] prt _ [x] = concatD [prt 0 x] - prt _ (x : xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] + prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] instance Print Language.EO.Phi.Syntax.Abs.Attribute where prt i = \case @@ -258,6 +249,12 @@ instance Print Language.EO.Phi.Syntax.Abs.Attribute where Language.EO.Phi.Syntax.Abs.Label labelid -> prPrec i 0 (concatD [prt 0 labelid]) Language.EO.Phi.Syntax.Abs.Alpha alphaindex -> prPrec i 0 (concatD [prt 0 alphaindex]) Language.EO.Phi.Syntax.Abs.MetaAttr labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) + Language.EO.Phi.Syntax.Abs.AttrSugar labelid labelids -> prPrec i 0 (concatD [doc (showString "~"), prt 0 labelid, doc (showString "("), prt 0 labelids, doc (showString ")")]) + +instance Print [Language.EO.Phi.Syntax.Abs.LabelId] where + prt _ [] = concatD [] + prt _ [x] = concatD [prt 0 x] + prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] instance Print Language.EO.Phi.Syntax.Abs.RuleAttribute where prt i = \case @@ -283,4 +280,4 @@ instance Print Language.EO.Phi.Syntax.Abs.ObjectAction where instance Print [Language.EO.Phi.Syntax.Abs.ObjectAction] where prt _ [] = concatD [] - prt _ (x : xs) = concatD [prt 0 x, prt 0 xs] + prt _ (x:xs) = concatD [prt 0 x, prt 0 xs] From 90021825ec6a4299a7b689d68c3b08436cea4357 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:23:02 +0300 Subject: [PATCH 15/69] fix(eo-phi-normalizer): actually support sugar --- eo-phi-normalizer/Setup.hs | 2 +- eo-phi-normalizer/app/Main.hs | 4 +- .../data/0.49.1/org/eolang/number.phi | 2 +- eo-phi-normalizer/eo-phi-normalizer.cabal | 75 +++++++++++++ eo-phi-normalizer/package.yaml | 3 + eo-phi-normalizer/src/Language/EO/Phi.hs | 2 +- .../src/Language/EO/Phi/Dataize.hs | 2 + .../src/Language/EO/Phi/Dependencies.hs | 1 + .../src/Language/EO/Phi/Normalize.hs | 2 + .../src/Language/EO/Phi/Preprocess.hs | 57 ++++++++++ .../src/Language/EO/Phi/Rules/Common.hs | 7 ++ .../src/Language/EO/Phi/Rules/Fast.hs | 2 + .../src/Language/EO/Phi/Rules/Yaml.hs | 25 +++++ .../src/Language/EO/Phi/Syntax.hs | 101 ++++++++++++++++-- .../src/Language/EO/Phi/ToLaTeX.hs | 10 +- .../test/Language/EO/Rules/PhiPaperSpec.hs | 8 +- 16 files changed, 289 insertions(+), 14 deletions(-) create mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs diff --git a/eo-phi-normalizer/Setup.hs b/eo-phi-normalizer/Setup.hs index 93243d2c9..99d950dbb 100644 --- a/eo-phi-normalizer/Setup.hs +++ b/eo-phi-normalizer/Setup.hs @@ -89,7 +89,7 @@ main = , "bnfc --haskell -d -p Language.EO.Phi --generic -o src/ grammar/EO/Phi/Syntax.cf" , "cd src/Language/EO/Phi/Syntax" , "alex Lex.x" - , "happy Par.y" + , "happy --info Par.y" , "true" ] diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index a7cecd57f..cf60c4de4 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -83,7 +83,7 @@ import Language.EO.Phi.Rules.Common (ApplicationLimits (ApplicationLimits), Cont import Language.EO.Phi.Rules.Fast (fastYegorInsideOut, fastYegorInsideOutAsRule) import Language.EO.Phi.Rules.RunYegor (yegorRuleSet) import Language.EO.Phi.Rules.Yaml (RuleSet (rules, title), convertRuleNamed, parseRuleSetFromFile) -import Language.EO.Phi.Syntax (desugar, wrapBytesInBytes, wrapTermination) +import Language.EO.Phi.Syntax (desugar, wrapBytesInBytes, wrapTermination, expectedDesugaredObject) import Language.EO.Phi.ToLaTeX import Language.EO.Test.YamlSpec (spec) import Options.Applicative hiding (metavar) @@ -570,7 +570,9 @@ wrapRawBytesIn = \case obj@MetaFunction{} -> obj obj@ConstString{} -> wrapRawBytesIn (desugar obj) obj@ConstInt{} -> wrapRawBytesIn (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> wrapRawBytesIn (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj -- * Main diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi index 18ff8c183..b25b8d652 100644 --- a/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi @@ -71,4 +71,4 @@ ⟧, λ ⤍ Package ⟧ -⟧} \ No newline at end of file +⟧} diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 287e05540..0521d42cd 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -189,6 +189,67 @@ extra-source-files: data/0.41.2/org/eolang/txt/sscanf.phi data/0.41.2/org/eolang/txt/text.phi data/0.41.2/org/eolang/while.phi + data/0.49.1/dependencies.md + data/0.49.1/org/eolang/as-phi.phi + data/0.49.1/org/eolang/bytes.phi + data/0.49.1/org/eolang/cti.phi + data/0.49.1/org/eolang/dataized.phi + data/0.49.1/org/eolang/error.phi + data/0.49.1/org/eolang/false.phi + data/0.49.1/org/eolang/fs/dir.phi + data/0.49.1/org/eolang/fs/file.phi + data/0.49.1/org/eolang/fs/path.phi + data/0.49.1/org/eolang/fs/tmpdir.phi + data/0.49.1/org/eolang/go.phi + data/0.49.1/org/eolang/i16.phi + data/0.49.1/org/eolang/i32.phi + data/0.49.1/org/eolang/i64.phi + data/0.49.1/org/eolang/io/bytes-as-input.phi + data/0.49.1/org/eolang/io/console.phi + data/0.49.1/org/eolang/io/dead-input.phi + data/0.49.1/org/eolang/io/dead-output.phi + data/0.49.1/org/eolang/io/input-length.phi + data/0.49.1/org/eolang/io/malloc-as-output.phi + data/0.49.1/org/eolang/io/stdin.phi + data/0.49.1/org/eolang/io/stdout.phi + data/0.49.1/org/eolang/io/tee-input.phi + data/0.49.1/org/eolang/malloc.phi + data/0.49.1/org/eolang/math/angle.phi + data/0.49.1/org/eolang/math/e.phi + data/0.49.1/org/eolang/math/integral.phi + data/0.49.1/org/eolang/math/numbers.phi + data/0.49.1/org/eolang/math/pi.phi + data/0.49.1/org/eolang/math/random.phi + data/0.49.1/org/eolang/math/real.phi + data/0.49.1/org/eolang/nan.phi + data/0.49.1/org/eolang/negative-infinity.phi + data/0.49.1/org/eolang/net/socket.phi + data/0.49.1/org/eolang/number.phi + data/0.49.1/org/eolang/positive-infinity.phi + data/0.49.1/org/eolang/rust.phi + data/0.49.1/org/eolang/seq.phi + data/0.49.1/org/eolang/string.phi + data/0.49.1/org/eolang/structs/bytes-as-array.phi + data/0.49.1/org/eolang/structs/hash-code-of.phi + data/0.49.1/org/eolang/structs/list.phi + data/0.49.1/org/eolang/structs/map.phi + data/0.49.1/org/eolang/structs/range-of-ints.phi + data/0.49.1/org/eolang/structs/range.phi + data/0.49.1/org/eolang/structs/set.phi + data/0.49.1/org/eolang/switch.phi + data/0.49.1/org/eolang/sys/getenv.phi + data/0.49.1/org/eolang/sys/line-separator.phi + data/0.49.1/org/eolang/sys/os.phi + data/0.49.1/org/eolang/sys/posix.phi + data/0.49.1/org/eolang/sys/win32.phi + data/0.49.1/org/eolang/true.phi + data/0.49.1/org/eolang/try.phi + data/0.49.1/org/eolang/tuple.phi + data/0.49.1/org/eolang/txt/regex.phi + data/0.49.1/org/eolang/txt/sprintf.phi + data/0.49.1/org/eolang/txt/sscanf.phi + data/0.49.1/org/eolang/txt/text.phi + data/0.49.1/org/eolang/while.phi test/eo/phi/rules/new.yaml test/eo/phi/rules/streams.yaml @@ -222,6 +283,7 @@ library Language.EO.Phi.Pipeline.Dataize.PrintConfigs Language.EO.Phi.Pipeline.EOTests.Data Language.EO.Phi.Pipeline.EOTests.PrepareTests + Language.EO.Phi.Preprocess Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common @@ -269,8 +331,11 @@ library , hspec , hspec-core , lens + , megaparsec , mtl + , parser-combinators , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -315,9 +380,12 @@ executable eo-phi-normalizer , hspec , hspec-core , lens + , megaparsec , mtl , optparse-applicative + , parser-combinators , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -344,6 +412,7 @@ test-suite doctests Language.EO.Phi.Pipeline.Dataize.PrintConfigs Language.EO.Phi.Pipeline.EOTests.Data Language.EO.Phi.Pipeline.EOTests.PrepareTests + Language.EO.Phi.Preprocess Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common @@ -393,8 +462,11 @@ test-suite doctests , hspec , hspec-core , lens + , megaparsec , mtl + , parser-combinators , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -448,8 +520,11 @@ test-suite spec , hspec-core , hspec-discover , lens + , megaparsec , mtl + , parser-combinators , regex-compat + , replace-megaparsec , scientific , template-haskell , text diff --git a/eo-phi-normalizer/package.yaml b/eo-phi-normalizer/package.yaml index 8178003aa..85ac6b42b 100644 --- a/eo-phi-normalizer/package.yaml +++ b/eo-phi-normalizer/package.yaml @@ -93,6 +93,9 @@ dependencies: - containers - code-page - with-utf8 + - replace-megaparsec + - megaparsec + - parser-combinators default-extensions: - ImportQualifiedPost diff --git a/eo-phi-normalizer/src/Language/EO/Phi.hs b/eo-phi-normalizer/src/Language/EO/Phi.hs index 9cc894291..3822bbff8 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi.hs @@ -44,7 +44,7 @@ parseProgram = parseWith Phi.pProgram -- | Parse an 'Object' or return a parsing error. parseObject :: String -> Either String Phi.Object -parseObject = Phi.pObject . Phi.myLexer +parseObject = parseWith Phi.pObject -- | Parse a 'Program' from a 'String'. -- May throw an 'error` if input has a syntactical or lexical errors. diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs index 1025947eb..63c27862f 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs @@ -47,7 +47,9 @@ desugarAsBytes :: Either Object Bytes -> Either Object Bytes desugarAsBytes (Left obj) = case obj of ConstString s -> Right (stringToBytes s) ConstInt n -> Right (intToBytes (fromInteger n)) + f@ConstIntRaw{} -> expectedDesugaredObject f ConstFloat x -> Right (floatToBytes x) + f@ConstFloatRaw{} -> expectedDesugaredObject f _ -> Left obj desugarAsBytes (Right bytes) = Right bytes diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs b/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs index 068b3fa89..903234364 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs @@ -37,6 +37,7 @@ bindingAttr DeltaEmptyBinding = Just (Alpha (AlphaIndex "Δ")) bindingAttr LambdaBinding{} = Just (Alpha (AlphaIndex "λ")) bindingAttr MetaBindings{} = Nothing bindingAttr MetaDeltaBinding{} = Nothing +bindingAttr b@(AlphaBindingSugar{}) = expectedDesugaredBinding b zipBindings :: [Binding] -> [Binding] -> ([Binding], [(Binding, Binding)]) zipBindings xs ys = (xs' <> ys', collisions) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs index 7e613416c..b828e3998 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs @@ -81,7 +81,9 @@ peelObject = \case MetaContextualize{} -> error "impossible" obj@ConstString{} -> peelObject (desugar obj) obj@ConstInt{} -> peelObject (desugar obj) + obj@ConstIntRaw{} -> peelObject (desugar obj) obj@ConstFloat{} -> peelObject (desugar obj) + obj@ConstFloatRaw{} -> peelObject (desugar obj) where followedBy (PeeledObject object actions) action = PeeledObject object (actions ++ [action]) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs b/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs new file mode 100644 index 000000000..03021807d --- /dev/null +++ b/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs @@ -0,0 +1,57 @@ +{-# LANGUAGE BlockArguments #-} + +module Language.EO.Phi.Preprocess where + +import Control.Monad (void) +import Data.Void (Void) +import Replace.Megaparsec (splitCap) +import Text.Megaparsec (MonadParsec (..), Parsec, Stream (..), between, match, sepBy) +import Text.Megaparsec.Byte.Lexer qualified as L +import Text.Megaparsec.Char (lowerChar, space) + +symbol :: String -> Parser String +symbol = L.symbol space + +lexeme :: Parser a -> Parser a +lexeme = L.lexeme space + +type Parser = Parsec Void String + +parseLabelId :: Parser () +parseLabelId = lexeme do + void lowerChar + void $ takeWhileP (Just "LabelId") (`notElem` " \r\n\t,.|':;!?][}{)(⟧⟦") + +parseBindingArrow :: Parser () +parseBindingArrow = void $ symbol "↦" + +parseAlphaAttr :: Parser () +parseAlphaAttr = do + void parseLabelId + void $ between (symbol "(") (symbol ")") (sepBy parseLabelId (symbol ",")) + +parseAlphaBindingSugar :: Parser () +parseAlphaBindingSugar = do + parseAlphaAttr + parseBindingArrow + +splitInput :: Parser a -> String -> [Either String (Tokens [Char])] +splitInput sep = splitCap (fst <$> match sep) + +addPrefix :: Parser a -> String -> [String] +addPrefix sep = map (either id ("~" <>)) . splitInput sep + +preprocess' :: Parser a -> String -> String +preprocess' sep = concat . addPrefix sep + +preprocess :: String -> String +preprocess = preprocess' parseAlphaBindingSugar + +input1 :: String +input1 = "{⟦ org ↦ ⟦ eolang ↦ ⟦ number( as-bytes, abra ) ↦ ⟦ φ ↦ ξ.as-bytes, neg ↦ ξ.times(-1), ⟧, λ ⤍ Package ⟧, λ ⤍ Package ⟧ ⟧}" + +-- >>> addPrefix parseAlphaBindingSugar input1 +-- ["{\10214 org \8614 \10214 eolang \8614 \10214 ","~number( as-bytes, abra ) \8614 ","\10214 \966 \8614 \958.as-bytes, neg \8614 \958.times(-1), \10215, \955 \10509 Package \10215, \955 \10509 Package \10215 \10215}"] + +-- >>> preprocess input1 +-- "{\10214 org \8614 \10214 eolang \8614 \10214 ~number( as-bytes, abra ) \8614 \10214 \966 \8614 \958.as-bytes, neg \8614 \958.times(-1), \10215, \955 \10509 Package \10215, \955 \10509 Package \10215 \10215}" diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs index bdfba2208..fc1ee0c92 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs @@ -128,7 +128,9 @@ withSubObject f ctx root = MetaContextualize _ _ -> [] ConstString{} -> [] ConstInt{} -> [] + ConstIntRaw{} -> [] ConstFloat{} -> [] + ConstFloatRaw{} -> [] -- | Given a unary function that operates only on plain objects, -- converts it to a function that operates on named objects @@ -154,6 +156,7 @@ withSubObjectBindings f ctx (b : bs) = withSubObjectBinding :: (Context -> Object -> [(String, Object)]) -> Context -> Binding -> [(String, Binding)] withSubObjectBinding f ctx = \case AlphaBinding a obj -> propagateName1 (AlphaBinding a) <$> withSubObject f (ctx{currentAttr = a}) obj + b@AlphaBindingSugar{} -> expectedDesugaredBinding b EmptyBinding{} -> [] DeltaBinding{} -> [] DeltaEmptyBinding{} -> [] @@ -204,7 +207,9 @@ objectSize = \case obj@MetaTailContext{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@ConstString{} -> objectSize (desugar obj) obj@ConstInt{} -> objectSize (desugar obj) + obj@ConstIntRaw{} -> objectSize (desugar obj) obj@ConstFloat{} -> objectSize (desugar obj) + obj@ConstFloatRaw{} -> objectSize (desugar obj) bindingSize :: Binding -> Int bindingSize = \case @@ -215,6 +220,7 @@ bindingSize = \case LambdaBinding _lam -> 1 obj@MetaDeltaBinding{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@MetaBindings{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) + b@AlphaBindingSugar{} -> expectedDesugaredBinding b -- | A variant of `applyRules` with a maximum application depth. applyRulesWith :: ApplicationLimits -> Context -> Object -> [Object] @@ -257,6 +263,7 @@ equalBindings bindings1 bindings2 = and (zipWith equalBinding (sortOn attr bindi attr (MetaDeltaBinding _) = Label (LabelId "Δ") attr (LambdaBinding _) = Label (LabelId "λ") attr (MetaBindings (BindingsMetaId metaId)) = MetaAttr (LabelMetaId metaId) + attr b@AlphaBindingSugar{} = expectedDesugaredBinding b equalBinding :: Binding -> Binding -> Bool equalBinding (AlphaBinding attr1 obj1) (AlphaBinding attr2 obj2) = attr1 == attr2 && equalObject obj1 obj2 diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs index 48f39f4c8..4f5bcaf81 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs @@ -215,4 +215,6 @@ fastYegorInsideOut ctx = \case MetaFunction{} -> error "impossible MetaFunction!" obj@ConstString{} -> obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstInt{} -> obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstIntRaw{} -> obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstFloat{} -> obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstFloatRaw{} -> obj -- fastYegorInsideOut ctx (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index a3f9d539c..24ec56726 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -241,7 +241,9 @@ objectLabelIds = \case MetaContextualize obj obj' -> objectLabelIds obj <> objectLabelIds obj' obj@ConstString{} -> objectLabelIds (desugar obj) obj@ConstInt{} -> objectLabelIds (desugar obj) + obj@ConstIntRaw{} -> objectLabelIds (desugar obj) obj@ConstFloat{} -> objectLabelIds (desugar obj) + obj@ConstFloatRaw{} -> objectLabelIds (desugar obj) bindingLabelIds :: Binding -> Set LabelId bindingLabelIds = \case @@ -252,6 +254,7 @@ bindingLabelIds = \case LambdaBinding _ -> mempty MetaBindings _ -> mempty MetaDeltaBinding _ -> mempty + b@AlphaBindingSugar{} -> expectedDesugaredBinding b attrLabelIds :: Attribute -> Set LabelId attrLabelIds (Label l) = Set.singleton l @@ -289,7 +292,9 @@ objectMetaIds (MetaSubstThis obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds (MetaContextualize obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds obj@ConstString{} = objectMetaIds (desugar obj) objectMetaIds obj@ConstInt{} = objectMetaIds (desugar obj) +objectMetaIds obj@ConstIntRaw{} = objectMetaIds (desugar obj) objectMetaIds obj@ConstFloat{} = objectMetaIds (desugar obj) +objectMetaIds obj@ConstFloatRaw{} = objectMetaIds (desugar obj) bindingMetaIds :: Binding -> Set MetaId bindingMetaIds (AlphaBinding attr obj) = attrMetaIds attr <> objectMetaIds obj @@ -299,6 +304,7 @@ bindingMetaIds DeltaEmptyBinding = mempty bindingMetaIds (LambdaBinding _) = mempty bindingMetaIds (MetaBindings x) = Set.singleton (MetaIdBindings x) bindingMetaIds (MetaDeltaBinding x) = Set.singleton (MetaIdBytes x) +bindingMetaIds b@AlphaBindingSugar{} = expectedDesugaredBinding b attrMetaIds :: Attribute -> Set MetaId attrMetaIds Phi = mempty @@ -306,6 +312,7 @@ attrMetaIds Rho = mempty attrMetaIds (Label _) = mempty attrMetaIds (Alpha _) = mempty attrMetaIds (MetaAttr x) = Set.singleton (MetaIdLabel x) +attrMetaIds a@(AttrSugar{}) = error ("impossible: expected desugared attribute, but got: " <> printTree a) objectHasMetavars :: Object -> Bool objectHasMetavars (Formation bindings) = any bindingHasMetavars bindings @@ -322,7 +329,9 @@ objectHasMetavars (MetaSubstThis _ _) = True -- technically not a metavar, but a objectHasMetavars (MetaContextualize _ _) = True objectHasMetavars obj@ConstString{} = objectHasMetavars (desugar obj) objectHasMetavars obj@ConstInt{} = objectHasMetavars (desugar obj) +objectHasMetavars obj@ConstIntRaw{} = objectHasMetavars (desugar obj) objectHasMetavars obj@ConstFloat{} = objectHasMetavars (desugar obj) +objectHasMetavars obj@ConstFloatRaw{} = objectHasMetavars (desugar obj) bindingHasMetavars :: Binding -> Bool bindingHasMetavars (AlphaBinding attr obj) = attrHasMetavars attr || objectHasMetavars obj @@ -332,6 +341,7 @@ bindingHasMetavars DeltaEmptyBinding = False bindingHasMetavars (LambdaBinding _) = False bindingHasMetavars (MetaBindings _) = True bindingHasMetavars (MetaDeltaBinding _) = True +bindingHasMetavars b@AlphaBindingSugar{} = expectedDesugaredBinding b attrHasMetavars :: Attribute -> Bool attrHasMetavars Phi = False @@ -339,6 +349,7 @@ attrHasMetavars Rho = False attrHasMetavars (Label _) = False attrHasMetavars (Alpha _) = False attrHasMetavars (MetaAttr _) = True +attrHasMetavars b@AttrSugar{} = error ("impossible: expected desugared attribute, but got: " <> printTree b) -- | Given a condition, and a substition from object matching -- tells whether the condition matches the object @@ -454,7 +465,9 @@ applySubst subst@Subst{..} = \case in applySubst holeSubst contextObject obj@ConstString{} -> applySubst subst (desugar obj) obj@ConstInt{} -> applySubst subst (desugar obj) + obj@ConstIntRaw{} -> applySubst subst (desugar obj) obj@ConstFloat{} -> applySubst subst (desugar obj) + obj@ConstFloatRaw{} -> applySubst subst (desugar obj) applySubstAttr :: Subst -> Attribute -> Attribute applySubstAttr Subst{..} = \case @@ -475,6 +488,7 @@ applySubstBinding subst@Subst{..} = \case LambdaBinding bytes -> [LambdaBinding (coerce bytes)] b@(MetaBindings m) -> fromMaybe [b] (lookup m bindingsMetas) b@(MetaDeltaBinding m) -> maybe [b] (pure . DeltaBinding) (lookup m bytesMetas) + b@AlphaBindingSugar{} -> expectedDesugaredBinding b mergeSubst :: Subst -> Subst -> Subst mergeSubst (Subst xs ys zs ws us) (Subst xs' ys' zs' ws' us') = @@ -525,7 +539,9 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart Termination -> [] ConstString{} -> [] ConstInt{} -> [] + ConstIntRaw{} -> [] ConstFloat{} -> [] + ConstFloatRaw{} -> [] -- TODO #617:30m Should cases below be errors? GlobalObjectPhiOrg -> [] MetaSubstThis{} -> [] @@ -643,12 +659,17 @@ substThis thisObj = go obj@MetaFunction{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@ConstString{} -> obj obj@ConstInt{} -> obj + obj@ConstIntRaw{} -> obj obj@ConstFloat{} -> obj + obj@ConstFloatRaw{} -> obj -- {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b ⟧.a ⟧.c ⟧.φ, λ ⤍ Package ⟧} -- {⟦ λ ⤍ Package, x ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧} +-- >>> "{⟦ λ ⤍ Package, x(t) ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧}" :: Program +-- Program [LambdaBinding (Function "Package"),AlphaBinding (AttrSugar (LabelId "x") [LabelId "t"]) (Formation [AlphaBinding (Label (LabelId "b")) (Formation [])])] + substThisBinding :: Object -> Binding -> Binding substThisBinding obj = \case AlphaBinding a obj' -> AlphaBinding a (substThis obj obj') @@ -658,6 +679,7 @@ substThisBinding obj = \case LambdaBinding bytes -> LambdaBinding bytes b@MetaBindings{} -> error ("impossible: trying to substitute ξ in " <> printTree b) b@MetaDeltaBinding{} -> error ("impossible: trying to substitute ξ in " <> printTree b) + b@AlphaBindingSugar{} -> expectedDesugaredBinding b contextualize :: Object -> Object -> Object contextualize thisObj = go @@ -677,7 +699,9 @@ contextualize thisObj = go obj@MetaFunction{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@ConstString{} -> go (desugar obj) obj@ConstInt{} -> go (desugar obj) + obj@ConstIntRaw{} -> go (desugar obj) obj@ConstFloat{} -> go (desugar obj) + obj@ConstFloatRaw{} -> go (desugar obj) contextualizeBinding :: Object -> Binding -> Binding contextualizeBinding obj = \case @@ -688,3 +712,4 @@ contextualizeBinding obj = \case LambdaBinding bytes -> LambdaBinding bytes b@MetaBindings{} -> error ("impossible: trying to contextualize " <> printTree b) b@MetaDeltaBinding{} -> error ("impossible: trying to contextualize " <> printTree b) + b@AlphaBindingSugar{} -> expectedDesugaredBinding b diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 11f3550ad..b381611d1 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -21,10 +21,14 @@ -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. {- FOURMOLU_ENABLE -} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE InstanceSigs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ViewPatterns #-} +{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} {-# OPTIONS_GHC -Wno-orphans #-} module Language.EO.Phi.Syntax ( @@ -74,6 +78,8 @@ module Language.EO.Phi.Syntax ( paddedLeftChunksOf, normalizeBytes, parseWith, + expectedDesugaredObject, + expectedDesugaredBinding, ) where import Data.ByteString (ByteString) @@ -86,6 +92,7 @@ import Data.String (IsString (fromString)) import Data.Text qualified as Text import Data.Text.Encoding qualified as Text import GHC.Float (isDoubleFinite) +import Language.EO.Phi.Preprocess (preprocess) import Language.EO.Phi.Syntax.Abs import Language.EO.Phi.Syntax.Lex (Token) import Language.EO.Phi.Syntax.Par @@ -99,16 +106,82 @@ import Text.Read (readMaybe) -- >>> :set -XOverloadedStrings -- >>> :set -XOverloadedLists +expectedDesugaredObject :: Object -> a +expectedDesugaredObject x = error ("impossible: expected desugared Object, but got: " <> printTree x) + +expectedDesugaredBinding :: Binding -> a +expectedDesugaredBinding x = error ("impossible: expected desugared Binding, but got: " <> printTree x) + +class DesugarableSimple a where + desugarSimple :: a -> a + +instance DesugarableSimple Object where + desugarSimple :: Object -> Object + desugarSimple = \case + obj@(ConstString{}) -> obj + obj@(ConstInt{}) -> obj + ConstIntRaw (IntegerSigned x) -> ConstInt (read x) + obj@(ConstFloat{}) -> obj + ConstFloatRaw (DoubleSigned x) -> ConstFloat (read x) + Formation bindings -> Formation (zipWith desugarBindingSimple [0 ..] bindings) + Application obj bindings -> Application (desugarSimple obj) (zipWith desugarBindingSimple [0 ..] bindings) + ObjectDispatch obj a -> ObjectDispatch (desugarSimple obj) a + GlobalObject -> GlobalObject + GlobalObjectPhiOrg -> "Φ.org.eolang" + ThisObject -> ThisObject + Termination -> Termination + MetaSubstThis obj this -> MetaSubstThis (desugarSimple obj) (desugarSimple this) + obj@MetaObject{} -> obj + MetaContextualize obj1 obj2 -> MetaContextualize (desugarSimple obj1) (desugarSimple obj2) + MetaTailContext obj metaId -> MetaTailContext (desugarSimple obj) metaId + MetaFunction name obj -> MetaFunction name (desugarSimple obj) + +desugarBindingSimple :: Int -> Binding -> Binding +desugarBindingSimple idx = \case + AlphaBinding (AttrSugar l ls) (Formation bindings) -> + let bindingsDesugared = desugarBindingSimple (error "no ID should be here") <$> bindings + in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) + AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) + AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarSimple obj) + binding -> binding + +instance DesugarableSimple Program where + desugarSimple :: Program -> Program + desugarSimple (Program bindings) = Program bindings' + where + ~(Formation bindings') = desugarSimple (Formation bindings) + +instance DesugarableSimple Binding where + desugarSimple = \case + obj@AlphaBindingSugar{} -> expectedDesugaredBinding obj + AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) + obj -> obj + +-- FIXME I hope these instances aren't used + +instance DesugarableSimple Attribute where + desugarSimple = id +instance DesugarableSimple RuleAttribute where + desugarSimple = id +instance DesugarableSimple PeeledObject where + desugarSimple = id +instance DesugarableSimple ObjectHead where + desugarSimple = id +instance DesugarableSimple MetaId where + desugarSimple = id + desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) ConstInt n -> wrapBytesInInt (intToBytes (fromInteger n)) + obj@ConstIntRaw{} -> expectedDesugaredObject obj ConstFloat x -> wrapBytesInFloat (floatToBytes x) - Formation bindings -> Formation (map desugarBinding bindings) - Application obj bindings -> Application (desugar obj) (map desugarBinding bindings) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj + Formation bindings -> Formation (desugarBinding <$> bindings) + Application obj bindings -> Application (desugar obj) (desugarBinding <$> bindings) ObjectDispatch obj a -> ObjectDispatch (desugar obj) a GlobalObject -> GlobalObject - GlobalObjectPhiOrg -> ObjectDispatch (ObjectDispatch GlobalObject (Label (LabelId "org"))) (Label (LabelId "eolang")) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj ThisObject -> ThisObject Termination -> Termination MetaSubstThis obj this -> MetaSubstThis (desugar obj) (desugar this) @@ -119,7 +192,11 @@ desugar = \case desugarBinding :: Binding -> Binding desugarBinding = \case + AlphaBinding (AttrSugar l ls) (Formation bindings) -> + let bindingsDesugared = desugarBinding <$> bindings + in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugar obj) + obj@(AlphaBindingSugar{}) -> expectedDesugaredBinding obj binding -> binding -- MetaSubstThis @@ -597,6 +674,14 @@ bytesToFloat (Bytes bytes) = dashToSpace '-' = ' ' dashToSpace c = c +-- >>> "{⟦ org ↦ ⟦ eolang ↦ ⟦ number(as-bytes) ↦ ⟦ φ ↦ ξ.as-bytes, neg ↦ ξ.times(-1), ⟧, λ ⤍ Package ⟧, λ ⤍ Package ⟧ ⟧}" :: Program +-- syntax error at line 1, column 76 due to lexer error +-- on the input: +-- {⟦ org ↦ ⟦ eolang ↦ ⟦ ~number(as-bytes) ↦ ⟦ φ ↦ ξ.as-bytes, neg ↦ ξ.times(-1), ⟧, λ ⤍ Package ⟧, λ ⤍ Package ⟧ ⟧} + +-- >>> "-1.0" :: Object +-- ConstFloatRaw (DoubleSigned "-1.0") + instance IsString Program where fromString = unsafeParseWith pProgram instance IsString Object where fromString = unsafeParseWith pObject instance IsString Binding where fromString = unsafeParseWith pBinding @@ -604,18 +689,18 @@ instance IsString Attribute where fromString = unsafeParseWith pAttribute instance IsString RuleAttribute where fromString = unsafeParseWith pRuleAttribute instance IsString PeeledObject where fromString = unsafeParseWith pPeeledObject instance IsString ObjectHead where fromString = unsafeParseWith pObjectHead - instance IsString MetaId where fromString = unsafeParseWith pMetaId -parseWith :: ([Token] -> Either String a) -> String -> Either String a -parseWith parser input = either (\x -> Left [fmt|{x}\non the input:\n{input}|]) Right parsed +parseWith :: (DesugarableSimple a) => ([Token] -> Either String a) -> String -> Either String a +parseWith parser input = either (\x -> Left [fmt|{x}\non the input:\n{input'}|]) (Right . desugarSimple) parsed where - tokens = myLexer input + input' = preprocess input + tokens = myLexer input' parsed = parser tokens -- | Parse a 'Object' from a 'String'. -- May throw an 'error` if input has a syntactical or lexical errors. -unsafeParseWith :: ([Token] -> Either String a) -> String -> a +unsafeParseWith :: (DesugarableSimple a) => ([Token] -> Either String a) -> String -> a unsafeParseWith parser input = case parseWith parser input of Left parseError -> error parseError diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index 869204e9c..c37148960 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -25,16 +25,18 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} module Language.EO.Phi.ToLaTeX where import Data.Foldable (fold) -import Data.List (intersperse) +import Data.List (intercalate, intersperse) import Data.String (IsString) import Data.Text qualified as T import Language.EO.Phi import Language.EO.Phi.Rules.Yaml +import PyF (fmt) import Text.Regex (mkRegex, subRegex) newtype LaTeX = LaTeX {unLaTeX :: String} @@ -58,6 +60,9 @@ instance ToLatex Attribute where toLatex (Alpha (AlphaIndex a)) = LaTeX ("\\alpha_" ++ tail a) toLatex (Label (LabelId l)) = LaTeX l toLatex (MetaAttr (LabelMetaId l)) = LaTeX l + toLatex (AttrSugar (LabelId l) ls) = LaTeX [fmt|{l}({ls'})|] + where + ls' = intercalate ", " ((\(LabelId l') -> l') <$> ls) instance ToLatex Binding where toLatex (AlphaBinding attr obj) = toLatex attr <> " -> " <> toLatex obj @@ -67,6 +72,7 @@ instance ToLatex Binding where toLatex (LambdaBinding (Function fn)) = "L> " <> LaTeX fn toLatex (MetaBindings (BindingsMetaId x)) = LaTeX x toLatex (MetaDeltaBinding (BytesMetaId x)) = "D> " <> LaTeX x + toLatex b@AlphaBindingSugar{} = expectedDesugaredBinding b instance ToLatex Object where toLatex (Formation bindings) = @@ -86,7 +92,9 @@ instance ToLatex Object where toLatex (MetaContextualize obj1 obj2) = LaTeX "\\lceil" <> toLatex obj1 <> ", " <> toLatex obj2 <> "\\rceil" toLatex (ConstString string) = "|" <> LaTeX (show string) <> "|" toLatex (ConstInt n) = LaTeX (show n) + toLatex (ConstIntRaw{}) = error "rendering ConstIntRaw in LaTex format" toLatex (ConstFloat x) = LaTeX (show x) + toLatex (ConstFloatRaw{}) = error "rendering ConstFloatRaw in LaTex format" removeOrgEolang :: String -> String removeOrgEolang = T.unpack . T.replace "Q.org.eolang" "QQ" . T.pack diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 1eb55293f..d7b83f383 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -48,10 +48,11 @@ import GHC.Generics (Generic) import Language.EO.Phi.Dataize.Context (defaultContext) import Language.EO.Phi.Rules.Common (ApplicationLimits (..), NamedRule, applyOneRule, defaultApplicationLimits, equalObject, objectSize) import Language.EO.Phi.Rules.Yaml (convertRuleNamed, parseRuleSetFromFile, rules) -import Language.EO.Phi.Syntax (intToBytes, printTree) +import Language.EO.Phi.Syntax (intToBytes, printTree, expectedDesugaredBinding) import Language.EO.Phi.Syntax.Abs as Phi import Test.Hspec import Test.QuickCheck +import Test.QuickCheck.Gen (genDouble) arbitraryNonEmptyString :: Gen String arbitraryNonEmptyString = do @@ -75,6 +76,10 @@ instance Arbitrary Bytes where arbitrary = intToBytes <$> arbitrarySizedNatural instance Arbitrary Phi.Function where arbitrary = Phi.Function <$> arbitraryNonEmptyString +instance Arbitrary DoubleSigned where + arbitrary = DoubleSigned <$> show . ((*) 1000) <$> genDouble +instance Arbitrary IntegerSigned where + arbitrary = IntegerSigned <$> show <$> chooseInteger (-1000000, 1000000) instance Arbitrary Phi.ObjectMetaId where arbitrary = Phi.ObjectMetaId . ("!b" ++) <$> arbitraryNonEmptyString @@ -142,6 +147,7 @@ bindingAttr = \case LambdaBinding{} -> Label "λ" MetaDeltaBinding{} -> Label "Δ" MetaBindings{} -> error "attempting to retrieve attribute of meta bindings" + b@AlphaBindingSugar{} -> expectedDesugaredBinding b arbitraryBindings :: Gen [Binding] arbitraryBindings = From 7e1e7c4cd8d5f5542515ed261613ba56a645dead Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:30:34 +0300 Subject: [PATCH 16/69] fix(eo-phi-normalizer): temporarily disable the test that hangs --- .../src/Language/EO/Phi/Syntax.hs | 2 - .../test/eo/phi/dataization.yaml | 39 ++++++++++--------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index b381611d1..8fa615810 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -157,8 +157,6 @@ instance DesugarableSimple Binding where AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) obj -> obj --- FIXME I hope these instances aren't used - instance DesugarableSimple Attribute where desugarSimple = id instance DesugarableSimple RuleAttribute where diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index f58dfe588..4791a3e3a 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -139,25 +139,26 @@ tests: object: | ⟦ a ↦ ⟦ Δ ⤍ 02- ⟧, x ↦ ⟦ Δ ⤍ 02- ⟧, λ ⤍ Package ⟧ - - name: "ξ in application" - dependencies: [] - input: | - {⟦ x ↦ ⟦ a ↦ ∅ ⟧(a ↦ ξ.b), b ↦ ⟦ Δ ⤍ 01- ⟧ , λ ⤍ Package ⟧} - output: - object: | - ⟦ x ↦ ⟦ - a ↦ ⟦ - Δ ⤍ 01-, - ρ ↦ ⟦ - b ↦ ⟦ Δ ⤍ 01- ⟧, - x ↦ ⟦ a ↦ ∅ ⟧ (a ↦ ξ.b), - λ ⤍ Package - ⟧ - ⟧ - ⟧, - b ↦ ⟦ Δ ⤍ 01- ⟧, - λ ⤍ Package - ⟧ + # TODO #636:30min hangs + # - name: "ξ in application" + # dependencies: [] + # input: | + # {⟦ x ↦ ⟦ a ↦ ∅ ⟧(a ↦ ξ.b), b ↦ ⟦ Δ ⤍ 01- ⟧ , λ ⤍ Package ⟧} + # output: + # object: | + # ⟦ x ↦ ⟦ + # a ↦ ⟦ + # Δ ⤍ 01-, + # ρ ↦ ⟦ + # b ↦ ⟦ Δ ⤍ 01- ⟧, + # x ↦ ⟦ a ↦ ∅ ⟧ (a ↦ ξ.b), + # λ ⤍ Package + # ⟧ + # ⟧ + # ⟧, + # b ↦ ⟦ Δ ⤍ 01- ⟧, + # λ ⤍ Package + # ⟧ - name: "ξ chain" dependencies: [] From 22054f383cc556c759af8031014a17e6ca84ca8c Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:33:31 +0300 Subject: [PATCH 17/69] fix(eo-phi-normalizer): make fourmolu happy --- eo-phi-normalizer/app/Main.hs | 2 +- eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index cf60c4de4..1dcd21707 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -83,7 +83,7 @@ import Language.EO.Phi.Rules.Common (ApplicationLimits (ApplicationLimits), Cont import Language.EO.Phi.Rules.Fast (fastYegorInsideOut, fastYegorInsideOutAsRule) import Language.EO.Phi.Rules.RunYegor (yegorRuleSet) import Language.EO.Phi.Rules.Yaml (RuleSet (rules, title), convertRuleNamed, parseRuleSetFromFile) -import Language.EO.Phi.Syntax (desugar, wrapBytesInBytes, wrapTermination, expectedDesugaredObject) +import Language.EO.Phi.Syntax (desugar, expectedDesugaredObject, wrapBytesInBytes, wrapTermination) import Language.EO.Phi.ToLaTeX import Language.EO.Test.YamlSpec (spec) import Options.Applicative hiding (metavar) diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index d7b83f383..e6cf784ca 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -48,7 +48,7 @@ import GHC.Generics (Generic) import Language.EO.Phi.Dataize.Context (defaultContext) import Language.EO.Phi.Rules.Common (ApplicationLimits (..), NamedRule, applyOneRule, defaultApplicationLimits, equalObject, objectSize) import Language.EO.Phi.Rules.Yaml (convertRuleNamed, parseRuleSetFromFile, rules) -import Language.EO.Phi.Syntax (intToBytes, printTree, expectedDesugaredBinding) +import Language.EO.Phi.Syntax (expectedDesugaredBinding, intToBytes, printTree) import Language.EO.Phi.Syntax.Abs as Phi import Test.Hspec import Test.QuickCheck From fb60ee4e00eeb1c2ea03b339bb99de585d376903 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:37:20 +0300 Subject: [PATCH 18/69] fix(eo-phi-normalizer): add copyright note --- .../src/Language/EO/Phi/Preprocess.hs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs b/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs index 03021807d..0252b0ad7 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs @@ -1,3 +1,26 @@ +{- FOURMOLU_DISABLE -} +-- The MIT License (MIT) + +-- Copyright (c) 2016-2024 Objectionary.com + +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: + +-- The above copyright notice and this permission notice shall be included +-- in all copies or substantial portions of the Software. + +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-- SOFTWARE. +{- FOURMOLU_ENABLE -} {-# LANGUAGE BlockArguments #-} module Language.EO.Phi.Preprocess where From 304d75a4b3574b57cba3b1e1a2eba46e280da775 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 00:42:02 +0300 Subject: [PATCH 19/69] refactor(eo-phi-normalizer): apply hlint suggestions --- eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index e6cf784ca..03430c5e4 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -77,9 +77,9 @@ instance Arbitrary Bytes where instance Arbitrary Phi.Function where arbitrary = Phi.Function <$> arbitraryNonEmptyString instance Arbitrary DoubleSigned where - arbitrary = DoubleSigned <$> show . ((*) 1000) <$> genDouble + arbitrary = DoubleSigned <$> show . (1000 *) <$> genDouble instance Arbitrary IntegerSigned where - arbitrary = IntegerSigned <$> show <$> chooseInteger (-1000000, 1000000) + arbitrary = IntegerSigned . show <$> chooseInteger (-1_000_000, 1_000_000) instance Arbitrary Phi.ObjectMetaId where arbitrary = Phi.ObjectMetaId . ("!b" ++) <$> arbitraryNonEmptyString From 54a32afdfad2ad020ef18aeaabf351485003067c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 23 Dec 2024 21:49:20 +0000 Subject: [PATCH 20/69] Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.49.1/org/eolang/number.phi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi index b25b8d652..18ff8c183 100644 --- a/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi +++ b/eo-phi-normalizer/data/0.49.1/org/eolang/number.phi @@ -71,4 +71,4 @@ ⟧, λ ⤍ Package ⟧ -⟧} +⟧} \ No newline at end of file From 9a3248acc34e9f17f31157227612fe5bfe8a6dda Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 15:21:58 +0300 Subject: [PATCH 21/69] fix(eo-phi-normalizer): error in more cases when a desugared object is expected --- .../src/Language/EO/Phi/Normalize.hs | 6 +-- .../src/Language/EO/Phi/Rules/Common.hs | 12 +++--- .../src/Language/EO/Phi/Rules/Fast.hs | 7 ++-- .../src/Language/EO/Phi/Rules/Yaml.hs | 42 +++++++++---------- .../src/Language/EO/Phi/ToLaTeX.hs | 4 +- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs index b828e3998..e5b04e637 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs @@ -38,7 +38,7 @@ import Data.Maybe (fromMaybe) import Data.Generics.Labels () import GHC.Generics (Generic) import Language.EO.Phi.Rules.Common (lookupBinding, objectBindings) -import Language.EO.Phi.Syntax (desugar) +import Language.EO.Phi.Syntax (desugar, expectedDesugaredObject) import Language.EO.Phi.Syntax.Abs data Context = Context @@ -81,9 +81,9 @@ peelObject = \case MetaContextualize{} -> error "impossible" obj@ConstString{} -> peelObject (desugar obj) obj@ConstInt{} -> peelObject (desugar obj) - obj@ConstIntRaw{} -> peelObject (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> peelObject (desugar obj) - obj@ConstFloatRaw{} -> peelObject (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj where followedBy (PeeledObject object actions) action = PeeledObject object (actions ++ [action]) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs index fc1ee0c92..a4f324e29 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs @@ -118,7 +118,7 @@ withSubObject f ctx root = ] ObjectDispatch obj a -> propagateName2 ObjectDispatch <$> withSubObject f subctx obj <*> pure a GlobalObject{} -> [] - GlobalObjectPhiOrg{} -> [] + obj@GlobalObjectPhiOrg{} -> expectedDesugaredObject obj ThisObject{} -> [] Termination -> [] MetaObject _ -> [] @@ -128,9 +128,9 @@ withSubObject f ctx root = MetaContextualize _ _ -> [] ConstString{} -> [] ConstInt{} -> [] - ConstIntRaw{} -> [] + obj@ConstIntRaw{} -> expectedDesugaredObject obj ConstFloat{} -> [] - ConstFloatRaw{} -> [] + obj@ConstFloatRaw{} -> expectedDesugaredObject obj -- | Given a unary function that operates only on plain objects, -- converts it to a function that operates on named objects @@ -197,7 +197,7 @@ objectSize = \case -- Is it because we sometimes bounce between sugared and desugared versions? -- -- Should we introduce a smart constructor with a desugared object inside? - obj@GlobalObjectPhiOrg -> objectSize (desugar obj) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj ThisObject -> 1 Termination -> 1 obj@MetaObject{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) @@ -207,9 +207,9 @@ objectSize = \case obj@MetaTailContext{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@ConstString{} -> objectSize (desugar obj) obj@ConstInt{} -> objectSize (desugar obj) - obj@ConstIntRaw{} -> objectSize (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> objectSize (desugar obj) - obj@ConstFloatRaw{} -> objectSize (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj bindingSize :: Binding -> Int bindingSize = \case diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs index 4f5bcaf81..af0aed3d9 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs @@ -205,8 +205,7 @@ fastYegorInsideOut ctx = \case AlphaBinding a (fastYegorInsideOut ctx' objA) _ -> binding ] - -- TODO #617:30m Should this be error? - obj@GlobalObjectPhiOrg -> fastYegorInsideOut ctx (desugar obj) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj Termination -> Termination MetaSubstThis{} -> error "impossible MetaSubstThis!" MetaContextualize{} -> error "impossible MetaContextualize!" @@ -215,6 +214,6 @@ fastYegorInsideOut ctx = \case MetaFunction{} -> error "impossible MetaFunction!" obj@ConstString{} -> obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstInt{} -> obj -- fastYegorInsideOut ctx (desugar obj) - obj@ConstIntRaw{} -> obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstFloat{} -> obj -- fastYegorInsideOut ctx (desugar obj) - obj@ConstFloatRaw{} -> obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index 24ec56726..1d31522b4 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -228,7 +228,7 @@ usedLabelIds Context{..} = objectLabelIds globalObject objectLabelIds :: Object -> Set LabelId objectLabelIds = \case GlobalObject -> mempty - obj@GlobalObjectPhiOrg -> objectLabelIds (desugar obj) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj ThisObject -> mempty Formation bindings -> foldMap bindingLabelIds bindings ObjectDispatch obj a -> objectLabelIds obj <> attrLabelIds a @@ -241,9 +241,9 @@ objectLabelIds = \case MetaContextualize obj obj' -> objectLabelIds obj <> objectLabelIds obj' obj@ConstString{} -> objectLabelIds (desugar obj) obj@ConstInt{} -> objectLabelIds (desugar obj) - obj@ConstIntRaw{} -> objectLabelIds (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> objectLabelIds (desugar obj) - obj@ConstFloatRaw{} -> objectLabelIds (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj bindingLabelIds :: Binding -> Set LabelId bindingLabelIds = \case @@ -282,7 +282,7 @@ objectMetaIds (Formation bindings) = foldMap bindingMetaIds bindings objectMetaIds (Application object bindings) = objectMetaIds object <> foldMap bindingMetaIds bindings objectMetaIds (ObjectDispatch object attr) = objectMetaIds object <> attrMetaIds attr objectMetaIds GlobalObject = mempty -objectMetaIds GlobalObjectPhiOrg = mempty +objectMetaIds obj@GlobalObjectPhiOrg = expectedDesugaredObject obj objectMetaIds ThisObject = mempty objectMetaIds Termination = mempty objectMetaIds (MetaObject x) = Set.singleton (MetaIdObject x) @@ -292,9 +292,9 @@ objectMetaIds (MetaSubstThis obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds (MetaContextualize obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds obj@ConstString{} = objectMetaIds (desugar obj) objectMetaIds obj@ConstInt{} = objectMetaIds (desugar obj) -objectMetaIds obj@ConstIntRaw{} = objectMetaIds (desugar obj) +objectMetaIds obj@ConstIntRaw{} = expectedDesugaredObject obj objectMetaIds obj@ConstFloat{} = objectMetaIds (desugar obj) -objectMetaIds obj@ConstFloatRaw{} = objectMetaIds (desugar obj) +objectMetaIds obj@ConstFloatRaw{} = expectedDesugaredObject obj bindingMetaIds :: Binding -> Set MetaId bindingMetaIds (AlphaBinding attr obj) = attrMetaIds attr <> objectMetaIds obj @@ -319,7 +319,7 @@ objectHasMetavars (Formation bindings) = any bindingHasMetavars bindings objectHasMetavars (Application object bindings) = objectHasMetavars object || any bindingHasMetavars bindings objectHasMetavars (ObjectDispatch object attr) = objectHasMetavars object || attrHasMetavars attr objectHasMetavars GlobalObject = False -objectHasMetavars GlobalObjectPhiOrg = False +objectHasMetavars obj@GlobalObjectPhiOrg = expectedDesugaredObject obj objectHasMetavars ThisObject = False objectHasMetavars Termination = False objectHasMetavars (MetaObject _) = True @@ -329,9 +329,9 @@ objectHasMetavars (MetaSubstThis _ _) = True -- technically not a metavar, but a objectHasMetavars (MetaContextualize _ _) = True objectHasMetavars obj@ConstString{} = objectHasMetavars (desugar obj) objectHasMetavars obj@ConstInt{} = objectHasMetavars (desugar obj) -objectHasMetavars obj@ConstIntRaw{} = objectHasMetavars (desugar obj) +objectHasMetavars obj@ConstIntRaw{} = expectedDesugaredObject obj objectHasMetavars obj@ConstFloat{} = objectHasMetavars (desugar obj) -objectHasMetavars obj@ConstFloatRaw{} = objectHasMetavars (desugar obj) +objectHasMetavars obj@ConstFloatRaw{} = expectedDesugaredObject obj bindingHasMetavars :: Binding -> Bool bindingHasMetavars (AlphaBinding attr obj) = attrHasMetavars attr || objectHasMetavars obj @@ -450,7 +450,7 @@ applySubst subst@Subst{..} = \case ObjectDispatch obj a -> ObjectDispatch (applySubst subst obj) (applySubstAttr subst a) GlobalObject -> GlobalObject - obj@GlobalObjectPhiOrg -> applySubst subst (desugar obj) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj ThisObject -> ThisObject obj@(MetaObject x) -> fromMaybe obj $ lookup x objectMetas Termination -> Termination @@ -465,9 +465,9 @@ applySubst subst@Subst{..} = \case in applySubst holeSubst contextObject obj@ConstString{} -> applySubst subst (desugar obj) obj@ConstInt{} -> applySubst subst (desugar obj) - obj@ConstIntRaw{} -> applySubst subst (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> applySubst subst (desugar obj) - obj@ConstFloatRaw{} -> applySubst subst (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj applySubstAttr :: Subst -> Attribute -> Attribute applySubstAttr Subst{..} = \case @@ -539,11 +539,11 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart Termination -> [] ConstString{} -> [] ConstInt{} -> [] - ConstIntRaw{} -> [] + ConstIntRaw{} -> expectedDesugaredObject obj ConstFloat{} -> [] - ConstFloatRaw{} -> [] + ConstFloatRaw{} -> expectedDesugaredObject obj -- TODO #617:30m Should cases below be errors? - GlobalObjectPhiOrg -> [] + GlobalObjectPhiOrg -> expectedDesugaredObject obj MetaSubstThis{} -> [] MetaContextualize{} -> [] MetaObject{} -> [] @@ -650,7 +650,7 @@ substThis thisObj = go Application obj bindings -> Application (go obj) (map (substThisBinding thisObj) bindings) ObjectDispatch obj a -> ObjectDispatch (go obj) a GlobalObject -> GlobalObject - obj@GlobalObjectPhiOrg -> go (desugar obj) + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) @@ -659,9 +659,9 @@ substThis thisObj = go obj@MetaFunction{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@ConstString{} -> obj obj@ConstInt{} -> obj - obj@ConstIntRaw{} -> obj + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> obj - obj@ConstFloatRaw{} -> obj + obj@ConstFloatRaw{} -> expectedDesugaredObject obj -- {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b ⟧.a ⟧.c ⟧.φ, λ ⤍ Package ⟧} @@ -690,7 +690,7 @@ contextualize thisObj = go ObjectDispatch obj a -> ObjectDispatch (go obj) a Application obj bindings -> Application (go obj) (map (contextualizeBinding thisObj) bindings) GlobalObject -> GlobalObject -- TODO: Change to what GlobalObject is attached to - obj@GlobalObjectPhiOrg -> go (desugar obj) -- TODO: Change to what GlobalObject is attached to + obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to contextualize " <> printTree obj) @@ -699,9 +699,9 @@ contextualize thisObj = go obj@MetaFunction{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@ConstString{} -> go (desugar obj) obj@ConstInt{} -> go (desugar obj) - obj@ConstIntRaw{} -> go (desugar obj) + obj@ConstIntRaw{} -> expectedDesugaredObject obj obj@ConstFloat{} -> go (desugar obj) - obj@ConstFloatRaw{} -> go (desugar obj) + obj@ConstFloatRaw{} -> expectedDesugaredObject obj contextualizeBinding :: Object -> Binding -> Binding contextualizeBinding obj = \case diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index c37148960..292e1ea2f 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -92,9 +92,9 @@ instance ToLatex Object where toLatex (MetaContextualize obj1 obj2) = LaTeX "\\lceil" <> toLatex obj1 <> ", " <> toLatex obj2 <> "\\rceil" toLatex (ConstString string) = "|" <> LaTeX (show string) <> "|" toLatex (ConstInt n) = LaTeX (show n) - toLatex (ConstIntRaw{}) = error "rendering ConstIntRaw in LaTex format" + toLatex obj@(ConstIntRaw{}) = expectedDesugaredObject obj toLatex (ConstFloat x) = LaTeX (show x) - toLatex (ConstFloatRaw{}) = error "rendering ConstFloatRaw in LaTex format" + toLatex obj@(ConstFloatRaw{}) = expectedDesugaredObject obj removeOrgEolang :: String -> String removeOrgEolang = T.unpack . T.replace "Q.org.eolang" "QQ" . T.pack From 23e80527898a757e630af274ca62790fe4f14973 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 15:25:52 +0300 Subject: [PATCH 22/69] refactor(eo-phi-normalizer): rename --- eo-phi-normalizer/app/Main.hs | 6 +-- .../src/Language/EO/Phi/Dataize.hs | 4 +- .../src/Language/EO/Phi/Dependencies.hs | 2 +- .../src/Language/EO/Phi/Normalize.hs | 6 +-- .../src/Language/EO/Phi/Rules/Common.hs | 18 +++---- .../src/Language/EO/Phi/Rules/Fast.hs | 6 +-- .../src/Language/EO/Phi/Rules/Yaml.hs | 54 +++++++++---------- .../src/Language/EO/Phi/Syntax.hs | 22 ++++---- .../src/Language/EO/Phi/ToLaTeX.hs | 6 +-- .../test/Language/EO/Rules/PhiPaperSpec.hs | 4 +- 10 files changed, 64 insertions(+), 64 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 1dcd21707..35a514c11 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -83,7 +83,7 @@ import Language.EO.Phi.Rules.Common (ApplicationLimits (ApplicationLimits), Cont import Language.EO.Phi.Rules.Fast (fastYegorInsideOut, fastYegorInsideOutAsRule) import Language.EO.Phi.Rules.RunYegor (yegorRuleSet) import Language.EO.Phi.Rules.Yaml (RuleSet (rules, title), convertRuleNamed, parseRuleSetFromFile) -import Language.EO.Phi.Syntax (desugar, expectedDesugaredObject, wrapBytesInBytes, wrapTermination) +import Language.EO.Phi.Syntax (desugar, errorExpectedDesugaredObject, wrapBytesInBytes, wrapTermination) import Language.EO.Phi.ToLaTeX import Language.EO.Test.YamlSpec (spec) import Options.Applicative hiding (metavar) @@ -570,9 +570,9 @@ wrapRawBytesIn = \case obj@MetaFunction{} -> obj obj@ConstString{} -> wrapRawBytesIn (desugar obj) obj@ConstInt{} -> wrapRawBytesIn (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> wrapRawBytesIn (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- * Main diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs index 63c27862f..c7f13c3db 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Dataize.hs @@ -47,9 +47,9 @@ desugarAsBytes :: Either Object Bytes -> Either Object Bytes desugarAsBytes (Left obj) = case obj of ConstString s -> Right (stringToBytes s) ConstInt n -> Right (intToBytes (fromInteger n)) - f@ConstIntRaw{} -> expectedDesugaredObject f + f@ConstIntRaw{} -> errorExpectedDesugaredObject f ConstFloat x -> Right (floatToBytes x) - f@ConstFloatRaw{} -> expectedDesugaredObject f + f@ConstFloatRaw{} -> errorExpectedDesugaredObject f _ -> Left obj desugarAsBytes (Right bytes) = Right bytes diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs b/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs index 903234364..1b80716c6 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Dependencies.hs @@ -37,7 +37,7 @@ bindingAttr DeltaEmptyBinding = Just (Alpha (AlphaIndex "Δ")) bindingAttr LambdaBinding{} = Just (Alpha (AlphaIndex "λ")) bindingAttr MetaBindings{} = Nothing bindingAttr MetaDeltaBinding{} = Nothing -bindingAttr b@(AlphaBindingSugar{}) = expectedDesugaredBinding b +bindingAttr b@(AlphaBindingSugar{}) = errorExpectedDesugaredBinding b zipBindings :: [Binding] -> [Binding] -> ([Binding], [(Binding, Binding)]) zipBindings xs ys = (xs' <> ys', collisions) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs index e5b04e637..9ecba29b3 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs @@ -38,7 +38,7 @@ import Data.Maybe (fromMaybe) import Data.Generics.Labels () import GHC.Generics (Generic) import Language.EO.Phi.Rules.Common (lookupBinding, objectBindings) -import Language.EO.Phi.Syntax (desugar, expectedDesugaredObject) +import Language.EO.Phi.Syntax (desugar, errorExpectedDesugaredObject) import Language.EO.Phi.Syntax.Abs data Context = Context @@ -81,9 +81,9 @@ peelObject = \case MetaContextualize{} -> error "impossible" obj@ConstString{} -> peelObject (desugar obj) obj@ConstInt{} -> peelObject (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> peelObject (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj where followedBy (PeeledObject object actions) action = PeeledObject object (actions ++ [action]) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs index a4f324e29..a5e621285 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs @@ -118,7 +118,7 @@ withSubObject f ctx root = ] ObjectDispatch obj a -> propagateName2 ObjectDispatch <$> withSubObject f subctx obj <*> pure a GlobalObject{} -> [] - obj@GlobalObjectPhiOrg{} -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg{} -> errorExpectedDesugaredObject obj ThisObject{} -> [] Termination -> [] MetaObject _ -> [] @@ -128,9 +128,9 @@ withSubObject f ctx root = MetaContextualize _ _ -> [] ConstString{} -> [] ConstInt{} -> [] - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- | Given a unary function that operates only on plain objects, -- converts it to a function that operates on named objects @@ -156,7 +156,7 @@ withSubObjectBindings f ctx (b : bs) = withSubObjectBinding :: (Context -> Object -> [(String, Object)]) -> Context -> Binding -> [(String, Binding)] withSubObjectBinding f ctx = \case AlphaBinding a obj -> propagateName1 (AlphaBinding a) <$> withSubObject f (ctx{currentAttr = a}) obj - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b EmptyBinding{} -> [] DeltaBinding{} -> [] DeltaEmptyBinding{} -> [] @@ -197,7 +197,7 @@ objectSize = \case -- Is it because we sometimes bounce between sugared and desugared versions? -- -- Should we introduce a smart constructor with a desugared object inside? - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj ThisObject -> 1 Termination -> 1 obj@MetaObject{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) @@ -207,9 +207,9 @@ objectSize = \case obj@MetaTailContext{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@ConstString{} -> objectSize (desugar obj) obj@ConstInt{} -> objectSize (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> objectSize (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj bindingSize :: Binding -> Int bindingSize = \case @@ -220,7 +220,7 @@ bindingSize = \case LambdaBinding _lam -> 1 obj@MetaDeltaBinding{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@MetaBindings{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b -- | A variant of `applyRules` with a maximum application depth. applyRulesWith :: ApplicationLimits -> Context -> Object -> [Object] @@ -263,7 +263,7 @@ equalBindings bindings1 bindings2 = and (zipWith equalBinding (sortOn attr bindi attr (MetaDeltaBinding _) = Label (LabelId "Δ") attr (LambdaBinding _) = Label (LabelId "λ") attr (MetaBindings (BindingsMetaId metaId)) = MetaAttr (LabelMetaId metaId) - attr b@AlphaBindingSugar{} = expectedDesugaredBinding b + attr b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b equalBinding :: Binding -> Binding -> Bool equalBinding (AlphaBinding attr1 obj1) (AlphaBinding attr2 obj2) = attr1 == attr2 && equalObject obj1 obj2 diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs index af0aed3d9..58c0a2ff6 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs @@ -205,7 +205,7 @@ fastYegorInsideOut ctx = \case AlphaBinding a (fastYegorInsideOut ctx' objA) _ -> binding ] - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj Termination -> Termination MetaSubstThis{} -> error "impossible MetaSubstThis!" MetaContextualize{} -> error "impossible MetaContextualize!" @@ -214,6 +214,6 @@ fastYegorInsideOut ctx = \case MetaFunction{} -> error "impossible MetaFunction!" obj@ConstString{} -> obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstInt{} -> obj -- fastYegorInsideOut ctx (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstFloat{} -> obj -- fastYegorInsideOut ctx (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index 1d31522b4..a4d5aec1d 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -228,7 +228,7 @@ usedLabelIds Context{..} = objectLabelIds globalObject objectLabelIds :: Object -> Set LabelId objectLabelIds = \case GlobalObject -> mempty - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj ThisObject -> mempty Formation bindings -> foldMap bindingLabelIds bindings ObjectDispatch obj a -> objectLabelIds obj <> attrLabelIds a @@ -241,9 +241,9 @@ objectLabelIds = \case MetaContextualize obj obj' -> objectLabelIds obj <> objectLabelIds obj' obj@ConstString{} -> objectLabelIds (desugar obj) obj@ConstInt{} -> objectLabelIds (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> objectLabelIds (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj bindingLabelIds :: Binding -> Set LabelId bindingLabelIds = \case @@ -254,7 +254,7 @@ bindingLabelIds = \case LambdaBinding _ -> mempty MetaBindings _ -> mempty MetaDeltaBinding _ -> mempty - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b attrLabelIds :: Attribute -> Set LabelId attrLabelIds (Label l) = Set.singleton l @@ -282,7 +282,7 @@ objectMetaIds (Formation bindings) = foldMap bindingMetaIds bindings objectMetaIds (Application object bindings) = objectMetaIds object <> foldMap bindingMetaIds bindings objectMetaIds (ObjectDispatch object attr) = objectMetaIds object <> attrMetaIds attr objectMetaIds GlobalObject = mempty -objectMetaIds obj@GlobalObjectPhiOrg = expectedDesugaredObject obj +objectMetaIds obj@GlobalObjectPhiOrg = errorExpectedDesugaredObject obj objectMetaIds ThisObject = mempty objectMetaIds Termination = mempty objectMetaIds (MetaObject x) = Set.singleton (MetaIdObject x) @@ -292,9 +292,9 @@ objectMetaIds (MetaSubstThis obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds (MetaContextualize obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds obj@ConstString{} = objectMetaIds (desugar obj) objectMetaIds obj@ConstInt{} = objectMetaIds (desugar obj) -objectMetaIds obj@ConstIntRaw{} = expectedDesugaredObject obj +objectMetaIds obj@ConstIntRaw{} = errorExpectedDesugaredObject obj objectMetaIds obj@ConstFloat{} = objectMetaIds (desugar obj) -objectMetaIds obj@ConstFloatRaw{} = expectedDesugaredObject obj +objectMetaIds obj@ConstFloatRaw{} = errorExpectedDesugaredObject obj bindingMetaIds :: Binding -> Set MetaId bindingMetaIds (AlphaBinding attr obj) = attrMetaIds attr <> objectMetaIds obj @@ -304,7 +304,7 @@ bindingMetaIds DeltaEmptyBinding = mempty bindingMetaIds (LambdaBinding _) = mempty bindingMetaIds (MetaBindings x) = Set.singleton (MetaIdBindings x) bindingMetaIds (MetaDeltaBinding x) = Set.singleton (MetaIdBytes x) -bindingMetaIds b@AlphaBindingSugar{} = expectedDesugaredBinding b +bindingMetaIds b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b attrMetaIds :: Attribute -> Set MetaId attrMetaIds Phi = mempty @@ -319,7 +319,7 @@ objectHasMetavars (Formation bindings) = any bindingHasMetavars bindings objectHasMetavars (Application object bindings) = objectHasMetavars object || any bindingHasMetavars bindings objectHasMetavars (ObjectDispatch object attr) = objectHasMetavars object || attrHasMetavars attr objectHasMetavars GlobalObject = False -objectHasMetavars obj@GlobalObjectPhiOrg = expectedDesugaredObject obj +objectHasMetavars obj@GlobalObjectPhiOrg = errorExpectedDesugaredObject obj objectHasMetavars ThisObject = False objectHasMetavars Termination = False objectHasMetavars (MetaObject _) = True @@ -329,9 +329,9 @@ objectHasMetavars (MetaSubstThis _ _) = True -- technically not a metavar, but a objectHasMetavars (MetaContextualize _ _) = True objectHasMetavars obj@ConstString{} = objectHasMetavars (desugar obj) objectHasMetavars obj@ConstInt{} = objectHasMetavars (desugar obj) -objectHasMetavars obj@ConstIntRaw{} = expectedDesugaredObject obj +objectHasMetavars obj@ConstIntRaw{} = errorExpectedDesugaredObject obj objectHasMetavars obj@ConstFloat{} = objectHasMetavars (desugar obj) -objectHasMetavars obj@ConstFloatRaw{} = expectedDesugaredObject obj +objectHasMetavars obj@ConstFloatRaw{} = errorExpectedDesugaredObject obj bindingHasMetavars :: Binding -> Bool bindingHasMetavars (AlphaBinding attr obj) = attrHasMetavars attr || objectHasMetavars obj @@ -341,7 +341,7 @@ bindingHasMetavars DeltaEmptyBinding = False bindingHasMetavars (LambdaBinding _) = False bindingHasMetavars (MetaBindings _) = True bindingHasMetavars (MetaDeltaBinding _) = True -bindingHasMetavars b@AlphaBindingSugar{} = expectedDesugaredBinding b +bindingHasMetavars b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b attrHasMetavars :: Attribute -> Bool attrHasMetavars Phi = False @@ -450,7 +450,7 @@ applySubst subst@Subst{..} = \case ObjectDispatch obj a -> ObjectDispatch (applySubst subst obj) (applySubstAttr subst a) GlobalObject -> GlobalObject - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj ThisObject -> ThisObject obj@(MetaObject x) -> fromMaybe obj $ lookup x objectMetas Termination -> Termination @@ -465,9 +465,9 @@ applySubst subst@Subst{..} = \case in applySubst holeSubst contextObject obj@ConstString{} -> applySubst subst (desugar obj) obj@ConstInt{} -> applySubst subst (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> applySubst subst (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj applySubstAttr :: Subst -> Attribute -> Attribute applySubstAttr Subst{..} = \case @@ -488,7 +488,7 @@ applySubstBinding subst@Subst{..} = \case LambdaBinding bytes -> [LambdaBinding (coerce bytes)] b@(MetaBindings m) -> fromMaybe [b] (lookup m bindingsMetas) b@(MetaDeltaBinding m) -> maybe [b] (pure . DeltaBinding) (lookup m bytesMetas) - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b mergeSubst :: Subst -> Subst -> Subst mergeSubst (Subst xs ys zs ws us) (Subst xs' ys' zs' ws' us') = @@ -539,11 +539,11 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart Termination -> [] ConstString{} -> [] ConstInt{} -> [] - ConstIntRaw{} -> expectedDesugaredObject obj + ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] - ConstFloatRaw{} -> expectedDesugaredObject obj + ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- TODO #617:30m Should cases below be errors? - GlobalObjectPhiOrg -> expectedDesugaredObject obj + GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj MetaSubstThis{} -> [] MetaContextualize{} -> [] MetaObject{} -> [] @@ -650,7 +650,7 @@ substThis thisObj = go Application obj bindings -> Application (go obj) (map (substThisBinding thisObj) bindings) ObjectDispatch obj a -> ObjectDispatch (go obj) a GlobalObject -> GlobalObject - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) @@ -659,9 +659,9 @@ substThis thisObj = go obj@MetaFunction{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@ConstString{} -> obj obj@ConstInt{} -> obj - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> obj - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b ⟧.a ⟧.c ⟧.φ, λ ⤍ Package ⟧} @@ -679,7 +679,7 @@ substThisBinding obj = \case LambdaBinding bytes -> LambdaBinding bytes b@MetaBindings{} -> error ("impossible: trying to substitute ξ in " <> printTree b) b@MetaDeltaBinding{} -> error ("impossible: trying to substitute ξ in " <> printTree b) - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b contextualize :: Object -> Object -> Object contextualize thisObj = go @@ -690,7 +690,7 @@ contextualize thisObj = go ObjectDispatch obj a -> ObjectDispatch (go obj) a Application obj bindings -> Application (go obj) (map (contextualizeBinding thisObj) bindings) GlobalObject -> GlobalObject -- TODO: Change to what GlobalObject is attached to - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to contextualize " <> printTree obj) @@ -699,9 +699,9 @@ contextualize thisObj = go obj@MetaFunction{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@ConstString{} -> go (desugar obj) obj@ConstInt{} -> go (desugar obj) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> go (desugar obj) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj contextualizeBinding :: Object -> Binding -> Binding contextualizeBinding obj = \case @@ -712,4 +712,4 @@ contextualizeBinding obj = \case LambdaBinding bytes -> LambdaBinding bytes b@MetaBindings{} -> error ("impossible: trying to contextualize " <> printTree b) b@MetaDeltaBinding{} -> error ("impossible: trying to contextualize " <> printTree b) - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 8fa615810..947d69799 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -78,8 +78,8 @@ module Language.EO.Phi.Syntax ( paddedLeftChunksOf, normalizeBytes, parseWith, - expectedDesugaredObject, - expectedDesugaredBinding, + errorExpectedDesugaredObject, + errorExpectedDesugaredBinding, ) where import Data.ByteString (ByteString) @@ -106,11 +106,11 @@ import Text.Read (readMaybe) -- >>> :set -XOverloadedStrings -- >>> :set -XOverloadedLists -expectedDesugaredObject :: Object -> a -expectedDesugaredObject x = error ("impossible: expected desugared Object, but got: " <> printTree x) +errorExpectedDesugaredObject :: Object -> a +errorExpectedDesugaredObject x = error ("impossible: expected desugared Object, but got: " <> printTree x) -expectedDesugaredBinding :: Binding -> a -expectedDesugaredBinding x = error ("impossible: expected desugared Binding, but got: " <> printTree x) +errorExpectedDesugaredBinding :: Binding -> a +errorExpectedDesugaredBinding x = error ("impossible: expected desugared Binding, but got: " <> printTree x) class DesugarableSimple a where desugarSimple :: a -> a @@ -153,7 +153,7 @@ instance DesugarableSimple Program where instance DesugarableSimple Binding where desugarSimple = \case - obj@AlphaBindingSugar{} -> expectedDesugaredBinding obj + obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) obj -> obj @@ -172,14 +172,14 @@ desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) ConstInt n -> wrapBytesInInt (intToBytes (fromInteger n)) - obj@ConstIntRaw{} -> expectedDesugaredObject obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat x -> wrapBytesInFloat (floatToBytes x) - obj@ConstFloatRaw{} -> expectedDesugaredObject obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj Formation bindings -> Formation (desugarBinding <$> bindings) Application obj bindings -> Application (desugar obj) (desugarBinding <$> bindings) ObjectDispatch obj a -> ObjectDispatch (desugar obj) a GlobalObject -> GlobalObject - obj@GlobalObjectPhiOrg -> expectedDesugaredObject obj + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj ThisObject -> ThisObject Termination -> Termination MetaSubstThis obj this -> MetaSubstThis (desugar obj) (desugar this) @@ -194,7 +194,7 @@ desugarBinding = \case let bindingsDesugared = desugarBinding <$> bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugar obj) - obj@(AlphaBindingSugar{}) -> expectedDesugaredBinding obj + obj@(AlphaBindingSugar{}) -> errorExpectedDesugaredBinding obj binding -> binding -- MetaSubstThis diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index 292e1ea2f..3b084236d 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -72,7 +72,7 @@ instance ToLatex Binding where toLatex (LambdaBinding (Function fn)) = "L> " <> LaTeX fn toLatex (MetaBindings (BindingsMetaId x)) = LaTeX x toLatex (MetaDeltaBinding (BytesMetaId x)) = "D> " <> LaTeX x - toLatex b@AlphaBindingSugar{} = expectedDesugaredBinding b + toLatex b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b instance ToLatex Object where toLatex (Formation bindings) = @@ -92,9 +92,9 @@ instance ToLatex Object where toLatex (MetaContextualize obj1 obj2) = LaTeX "\\lceil" <> toLatex obj1 <> ", " <> toLatex obj2 <> "\\rceil" toLatex (ConstString string) = "|" <> LaTeX (show string) <> "|" toLatex (ConstInt n) = LaTeX (show n) - toLatex obj@(ConstIntRaw{}) = expectedDesugaredObject obj + toLatex obj@(ConstIntRaw{}) = errorExpectedDesugaredObject obj toLatex (ConstFloat x) = LaTeX (show x) - toLatex obj@(ConstFloatRaw{}) = expectedDesugaredObject obj + toLatex obj@(ConstFloatRaw{}) = errorExpectedDesugaredObject obj removeOrgEolang :: String -> String removeOrgEolang = T.unpack . T.replace "Q.org.eolang" "QQ" . T.pack diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 03430c5e4..629c4306d 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -48,7 +48,7 @@ import GHC.Generics (Generic) import Language.EO.Phi.Dataize.Context (defaultContext) import Language.EO.Phi.Rules.Common (ApplicationLimits (..), NamedRule, applyOneRule, defaultApplicationLimits, equalObject, objectSize) import Language.EO.Phi.Rules.Yaml (convertRuleNamed, parseRuleSetFromFile, rules) -import Language.EO.Phi.Syntax (expectedDesugaredBinding, intToBytes, printTree) +import Language.EO.Phi.Syntax (errorExpectedDesugaredBinding, intToBytes, printTree) import Language.EO.Phi.Syntax.Abs as Phi import Test.Hspec import Test.QuickCheck @@ -147,7 +147,7 @@ bindingAttr = \case LambdaBinding{} -> Label "λ" MetaDeltaBinding{} -> Label "Δ" MetaBindings{} -> error "attempting to retrieve attribute of meta bindings" - b@AlphaBindingSugar{} -> expectedDesugaredBinding b + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b arbitraryBindings :: Gen [Binding] arbitraryBindings = From 7176ef585acfa5028a5afee5fa2d7d0e2953e7e9 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 15:43:27 +0300 Subject: [PATCH 23/69] refactor(eo-phi-normalizer): rename --- .../src/Language/EO/Phi/Syntax.hs | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 947d69799..0e830b4cc 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -112,61 +112,61 @@ errorExpectedDesugaredObject x = error ("impossible: expected desugared Object, errorExpectedDesugaredBinding :: Binding -> a errorExpectedDesugaredBinding x = error ("impossible: expected desugared Binding, but got: " <> printTree x) -class DesugarableSimple a where - desugarSimple :: a -> a +class DesugarableInitially a where + desugarInitially :: a -> a -instance DesugarableSimple Object where - desugarSimple :: Object -> Object - desugarSimple = \case +instance DesugarableInitially Object where + desugarInitially :: Object -> Object + desugarInitially = \case obj@(ConstString{}) -> obj obj@(ConstInt{}) -> obj ConstIntRaw (IntegerSigned x) -> ConstInt (read x) obj@(ConstFloat{}) -> obj ConstFloatRaw (DoubleSigned x) -> ConstFloat (read x) Formation bindings -> Formation (zipWith desugarBindingSimple [0 ..] bindings) - Application obj bindings -> Application (desugarSimple obj) (zipWith desugarBindingSimple [0 ..] bindings) - ObjectDispatch obj a -> ObjectDispatch (desugarSimple obj) a + Application obj bindings -> Application (desugarInitially obj) (zipWith desugarBindingSimple [0 ..] bindings) + ObjectDispatch obj a -> ObjectDispatch (desugarInitially obj) a GlobalObject -> GlobalObject GlobalObjectPhiOrg -> "Φ.org.eolang" ThisObject -> ThisObject Termination -> Termination - MetaSubstThis obj this -> MetaSubstThis (desugarSimple obj) (desugarSimple this) + MetaSubstThis obj this -> MetaSubstThis (desugarInitially obj) (desugarInitially this) obj@MetaObject{} -> obj - MetaContextualize obj1 obj2 -> MetaContextualize (desugarSimple obj1) (desugarSimple obj2) - MetaTailContext obj metaId -> MetaTailContext (desugarSimple obj) metaId - MetaFunction name obj -> MetaFunction name (desugarSimple obj) + MetaContextualize obj1 obj2 -> MetaContextualize (desugarInitially obj1) (desugarInitially obj2) + MetaTailContext obj metaId -> MetaTailContext (desugarInitially obj) metaId + MetaFunction name obj -> MetaFunction name (desugarInitially obj) desugarBindingSimple :: Int -> Binding -> Binding desugarBindingSimple idx = \case AlphaBinding (AttrSugar l ls) (Formation bindings) -> let bindingsDesugared = desugarBindingSimple (error "no ID should be here") <$> bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) - AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) - AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarSimple obj) + AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) + AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarInitially obj) binding -> binding -instance DesugarableSimple Program where - desugarSimple :: Program -> Program - desugarSimple (Program bindings) = Program bindings' +instance DesugarableInitially Program where + desugarInitially :: Program -> Program + desugarInitially (Program bindings) = Program bindings' where - ~(Formation bindings') = desugarSimple (Formation bindings) + ~(Formation bindings') = desugarInitially (Formation bindings) -instance DesugarableSimple Binding where - desugarSimple = \case +instance DesugarableInitially Binding where + desugarInitially = \case obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj - AlphaBinding a obj -> AlphaBinding a (desugarSimple obj) + AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) obj -> obj -instance DesugarableSimple Attribute where - desugarSimple = id -instance DesugarableSimple RuleAttribute where - desugarSimple = id -instance DesugarableSimple PeeledObject where - desugarSimple = id -instance DesugarableSimple ObjectHead where - desugarSimple = id -instance DesugarableSimple MetaId where - desugarSimple = id +instance DesugarableInitially Attribute where + desugarInitially = id +instance DesugarableInitially RuleAttribute where + desugarInitially = id +instance DesugarableInitially PeeledObject where + desugarInitially = id +instance DesugarableInitially ObjectHead where + desugarInitially = id +instance DesugarableInitially MetaId where + desugarInitially = id desugar :: Object -> Object desugar = \case @@ -689,8 +689,8 @@ instance IsString PeeledObject where fromString = unsafeParseWith pPeeledObject instance IsString ObjectHead where fromString = unsafeParseWith pObjectHead instance IsString MetaId where fromString = unsafeParseWith pMetaId -parseWith :: (DesugarableSimple a) => ([Token] -> Either String a) -> String -> Either String a -parseWith parser input = either (\x -> Left [fmt|{x}\non the input:\n{input'}|]) (Right . desugarSimple) parsed +parseWith :: (DesugarableInitially a) => ([Token] -> Either String a) -> String -> Either String a +parseWith parser input = either (\x -> Left [fmt|{x}\non the input:\n{input'}|]) (Right . desugarInitially) parsed where input' = preprocess input tokens = myLexer input' @@ -698,7 +698,7 @@ parseWith parser input = either (\x -> Left [fmt|{x}\non the input:\n{input'}|]) -- | Parse a 'Object' from a 'String'. -- May throw an 'error` if input has a syntactical or lexical errors. -unsafeParseWith :: (DesugarableSimple a) => ([Token] -> Either String a) -> String -> a +unsafeParseWith :: (DesugarableInitially a) => ([Token] -> Either String a) -> String -> a unsafeParseWith parser input = case parseWith parser input of Left parseError -> error parseError From 4be09fd390a6f9737fa5aa4dc2d19af23acc0893 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 15:53:17 +0300 Subject: [PATCH 24/69] fix(eo-phi-normalizer): re-run bnfc --- eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs | 4 ++-- eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt | 6 +++--- eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x | 12 ++++++------ eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y | 8 ++++---- .../src/Language/EO/Phi/Syntax/Print.hs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index f964669e9..b92fbeee6 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs @@ -143,9 +143,9 @@ newtype BytesMetaId = BytesMetaId String newtype MetaFunctionName = MetaFunctionName String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) -newtype DoubleSigned = DoubleSigned String +newtype IntegerSigned = IntegerSigned String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) -newtype IntegerSigned = IntegerSigned String +newtype DoubleSigned = DoubleSigned String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt index ab5f82c84..803b9db59 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt @@ -76,12 +76,12 @@ MetaFunctionName literals are recognized by the regular expression `````'@' (char - [" !'(),-.:;?[]{|}⟦⟧"])*````` -DoubleSigned literals are recognized by the regular expression -`````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` - IntegerSigned literals are recognized by the regular expression `````'-'? digit+````` +DoubleSigned literals are recognized by the regular expression +`````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` + ===Reserved words and symbols=== The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions. diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x index c9111df46..90f1522e1 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x @@ -85,14 +85,14 @@ $s [$u # [\t \n \r \ \! \' \( \) \, \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * \@ [$u # [\t \n \r \ \! \' \( \) \, \- \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * { tok (eitherResIdent T_MetaFunctionName) } --- token DoubleSigned -\- ? $d + \. $d + (e \- ? $d +)? - { tok (eitherResIdent T_DoubleSigned) } - -- token IntegerSigned \- ? $d + { tok (eitherResIdent T_IntegerSigned) } +-- token DoubleSigned +\- ? $d + \. $d + (e \- ? $d +)? + { tok (eitherResIdent T_DoubleSigned) } + -- Keywords and Ident $l $i* { tok (eitherResIdent TV) } @@ -132,8 +132,8 @@ data Tok | T_ObjectMetaId !String | T_BytesMetaId !String | T_MetaFunctionName !String - | T_DoubleSigned !String | T_IntegerSigned !String + | T_DoubleSigned !String deriving (Eq, Show, Ord) -- | Smart constructor for 'Tok' for the sake of backwards compatibility. @@ -206,8 +206,8 @@ tokenText t = case t of PT _ (T_ObjectMetaId s) -> s PT _ (T_BytesMetaId s) -> s PT _ (T_MetaFunctionName s) -> s - PT _ (T_DoubleSigned s) -> s PT _ (T_IntegerSigned s) -> s + PT _ (T_DoubleSigned s) -> s -- | Convert a token to a string. prToken :: Token -> String diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index f11ca5326..fb0f57941 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y @@ -83,8 +83,8 @@ import Language.EO.Phi.Syntax.Lex L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } L_BytesMetaId { PT _ (T_BytesMetaId $$) } L_MetaFunctionName { PT _ (T_MetaFunctionName $$) } - L_DoubleSigned { PT _ (T_DoubleSigned $$) } L_IntegerSigned { PT _ (T_IntegerSigned $$) } + L_DoubleSigned { PT _ (T_DoubleSigned $$) } %% @@ -127,12 +127,12 @@ BytesMetaId : L_BytesMetaId { Language.EO.Phi.Syntax.Abs.BytesMetaId $1 } MetaFunctionName :: { Language.EO.Phi.Syntax.Abs.MetaFunctionName } MetaFunctionName : L_MetaFunctionName { Language.EO.Phi.Syntax.Abs.MetaFunctionName $1 } -DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } -DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } - IntegerSigned :: { Language.EO.Phi.Syntax.Abs.IntegerSigned } IntegerSigned : L_IntegerSigned { Language.EO.Phi.Syntax.Abs.IntegerSigned $1 } +DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } +DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } + Program :: { Language.EO.Phi.Syntax.Abs.Program } Program : '{' '⟦' ListBinding '⟧' '}' { Language.EO.Phi.Syntax.Abs.Program $3 } diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs index 19d1c25d2..778131c4d 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs @@ -190,10 +190,10 @@ instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where - prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where + prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.Program where prt i = \case Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")]) From fc0f05e84de77c26269253f312782fa9894271c9 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 15:58:52 +0300 Subject: [PATCH 25/69] refactor(eo-phi-normalizer): apply a suggestion by hlint --- eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 629c4306d..215014361 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -77,7 +77,7 @@ instance Arbitrary Bytes where instance Arbitrary Phi.Function where arbitrary = Phi.Function <$> arbitraryNonEmptyString instance Arbitrary DoubleSigned where - arbitrary = DoubleSigned <$> show . (1000 *) <$> genDouble + arbitrary = DoubleSigned . show . (1000 *) <$> genDouble instance Arbitrary IntegerSigned where arbitrary = IntegerSigned . show <$> chooseInteger (-1_000_000, 1_000_000) From 56add740fa53c243870a52dca8effe2a22f6cef2 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 18:14:39 +0300 Subject: [PATCH 26/69] refactor(eo-phi-normalizer): rename --- eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 0e830b4cc..ff224f851 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -123,8 +123,8 @@ instance DesugarableInitially Object where ConstIntRaw (IntegerSigned x) -> ConstInt (read x) obj@(ConstFloat{}) -> obj ConstFloatRaw (DoubleSigned x) -> ConstFloat (read x) - Formation bindings -> Formation (zipWith desugarBindingSimple [0 ..] bindings) - Application obj bindings -> Application (desugarInitially obj) (zipWith desugarBindingSimple [0 ..] bindings) + Formation bindings -> Formation (zipWith desugarBindingInitially [0 ..] bindings) + Application obj bindings -> Application (desugarInitially obj) (zipWith desugarBindingInitially [0 ..] bindings) ObjectDispatch obj a -> ObjectDispatch (desugarInitially obj) a GlobalObject -> GlobalObject GlobalObjectPhiOrg -> "Φ.org.eolang" @@ -136,10 +136,10 @@ instance DesugarableInitially Object where MetaTailContext obj metaId -> MetaTailContext (desugarInitially obj) metaId MetaFunction name obj -> MetaFunction name (desugarInitially obj) -desugarBindingSimple :: Int -> Binding -> Binding -desugarBindingSimple idx = \case +desugarBindingInitially :: Int -> Binding -> Binding +desugarBindingInitially idx = \case AlphaBinding (AttrSugar l ls) (Formation bindings) -> - let bindingsDesugared = desugarBindingSimple (error "no ID should be here") <$> bindings + let bindingsDesugared = desugarBindingInitially (error "no ID should be here") <$> bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarInitially obj) From e266b871eadda3a8624b1211187630527ecbfaae Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 18:31:47 +0300 Subject: [PATCH 27/69] refactor(eo-phi-normalizer): - add DesugarableInitially instance for [Binding] - combine remaining DesugarableInitially instances into one --- .../src/Language/EO/Phi/Syntax.hs | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index ff224f851..76aab92d8 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -123,8 +123,8 @@ instance DesugarableInitially Object where ConstIntRaw (IntegerSigned x) -> ConstInt (read x) obj@(ConstFloat{}) -> obj ConstFloatRaw (DoubleSigned x) -> ConstFloat (read x) - Formation bindings -> Formation (zipWith desugarBindingInitially [0 ..] bindings) - Application obj bindings -> Application (desugarInitially obj) (zipWith desugarBindingInitially [0 ..] bindings) + Formation bindings -> Formation (desugarInitially bindings) + Application obj bindings -> Application (desugarInitially obj) (desugarInitially bindings) ObjectDispatch obj a -> ObjectDispatch (desugarInitially obj) a GlobalObject -> GlobalObject GlobalObjectPhiOrg -> "Φ.org.eolang" @@ -136,20 +136,22 @@ instance DesugarableInitially Object where MetaTailContext obj metaId -> MetaTailContext (desugarInitially obj) metaId MetaFunction name obj -> MetaFunction name (desugarInitially obj) -desugarBindingInitially :: Int -> Binding -> Binding -desugarBindingInitially idx = \case - AlphaBinding (AttrSugar l ls) (Formation bindings) -> - let bindingsDesugared = desugarBindingInitially (error "no ID should be here") <$> bindings - in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) - AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) - AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarInitially obj) - binding -> binding +instance DesugarableInitially [Binding] where + desugarInitially :: [Binding] -> [Binding] + desugarInitially = zipWith go [0 ..] + where + go :: Int -> Binding -> Binding + go idx = \case + AlphaBinding (AttrSugar l ls) (Formation bindings) -> + let bindingsDesugared = desugarInitially bindings + in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) + AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) + AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarInitially obj) + binding -> binding instance DesugarableInitially Program where desugarInitially :: Program -> Program - desugarInitially (Program bindings) = Program bindings' - where - ~(Formation bindings') = desugarInitially (Formation bindings) + desugarInitially (Program bindings) = Program (desugarInitially bindings) instance DesugarableInitially Binding where desugarInitially = \case @@ -157,15 +159,7 @@ instance DesugarableInitially Binding where AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) obj -> obj -instance DesugarableInitially Attribute where - desugarInitially = id -instance DesugarableInitially RuleAttribute where - desugarInitially = id -instance DesugarableInitially PeeledObject where - desugarInitially = id -instance DesugarableInitially ObjectHead where - desugarInitially = id -instance DesugarableInitially MetaId where +instance {-# OVERLAPPABLE #-} DesugarableInitially a where desugarInitially = id desugar :: Object -> Object From a3ed8188b9fd6ac6cb31dc21fc6566e92e5117ca Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Tue, 24 Dec 2024 19:02:55 +0300 Subject: [PATCH 28/69] fix(eo-phi-normalizer): desugar more correctly --- eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 76aab92d8..631eaf434 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -146,7 +146,7 @@ instance DesugarableInitially [Binding] where let bindingsDesugared = desugarInitially bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) - AlphaBindingSugar obj -> AlphaBinding [fmt|α{idx}|] (desugarInitially obj) + AlphaBindingSugar obj -> AlphaBinding (Alpha (AlphaIndex [fmt|α{idx}|])) (desugarInitially obj) binding -> binding instance DesugarableInitially Program where From 5e752add6f4cb6b90407f1e78e74675e1cb22152 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 13:11:54 +0300 Subject: [PATCH 29/69] feat(eo-phi-normalizer): sugar expressions before printing --- .../src/Language/EO/Phi/Syntax.hs | 55 ++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 631eaf434..6c001f181 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -160,8 +160,59 @@ instance DesugarableInitially Binding where obj -> obj instance {-# OVERLAPPABLE #-} DesugarableInitially a where + desugarInitially :: a -> a desugarInitially = id +class SugarableFinally a where + sugarFinally :: a -> a + +instance SugarableFinally Object where + sugarFinally :: Object -> Object + sugarFinally = \case + "Φ.org.eolang" -> GlobalObjectPhiOrg + obj@ConstString{} -> obj + obj@ConstInt{} -> obj + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj + obj@ConstFloat{} -> obj + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj + Formation bindings -> Formation (sugarFinally <$> bindings) + Application obj bindings -> Application (sugarFinally obj) (sugarFinally bindings) + ObjectDispatch obj a -> ObjectDispatch (sugarFinally obj) a + GlobalObject -> GlobalObject + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj + ThisObject -> ThisObject + Termination -> Termination + MetaSubstThis obj this -> MetaSubstThis (sugarFinally obj) (sugarFinally this) + obj@MetaObject{} -> obj + MetaContextualize obj1 obj2 -> MetaContextualize (sugarFinally obj1) (sugarFinally obj2) + MetaTailContext obj metaId -> MetaTailContext (sugarFinally obj) metaId + MetaFunction name obj -> MetaFunction name (sugarFinally obj) + +instance SugarableFinally [Binding] where + sugarFinally :: [Binding] -> [Binding] + sugarFinally bs = + if and (zipWith go [0 ..] bs) + then (\(~(AlphaBinding _ obj)) -> AlphaBindingSugar (sugarFinally obj)) <$> bs + else sugarFinally <$> bs + where + go :: Int -> Binding -> Bool + go idx = \case + obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj + obj@(AlphaBinding (AttrSugar _ _) _) -> errorExpectedDesugaredBinding obj + AlphaBinding (Alpha (AlphaIndex ('α' : idx'))) _ -> idx == read idx' + _ -> False + +instance SugarableFinally Binding where + sugarFinally :: Binding -> Binding + sugarFinally = \case + obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj + AlphaBinding a obj -> AlphaBinding a (sugarFinally obj) + x -> x + +instance {-# OVERLAPPABLE #-} SugarableFinally a where + sugarFinally :: a -> a + sugarFinally = id + desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) @@ -253,8 +304,8 @@ wrapBytesAsBool bytes -- * Overriding generated pretty-printer -- | Like 'Phi.printTree', but without spaces around dots and no indentation for curly braces. -printTree :: (Phi.Print a) => a -> String -printTree = shrinkDots . render . Phi.prt 0 +printTree :: (Phi.Print a, SugarableFinally a) => a -> String +printTree = shrinkDots . render . Phi.prt 0 . sugarFinally -- | Remove spaces around dots. -- From 01a3217b42ab918603a17724a28bdf931c64e915 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 13:14:23 +0300 Subject: [PATCH 30/69] fix(eo-phi-normalizer): don't track the parser info file --- .gitignore | 1 + .../src/Language/EO/Phi/Syntax/Par.info | 1928 ----------------- 2 files changed, 1 insertion(+), 1928 deletions(-) delete mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info diff --git a/.gitignore b/.gitignore index dbc760e05..fdf5a29b7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test +eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info .cache/ .DS_Store dist diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info deleted file mode 100644 index 40333dd30..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info +++ /dev/null @@ -1,1928 +0,0 @@ ------------------------------------------------------------------------------ -Info file generated by Happy Version 1.20.1.1 from Par.y ------------------------------------------------------------------------------ - - -rule 12 is unused - ------------------------------------------------------------------------------ -Grammar ------------------------------------------------------------------------------ - %start_pProgram -> Program (0) - %start_pMetaId -> MetaId (1) - %start_pObject -> Object (2) - %start_pBinding -> Binding (3) - %start_pListBinding -> ListBinding (4) - %start_pAttribute -> Attribute (5) - %start_pListLabelId -> ListLabelId (6) - %start_pRuleAttribute -> RuleAttribute (7) - %start_pPeeledObject -> PeeledObject (8) - %start_pObjectHead -> ObjectHead (9) - %start_pObjectAction -> ObjectAction (10) - %start_pListObjectAction -> ListObjectAction (11) - Double -> L_doubl (12) - Integer -> L_integ (13) - String -> L_quoted (14) - Bytes -> L_Bytes (15) - Function -> L_Function (16) - LabelId -> L_LabelId (17) - AlphaIndex -> L_AlphaIndex (18) - LabelMetaId -> L_LabelMetaId (19) - TailMetaId -> L_TailMetaId (20) - BindingsMetaId -> L_BindingsMetaId (21) - ObjectMetaId -> L_ObjectMetaId (22) - BytesMetaId -> L_BytesMetaId (23) - MetaFunctionName -> L_MetaFunctionName (24) - DoubleSigned -> L_DoubleSigned (25) - Program -> '{' '⟦' ListBinding '⟧' '}' (26) - MetaId -> LabelMetaId (27) - MetaId -> TailMetaId (28) - MetaId -> BindingsMetaId (29) - MetaId -> ObjectMetaId (30) - MetaId -> BytesMetaId (31) - Object -> '⟦' ListBinding '⟧' (32) - Object -> Object '(' ListBinding ')' (33) - Object -> Object '.' Attribute (34) - Object -> 'Φ' (35) - Object -> 'Φ̇' (36) - Object -> 'ξ' (37) - Object -> '⊥' (38) - Object -> String (39) - Object -> Integer (40) - Object -> DoubleSigned (41) - Object -> Object '[' 'ξ' '↦' Object ']' (42) - Object -> '⌈' Object ',' Object '⌉' (43) - Object -> ObjectMetaId (44) - Object -> Object '*' TailMetaId (45) - Object -> MetaFunctionName '(' Object ')' (46) - Binding -> Attribute '↦' Object (47) - Binding -> Object (48) - Binding -> Attribute '↦' '∅' (49) - Binding -> 'Δ' '⤍' Bytes (50) - Binding -> 'Δ' '⤍' '∅' (51) - Binding -> 'λ' '⤍' Function (52) - Binding -> BindingsMetaId (53) - Binding -> 'Δ' '⤍' BytesMetaId (54) - ListBinding -> (55) - ListBinding -> Binding (56) - ListBinding -> Binding ',' ListBinding (57) - Attribute -> 'φ' (58) - Attribute -> 'ρ' (59) - Attribute -> LabelId (60) - Attribute -> AlphaIndex (61) - Attribute -> LabelMetaId (62) - Attribute -> '~' LabelId '(' ListLabelId ')' (63) - ListLabelId -> (64) - ListLabelId -> LabelId (65) - ListLabelId -> LabelId ',' ListLabelId (66) - RuleAttribute -> Attribute (67) - RuleAttribute -> 'Δ' (68) - RuleAttribute -> 'λ' (69) - PeeledObject -> ObjectHead ListObjectAction (70) - ObjectHead -> '⟦' ListBinding '⟧' (71) - ObjectHead -> 'Φ' (72) - ObjectHead -> 'ξ' (73) - ObjectHead -> '⊥' (74) - ObjectAction -> '(' ListBinding ')' (75) - ObjectAction -> '.' Attribute (76) - ListObjectAction -> (77) - ListObjectAction -> ObjectAction ListObjectAction (78) - ------------------------------------------------------------------------------ -Terminals ------------------------------------------------------------------------------ - '(' { PT _ (TS _ 1) } - ')' { PT _ (TS _ 2) } - '*' { PT _ (TS _ 3) } - ',' { PT _ (TS _ 4) } - '.' { PT _ (TS _ 5) } - '[' { PT _ (TS _ 6) } - ']' { PT _ (TS _ 7) } - '{' { PT _ (TS _ 8) } - '}' { PT _ (TS _ 9) } - '~' { PT _ (TS _ 10) } - 'Δ' { PT _ (TS _ 11) } - 'Φ' { PT _ (TS _ 12) } - 'Φ̇' { PT _ (TS _ 13) } - 'λ' { PT _ (TS _ 14) } - 'ξ' { PT _ (TS _ 15) } - 'ρ' { PT _ (TS _ 16) } - 'φ' { PT _ (TS _ 17) } - '↦' { PT _ (TS _ 18) } - '∅' { PT _ (TS _ 19) } - '⊥' { PT _ (TS _ 20) } - '⌈' { PT _ (TS _ 21) } - '⌉' { PT _ (TS _ 22) } - '⟦' { PT _ (TS _ 23) } - '⟧' { PT _ (TS _ 24) } - '⤍' { PT _ (TS _ 25) } - L_doubl { PT _ (TD $$) } - L_integ { PT _ (TI $$) } - L_quoted { PT _ (TL $$) } - L_Bytes { PT _ (T_Bytes $$) } - L_Function { PT _ (T_Function $$) } - L_LabelId { PT _ (T_LabelId $$) } - L_AlphaIndex { PT _ (T_AlphaIndex $$) } - L_LabelMetaId { PT _ (T_LabelMetaId $$) } - L_TailMetaId { PT _ (T_TailMetaId $$) } - L_BindingsMetaId{ PT _ (T_BindingsMetaId $$) } - L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } - L_BytesMetaId { PT _ (T_BytesMetaId $$) } - L_MetaFunctionName{ PT _ (T_MetaFunctionName $$) } - L_DoubleSigned { PT _ (T_DoubleSigned $$) } - ------------------------------------------------------------------------------ -Non-terminals ------------------------------------------------------------------------------ - %start_pProgram rule 0 - %start_pMetaId rule 1 - %start_pObject rule 2 - %start_pBinding rule 3 - %start_pListBinding rule 4 - %start_pAttribute rule 5 - %start_pListLabelId rule 6 - %start_pRuleAttribute rule 7 - %start_pPeeledObject rule 8 - %start_pObjectHead rule 9 - %start_pObjectAction rule 10 - %start_pListObjectAction rule 11 - Double rule 12 - Integer rule 13 - String rule 14 - Bytes rule 15 - Function rule 16 - LabelId rule 17 - AlphaIndex rule 18 - LabelMetaId rule 19 - TailMetaId rule 20 - BindingsMetaId rule 21 - ObjectMetaId rule 22 - BytesMetaId rule 23 - MetaFunctionName rule 24 - DoubleSigned rule 25 - Program rule 26 - MetaId rules 27, 28, 29, 30, 31 - Object rules 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 - Binding rules 47, 48, 49, 50, 51, 52, 53, 54 - ListBinding rules 55, 56, 57 - Attribute rules 58, 59, 60, 61, 62, 63 - ListLabelId rules 64, 65, 66 - RuleAttribute rules 67, 68, 69 - PeeledObject rule 70 - ObjectHead rules 71, 72, 73, 74 - ObjectAction rules 75, 76 - ListObjectAction rules 77, 78 - ------------------------------------------------------------------------------ -States ------------------------------------------------------------------------------ -State 0 - - %start_pProgram -> . Program (rule 0) - - '{' shift, and enter state 77 - - Program goto state 76 - -State 1 - - %start_pMetaId -> . MetaId (rule 1) - - L_LabelMetaId shift, and enter state 38 - L_TailMetaId shift, and enter state 74 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_BytesMetaId shift, and enter state 75 - - LabelMetaId goto state 68 - TailMetaId goto state 69 - BindingsMetaId goto state 70 - ObjectMetaId goto state 71 - BytesMetaId goto state 72 - MetaId goto state 73 - -State 2 - - %start_pObject -> . Object (rule 2) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 67 - -State 3 - - %start_pBinding -> . Binding (rule 3) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 66 - Attribute goto state 51 - -State 4 - - %start_pListBinding -> . ListBinding (rule 4) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - %eof reduce using rule 55 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 50 - Attribute goto state 51 - -State 5 - - %start_pAttribute -> . Attribute (rule 5) - - '~' shift, and enter state 31 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - Attribute goto state 41 - -State 6 - - %start_pListLabelId -> . ListLabelId (rule 6) - - L_LabelId shift, and enter state 36 - %eof reduce using rule 64 - - LabelId goto state 39 - ListLabelId goto state 40 - -State 7 - - %start_pRuleAttribute -> . RuleAttribute (rule 7) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 32 - 'λ' shift, and enter state 33 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - Attribute goto state 29 - RuleAttribute goto state 30 - -State 8 - - %start_pPeeledObject -> . PeeledObject (rule 8) - - 'Φ' shift, and enter state 20 - 'ξ' shift, and enter state 21 - '⊥' shift, and enter state 22 - '⟦' shift, and enter state 23 - - PeeledObject goto state 24 - ObjectHead goto state 25 - -State 9 - - %start_pObjectHead -> . ObjectHead (rule 9) - - 'Φ' shift, and enter state 20 - 'ξ' shift, and enter state 21 - '⊥' shift, and enter state 22 - '⟦' shift, and enter state 23 - - ObjectHead goto state 19 - -State 10 - - %start_pObjectAction -> . ObjectAction (rule 10) - - '(' shift, and enter state 16 - '.' shift, and enter state 17 - - ObjectAction goto state 18 - -State 11 - - %start_pListObjectAction -> . ListObjectAction (rule 11) - - '(' shift, and enter state 16 - '.' shift, and enter state 17 - %eof reduce using rule 77 - - ObjectAction goto state 14 - ListObjectActiongoto state 15 - -State 12 - - Double -> . L_doubl (rule 12) - - L_doubl shift, and enter state 13 - - -State 13 - - Double -> L_doubl . (rule 12) - - - -State 14 - - ListObjectAction -> ObjectAction . ListObjectAction (rule 78) - - '(' shift, and enter state 16 - '.' shift, and enter state 17 - %eof reduce using rule 77 - - ObjectAction goto state 14 - ListObjectActiongoto state 96 - -State 15 - - %start_pListObjectAction -> ListObjectAction . (rule 11) - - %eof accept - - -State 16 - - ObjectAction -> '(' . ListBinding ')' (rule 75) - - ')' reduce using rule 55 - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 95 - Attribute goto state 51 - -State 17 - - ObjectAction -> '.' . Attribute (rule 76) - - '~' shift, and enter state 31 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - Attribute goto state 94 - -State 18 - - %start_pObjectAction -> ObjectAction . (rule 10) - - %eof accept - - -State 19 - - %start_pObjectHead -> ObjectHead . (rule 9) - - %eof accept - - -State 20 - - ObjectHead -> 'Φ' . (rule 72) - - '(' reduce using rule 72 - '.' reduce using rule 72 - %eof reduce using rule 72 - - -State 21 - - ObjectHead -> 'ξ' . (rule 73) - - '(' reduce using rule 73 - '.' reduce using rule 73 - %eof reduce using rule 73 - - -State 22 - - ObjectHead -> '⊥' . (rule 74) - - '(' reduce using rule 74 - '.' reduce using rule 74 - %eof reduce using rule 74 - - -State 23 - - ObjectHead -> '⟦' . ListBinding '⟧' (rule 71) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - '⟧' reduce using rule 55 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 93 - Attribute goto state 51 - -State 24 - - %start_pPeeledObject -> PeeledObject . (rule 8) - - %eof accept - - -State 25 - - PeeledObject -> ObjectHead . ListObjectAction (rule 70) - - '(' shift, and enter state 16 - '.' shift, and enter state 17 - %eof reduce using rule 77 - - ObjectAction goto state 14 - ListObjectActiongoto state 92 - -State 26 - - Attribute -> LabelId . (rule 60) - - '(' reduce using rule 60 - ')' reduce using rule 60 - '*' reduce using rule 60 - ',' reduce using rule 60 - '.' reduce using rule 60 - '[' reduce using rule 60 - ']' reduce using rule 60 - '↦' reduce using rule 60 - '⌉' reduce using rule 60 - '⟧' reduce using rule 60 - %eof reduce using rule 60 - - -State 27 - - Attribute -> AlphaIndex . (rule 61) - - '(' reduce using rule 61 - ')' reduce using rule 61 - '*' reduce using rule 61 - ',' reduce using rule 61 - '.' reduce using rule 61 - '[' reduce using rule 61 - ']' reduce using rule 61 - '↦' reduce using rule 61 - '⌉' reduce using rule 61 - '⟧' reduce using rule 61 - %eof reduce using rule 61 - - -State 28 - - Attribute -> LabelMetaId . (rule 62) - - '(' reduce using rule 62 - ')' reduce using rule 62 - '*' reduce using rule 62 - ',' reduce using rule 62 - '.' reduce using rule 62 - '[' reduce using rule 62 - ']' reduce using rule 62 - '↦' reduce using rule 62 - '⌉' reduce using rule 62 - '⟧' reduce using rule 62 - %eof reduce using rule 62 - - -State 29 - - RuleAttribute -> Attribute . (rule 67) - - %eof reduce using rule 67 - - -State 30 - - %start_pRuleAttribute -> RuleAttribute . (rule 7) - - %eof accept - - -State 31 - - Attribute -> '~' . LabelId '(' ListLabelId ')' (rule 63) - - L_LabelId shift, and enter state 36 - - LabelId goto state 91 - -State 32 - - RuleAttribute -> 'Δ' . (rule 68) - - %eof reduce using rule 68 - - -State 33 - - RuleAttribute -> 'λ' . (rule 69) - - %eof reduce using rule 69 - - -State 34 - - Attribute -> 'ρ' . (rule 59) - - '(' reduce using rule 59 - ')' reduce using rule 59 - '*' reduce using rule 59 - ',' reduce using rule 59 - '.' reduce using rule 59 - '[' reduce using rule 59 - ']' reduce using rule 59 - '↦' reduce using rule 59 - '⌉' reduce using rule 59 - '⟧' reduce using rule 59 - %eof reduce using rule 59 - - -State 35 - - Attribute -> 'φ' . (rule 58) - - '(' reduce using rule 58 - ')' reduce using rule 58 - '*' reduce using rule 58 - ',' reduce using rule 58 - '.' reduce using rule 58 - '[' reduce using rule 58 - ']' reduce using rule 58 - '↦' reduce using rule 58 - '⌉' reduce using rule 58 - '⟧' reduce using rule 58 - %eof reduce using rule 58 - - -State 36 - - LabelId -> L_LabelId . (rule 17) - - '(' reduce using rule 17 - ')' reduce using rule 17 - '*' reduce using rule 17 - ',' reduce using rule 17 - '.' reduce using rule 17 - '[' reduce using rule 17 - ']' reduce using rule 17 - '↦' reduce using rule 17 - '⌉' reduce using rule 17 - '⟧' reduce using rule 17 - %eof reduce using rule 17 - - -State 37 - - AlphaIndex -> L_AlphaIndex . (rule 18) - - '(' reduce using rule 18 - ')' reduce using rule 18 - '*' reduce using rule 18 - ',' reduce using rule 18 - '.' reduce using rule 18 - '[' reduce using rule 18 - ']' reduce using rule 18 - '↦' reduce using rule 18 - '⌉' reduce using rule 18 - '⟧' reduce using rule 18 - %eof reduce using rule 18 - - -State 38 - - LabelMetaId -> L_LabelMetaId . (rule 19) - - '(' reduce using rule 19 - ')' reduce using rule 19 - '*' reduce using rule 19 - ',' reduce using rule 19 - '.' reduce using rule 19 - '[' reduce using rule 19 - ']' reduce using rule 19 - '↦' reduce using rule 19 - '⌉' reduce using rule 19 - '⟧' reduce using rule 19 - %eof reduce using rule 19 - - -State 39 - - ListLabelId -> LabelId . (rule 65) - ListLabelId -> LabelId . ',' ListLabelId (rule 66) - - ')' reduce using rule 65 - ',' shift, and enter state 90 - %eof reduce using rule 65 - - -State 40 - - %start_pListLabelId -> ListLabelId . (rule 6) - - %eof accept - - -State 41 - - %start_pAttribute -> Attribute . (rule 5) - - %eof accept - - -State 42 - - Object -> Integer . (rule 40) - - '(' reduce using rule 40 - ')' reduce using rule 40 - '*' reduce using rule 40 - ',' reduce using rule 40 - '.' reduce using rule 40 - '[' reduce using rule 40 - ']' reduce using rule 40 - '⌉' reduce using rule 40 - '⟧' reduce using rule 40 - %eof reduce using rule 40 - - -State 43 - - Object -> String . (rule 39) - - '(' reduce using rule 39 - ')' reduce using rule 39 - '*' reduce using rule 39 - ',' reduce using rule 39 - '.' reduce using rule 39 - '[' reduce using rule 39 - ']' reduce using rule 39 - '⌉' reduce using rule 39 - '⟧' reduce using rule 39 - %eof reduce using rule 39 - - -State 44 - - Binding -> BindingsMetaId . (rule 53) - - ')' reduce using rule 53 - ',' reduce using rule 53 - '⟧' reduce using rule 53 - %eof reduce using rule 53 - - -State 45 - - Object -> ObjectMetaId . (rule 44) - - '(' reduce using rule 44 - ')' reduce using rule 44 - '*' reduce using rule 44 - ',' reduce using rule 44 - '.' reduce using rule 44 - '[' reduce using rule 44 - ']' reduce using rule 44 - '⌉' reduce using rule 44 - '⟧' reduce using rule 44 - %eof reduce using rule 44 - - -State 46 - - Object -> MetaFunctionName . '(' Object ')' (rule 46) - - '(' shift, and enter state 89 - - -State 47 - - Object -> DoubleSigned . (rule 41) - - '(' reduce using rule 41 - ')' reduce using rule 41 - '*' reduce using rule 41 - ',' reduce using rule 41 - '.' reduce using rule 41 - '[' reduce using rule 41 - ']' reduce using rule 41 - '⌉' reduce using rule 41 - '⟧' reduce using rule 41 - %eof reduce using rule 41 - - -State 48 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> Object . '*' TailMetaId (rule 45) - Binding -> Object . (rule 48) - - '(' shift, and enter state 79 - ')' reduce using rule 48 - '*' shift, and enter state 80 - ',' reduce using rule 48 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - '⟧' reduce using rule 48 - %eof reduce using rule 48 - - -State 49 - - ListBinding -> Binding . (rule 56) - ListBinding -> Binding . ',' ListBinding (rule 57) - - ')' reduce using rule 56 - ',' shift, and enter state 88 - '⟧' reduce using rule 56 - %eof reduce using rule 56 - - -State 50 - - %start_pListBinding -> ListBinding . (rule 4) - - %eof accept - - -State 51 - - Binding -> Attribute . '↦' Object (rule 47) - Binding -> Attribute . '↦' '∅' (rule 49) - - '↦' shift, and enter state 87 - - -State 52 - - Binding -> 'Δ' . '⤍' Bytes (rule 50) - Binding -> 'Δ' . '⤍' '∅' (rule 51) - Binding -> 'Δ' . '⤍' BytesMetaId (rule 54) - - '⤍' shift, and enter state 86 - - -State 53 - - Object -> 'Φ' . (rule 35) - - '(' reduce using rule 35 - ')' reduce using rule 35 - '*' reduce using rule 35 - ',' reduce using rule 35 - '.' reduce using rule 35 - '[' reduce using rule 35 - ']' reduce using rule 35 - '⌉' reduce using rule 35 - '⟧' reduce using rule 35 - %eof reduce using rule 35 - - -State 54 - - Object -> 'Φ̇' . (rule 36) - - '(' reduce using rule 36 - ')' reduce using rule 36 - '*' reduce using rule 36 - ',' reduce using rule 36 - '.' reduce using rule 36 - '[' reduce using rule 36 - ']' reduce using rule 36 - '⌉' reduce using rule 36 - '⟧' reduce using rule 36 - %eof reduce using rule 36 - - -State 55 - - Binding -> 'λ' . '⤍' Function (rule 52) - - '⤍' shift, and enter state 85 - - -State 56 - - Object -> 'ξ' . (rule 37) - - '(' reduce using rule 37 - ')' reduce using rule 37 - '*' reduce using rule 37 - ',' reduce using rule 37 - '.' reduce using rule 37 - '[' reduce using rule 37 - ']' reduce using rule 37 - '⌉' reduce using rule 37 - '⟧' reduce using rule 37 - %eof reduce using rule 37 - - -State 57 - - Object -> '⊥' . (rule 38) - - '(' reduce using rule 38 - ')' reduce using rule 38 - '*' reduce using rule 38 - ',' reduce using rule 38 - '.' reduce using rule 38 - '[' reduce using rule 38 - ']' reduce using rule 38 - '⌉' reduce using rule 38 - '⟧' reduce using rule 38 - %eof reduce using rule 38 - - -State 58 - - Object -> '⌈' . Object ',' Object '⌉' (rule 43) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 84 - -State 59 - - Object -> '⟦' . ListBinding '⟧' (rule 32) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - '⟧' reduce using rule 55 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 83 - Attribute goto state 51 - -State 60 - - Integer -> L_integ . (rule 13) - - '(' reduce using rule 13 - ')' reduce using rule 13 - '*' reduce using rule 13 - ',' reduce using rule 13 - '.' reduce using rule 13 - '[' reduce using rule 13 - ']' reduce using rule 13 - '⌉' reduce using rule 13 - '⟧' reduce using rule 13 - %eof reduce using rule 13 - - -State 61 - - String -> L_quoted . (rule 14) - - '(' reduce using rule 14 - ')' reduce using rule 14 - '*' reduce using rule 14 - ',' reduce using rule 14 - '.' reduce using rule 14 - '[' reduce using rule 14 - ']' reduce using rule 14 - '⌉' reduce using rule 14 - '⟧' reduce using rule 14 - %eof reduce using rule 14 - - -State 62 - - BindingsMetaId -> L_BindingsMetaId . (rule 21) - - ')' reduce using rule 21 - ',' reduce using rule 21 - '⟧' reduce using rule 21 - %eof reduce using rule 21 - - -State 63 - - ObjectMetaId -> L_ObjectMetaId . (rule 22) - - '(' reduce using rule 22 - ')' reduce using rule 22 - '*' reduce using rule 22 - ',' reduce using rule 22 - '.' reduce using rule 22 - '[' reduce using rule 22 - ']' reduce using rule 22 - '⌉' reduce using rule 22 - '⟧' reduce using rule 22 - %eof reduce using rule 22 - - -State 64 - - MetaFunctionName -> L_MetaFunctionName . (rule 24) - - '(' reduce using rule 24 - - -State 65 - - DoubleSigned -> L_DoubleSigned . (rule 25) - - '(' reduce using rule 25 - ')' reduce using rule 25 - '*' reduce using rule 25 - ',' reduce using rule 25 - '.' reduce using rule 25 - '[' reduce using rule 25 - ']' reduce using rule 25 - '⌉' reduce using rule 25 - '⟧' reduce using rule 25 - %eof reduce using rule 25 - - -State 66 - - %start_pBinding -> Binding . (rule 3) - - %eof accept - - -State 67 - - %start_pObject -> Object . (rule 2) - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> Object . '*' TailMetaId (rule 45) - - '(' shift, and enter state 79 - '*' shift, and enter state 80 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - %eof accept - - -State 68 - - MetaId -> LabelMetaId . (rule 27) - - %eof reduce using rule 27 - - -State 69 - - MetaId -> TailMetaId . (rule 28) - - %eof reduce using rule 28 - - -State 70 - - MetaId -> BindingsMetaId . (rule 29) - - %eof reduce using rule 29 - - -State 71 - - MetaId -> ObjectMetaId . (rule 30) - - %eof reduce using rule 30 - - -State 72 - - MetaId -> BytesMetaId . (rule 31) - - %eof reduce using rule 31 - - -State 73 - - %start_pMetaId -> MetaId . (rule 1) - - %eof accept - - -State 74 - - TailMetaId -> L_TailMetaId . (rule 20) - - '(' reduce using rule 20 - ')' reduce using rule 20 - '*' reduce using rule 20 - ',' reduce using rule 20 - '.' reduce using rule 20 - '[' reduce using rule 20 - ']' reduce using rule 20 - '⌉' reduce using rule 20 - '⟧' reduce using rule 20 - %eof reduce using rule 20 - - -State 75 - - BytesMetaId -> L_BytesMetaId . (rule 23) - - ')' reduce using rule 23 - ',' reduce using rule 23 - '⟧' reduce using rule 23 - %eof reduce using rule 23 - - -State 76 - - %start_pProgram -> Program . (rule 0) - - %eof accept - - -State 77 - - Program -> '{' . '⟦' ListBinding '⟧' '}' (rule 26) - - '⟦' shift, and enter state 78 - - -State 78 - - Program -> '{' '⟦' . ListBinding '⟧' '}' (rule 26) - - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - '⟧' reduce using rule 55 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 117 - Attribute goto state 51 - -State 79 - - Object -> Object '(' . ListBinding ')' (rule 33) - - ')' reduce using rule 55 - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 116 - Attribute goto state 51 - -State 80 - - Object -> Object '*' . TailMetaId (rule 45) - - L_TailMetaId shift, and enter state 74 - - TailMetaId goto state 115 - -State 81 - - Object -> Object '.' . Attribute (rule 34) - - '~' shift, and enter state 31 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - Attribute goto state 114 - -State 82 - - Object -> Object '[' . 'ξ' '↦' Object ']' (rule 42) - - 'ξ' shift, and enter state 113 - - -State 83 - - Object -> '⟦' ListBinding . '⟧' (rule 32) - - '⟧' shift, and enter state 112 - - -State 84 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> '⌈' Object . ',' Object '⌉' (rule 43) - Object -> Object . '*' TailMetaId (rule 45) - - '(' shift, and enter state 79 - '*' shift, and enter state 80 - ',' shift, and enter state 111 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - - -State 85 - - Binding -> 'λ' '⤍' . Function (rule 52) - - L_Function shift, and enter state 110 - - Function goto state 109 - -State 86 - - Binding -> 'Δ' '⤍' . Bytes (rule 50) - Binding -> 'Δ' '⤍' . '∅' (rule 51) - Binding -> 'Δ' '⤍' . BytesMetaId (rule 54) - - '∅' shift, and enter state 107 - L_Bytes shift, and enter state 108 - L_BytesMetaId shift, and enter state 75 - - Bytes goto state 105 - BytesMetaId goto state 106 - -State 87 - - Binding -> Attribute '↦' . Object (rule 47) - Binding -> Attribute '↦' . '∅' (rule 49) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '∅' shift, and enter state 104 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 103 - -State 88 - - ListBinding -> Binding ',' . ListBinding (rule 57) - - ')' reduce using rule 55 - '~' shift, and enter state 31 - 'Δ' shift, and enter state 52 - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'λ' shift, and enter state 55 - 'ξ' shift, and enter state 56 - 'ρ' shift, and enter state 34 - 'φ' shift, and enter state 35 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - '⟧' reduce using rule 55 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_LabelId shift, and enter state 36 - L_AlphaIndex shift, and enter state 37 - L_LabelMetaId shift, and enter state 38 - L_BindingsMetaIdshift, and enter state 62 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - %eof reduce using rule 55 - - Integer goto state 42 - String goto state 43 - LabelId goto state 26 - AlphaIndex goto state 27 - LabelMetaId goto state 28 - BindingsMetaId goto state 44 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 48 - Binding goto state 49 - ListBinding goto state 102 - Attribute goto state 51 - -State 89 - - Object -> MetaFunctionName '(' . Object ')' (rule 46) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 101 - -State 90 - - ListLabelId -> LabelId ',' . ListLabelId (rule 66) - - ')' reduce using rule 64 - L_LabelId shift, and enter state 36 - %eof reduce using rule 64 - - LabelId goto state 39 - ListLabelId goto state 100 - -State 91 - - Attribute -> '~' LabelId . '(' ListLabelId ')' (rule 63) - - '(' shift, and enter state 99 - - -State 92 - - PeeledObject -> ObjectHead ListObjectAction . (rule 70) - - %eof reduce using rule 70 - - -State 93 - - ObjectHead -> '⟦' ListBinding . '⟧' (rule 71) - - '⟧' shift, and enter state 98 - - -State 94 - - ObjectAction -> '.' Attribute . (rule 76) - - '(' reduce using rule 76 - '.' reduce using rule 76 - %eof reduce using rule 76 - - -State 95 - - ObjectAction -> '(' ListBinding . ')' (rule 75) - - ')' shift, and enter state 97 - - -State 96 - - ListObjectAction -> ObjectAction ListObjectAction . (rule 78) - - %eof reduce using rule 78 - - -State 97 - - ObjectAction -> '(' ListBinding ')' . (rule 75) - - '(' reduce using rule 75 - '.' reduce using rule 75 - %eof reduce using rule 75 - - -State 98 - - ObjectHead -> '⟦' ListBinding '⟧' . (rule 71) - - '(' reduce using rule 71 - '.' reduce using rule 71 - %eof reduce using rule 71 - - -State 99 - - Attribute -> '~' LabelId '(' . ListLabelId ')' (rule 63) - - ')' reduce using rule 64 - L_LabelId shift, and enter state 36 - - LabelId goto state 39 - ListLabelId goto state 123 - -State 100 - - ListLabelId -> LabelId ',' ListLabelId . (rule 66) - - ')' reduce using rule 66 - %eof reduce using rule 66 - - -State 101 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> Object . '*' TailMetaId (rule 45) - Object -> MetaFunctionName '(' Object . ')' (rule 46) - - '(' shift, and enter state 79 - ')' shift, and enter state 122 - '*' shift, and enter state 80 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - - -State 102 - - ListBinding -> Binding ',' ListBinding . (rule 57) - - ')' reduce using rule 57 - '⟧' reduce using rule 57 - %eof reduce using rule 57 - - -State 103 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> Object . '*' TailMetaId (rule 45) - Binding -> Attribute '↦' Object . (rule 47) - - '(' shift, and enter state 79 - ')' reduce using rule 47 - '*' shift, and enter state 80 - ',' reduce using rule 47 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - '⟧' reduce using rule 47 - %eof reduce using rule 47 - - -State 104 - - Binding -> Attribute '↦' '∅' . (rule 49) - - ')' reduce using rule 49 - ',' reduce using rule 49 - '⟧' reduce using rule 49 - %eof reduce using rule 49 - - -State 105 - - Binding -> 'Δ' '⤍' Bytes . (rule 50) - - ')' reduce using rule 50 - ',' reduce using rule 50 - '⟧' reduce using rule 50 - %eof reduce using rule 50 - - -State 106 - - Binding -> 'Δ' '⤍' BytesMetaId . (rule 54) - - ')' reduce using rule 54 - ',' reduce using rule 54 - '⟧' reduce using rule 54 - %eof reduce using rule 54 - - -State 107 - - Binding -> 'Δ' '⤍' '∅' . (rule 51) - - ')' reduce using rule 51 - ',' reduce using rule 51 - '⟧' reduce using rule 51 - %eof reduce using rule 51 - - -State 108 - - Bytes -> L_Bytes . (rule 15) - - ')' reduce using rule 15 - ',' reduce using rule 15 - '⟧' reduce using rule 15 - %eof reduce using rule 15 - - -State 109 - - Binding -> 'λ' '⤍' Function . (rule 52) - - ')' reduce using rule 52 - ',' reduce using rule 52 - '⟧' reduce using rule 52 - %eof reduce using rule 52 - - -State 110 - - Function -> L_Function . (rule 16) - - ')' reduce using rule 16 - ',' reduce using rule 16 - '⟧' reduce using rule 16 - %eof reduce using rule 16 - - -State 111 - - Object -> '⌈' Object ',' . Object '⌉' (rule 43) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 121 - -State 112 - - Object -> '⟦' ListBinding '⟧' . (rule 32) - - '(' reduce using rule 32 - ')' reduce using rule 32 - '*' reduce using rule 32 - ',' reduce using rule 32 - '.' reduce using rule 32 - '[' reduce using rule 32 - ']' reduce using rule 32 - '⌉' reduce using rule 32 - '⟧' reduce using rule 32 - %eof reduce using rule 32 - - -State 113 - - Object -> Object '[' 'ξ' . '↦' Object ']' (rule 42) - - '↦' shift, and enter state 120 - - -State 114 - - Object -> Object '.' Attribute . (rule 34) - - '(' reduce using rule 34 - ')' reduce using rule 34 - '*' reduce using rule 34 - ',' reduce using rule 34 - '.' reduce using rule 34 - '[' reduce using rule 34 - ']' reduce using rule 34 - '⌉' reduce using rule 34 - '⟧' reduce using rule 34 - %eof reduce using rule 34 - - -State 115 - - Object -> Object '*' TailMetaId . (rule 45) - - '(' reduce using rule 45 - ')' reduce using rule 45 - '*' reduce using rule 45 - ',' reduce using rule 45 - '.' reduce using rule 45 - '[' reduce using rule 45 - ']' reduce using rule 45 - '⌉' reduce using rule 45 - '⟧' reduce using rule 45 - %eof reduce using rule 45 - - -State 116 - - Object -> Object '(' ListBinding . ')' (rule 33) - - ')' shift, and enter state 119 - - -State 117 - - Program -> '{' '⟦' ListBinding . '⟧' '}' (rule 26) - - '⟧' shift, and enter state 118 - - -State 118 - - Program -> '{' '⟦' ListBinding '⟧' . '}' (rule 26) - - '}' shift, and enter state 127 - - -State 119 - - Object -> Object '(' ListBinding ')' . (rule 33) - - '(' reduce using rule 33 - ')' reduce using rule 33 - '*' reduce using rule 33 - ',' reduce using rule 33 - '.' reduce using rule 33 - '[' reduce using rule 33 - ']' reduce using rule 33 - '⌉' reduce using rule 33 - '⟧' reduce using rule 33 - %eof reduce using rule 33 - - -State 120 - - Object -> Object '[' 'ξ' '↦' . Object ']' (rule 42) - - 'Φ' shift, and enter state 53 - 'Φ̇' shift, and enter state 54 - 'ξ' shift, and enter state 56 - '⊥' shift, and enter state 57 - '⌈' shift, and enter state 58 - '⟦' shift, and enter state 59 - L_integ shift, and enter state 60 - L_quoted shift, and enter state 61 - L_ObjectMetaId shift, and enter state 63 - L_MetaFunctionNameshift, and enter state 64 - L_DoubleSigned shift, and enter state 65 - - Integer goto state 42 - String goto state 43 - ObjectMetaId goto state 45 - MetaFunctionNamegoto state 46 - DoubleSigned goto state 47 - Object goto state 126 - -State 121 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> '⌈' Object ',' Object . '⌉' (rule 43) - Object -> Object . '*' TailMetaId (rule 45) - - '(' shift, and enter state 79 - '*' shift, and enter state 80 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - '⌉' shift, and enter state 125 - - -State 122 - - Object -> MetaFunctionName '(' Object ')' . (rule 46) - - '(' reduce using rule 46 - ')' reduce using rule 46 - '*' reduce using rule 46 - ',' reduce using rule 46 - '.' reduce using rule 46 - '[' reduce using rule 46 - ']' reduce using rule 46 - '⌉' reduce using rule 46 - '⟧' reduce using rule 46 - %eof reduce using rule 46 - - -State 123 - - Attribute -> '~' LabelId '(' ListLabelId . ')' (rule 63) - - ')' shift, and enter state 124 - - -State 124 - - Attribute -> '~' LabelId '(' ListLabelId ')' . (rule 63) - - '(' reduce using rule 63 - ')' reduce using rule 63 - '*' reduce using rule 63 - ',' reduce using rule 63 - '.' reduce using rule 63 - '[' reduce using rule 63 - ']' reduce using rule 63 - '↦' reduce using rule 63 - '⌉' reduce using rule 63 - '⟧' reduce using rule 63 - %eof reduce using rule 63 - - -State 125 - - Object -> '⌈' Object ',' Object '⌉' . (rule 43) - - '(' reduce using rule 43 - ')' reduce using rule 43 - '*' reduce using rule 43 - ',' reduce using rule 43 - '.' reduce using rule 43 - '[' reduce using rule 43 - ']' reduce using rule 43 - '⌉' reduce using rule 43 - '⟧' reduce using rule 43 - %eof reduce using rule 43 - - -State 126 - - Object -> Object . '(' ListBinding ')' (rule 33) - Object -> Object . '.' Attribute (rule 34) - Object -> Object . '[' 'ξ' '↦' Object ']' (rule 42) - Object -> Object '[' 'ξ' '↦' Object . ']' (rule 42) - Object -> Object . '*' TailMetaId (rule 45) - - '(' shift, and enter state 79 - '*' shift, and enter state 80 - '.' shift, and enter state 81 - '[' shift, and enter state 82 - ']' shift, and enter state 128 - - -State 127 - - Program -> '{' '⟦' ListBinding '⟧' '}' . (rule 26) - - %eof reduce using rule 26 - - -State 128 - - Object -> Object '[' 'ξ' '↦' Object ']' . (rule 42) - - '(' reduce using rule 42 - ')' reduce using rule 42 - '*' reduce using rule 42 - ',' reduce using rule 42 - '.' reduce using rule 42 - '[' reduce using rule 42 - ']' reduce using rule 42 - '⌉' reduce using rule 42 - '⟧' reduce using rule 42 - %eof reduce using rule 42 - - ------------------------------------------------------------------------------ -Grammar Totals ------------------------------------------------------------------------------ -Number of rules: 79 -Number of terminals: 39 -Number of non-terminals: 38 -Number of states: 129 From 7e49f6865abbd4dbfc1ec97d65df0e042a78f727 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 13:42:21 +0300 Subject: [PATCH 31/69] chore(eo): bump 0.49.1 -> 0.49.3 --- eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo b/eo index afbac6c44..e6e5f99c2 160000 --- a/eo +++ b/eo @@ -1 +1 @@ -Subproject commit afbac6c447de20a81e20f44a8259d28a1a4547c9 +Subproject commit e6e5f99c20f23ab8c27ece633efedc73309289f5 From 543af6abb3bec047b7d90578019a46aad4c04d38 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Dec 2024 10:53:52 +0000 Subject: [PATCH 32/69] Update pipeline/pipeline.lock --- pipeline/pipeline.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index 8af881342..b0ab47f7a 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ -EO_HEAD_HASH="afbac6c447de20a81e20f44a8259d28a1a4547c9" +EO_HEAD_HASH="e6e5f99c20f23ab8c27ece633efedc73309289f5" PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" From f475607e6875cf866bba5f607575fab3b5e21e7c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Dec 2024 10:53:53 +0000 Subject: [PATCH 33/69] Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.49.3/dependencies.md | 3920 +++++++++++++++++ .../data/0.49.3/org/eolang/as-phi.phi | 11 + .../data/0.49.3/org/eolang/bytes.phi | 95 + .../data/0.49.3/org/eolang/cti.phi | 11 + .../data/0.49.3/org/eolang/dataized.phi | 18 + .../data/0.49.3/org/eolang/error.phi | 11 + .../data/0.49.3/org/eolang/false.phi | 21 + .../data/0.49.3/org/eolang/fs/dir.phi | 71 + .../data/0.49.3/org/eolang/fs/file.phi | 164 + .../data/0.49.3/org/eolang/fs/path.phi | 273 ++ .../data/0.49.3/org/eolang/fs/tmpdir.phi | 39 + .../data/0.49.3/org/eolang/go.phi | 34 + .../data/0.49.3/org/eolang/i16.phi | 67 + .../data/0.49.3/org/eolang/i32.phi | 79 + .../data/0.49.3/org/eolang/i64.phi | 59 + .../0.49.3/org/eolang/io/bytes-as-input.phi | 36 + .../data/0.49.3/org/eolang/io/console.phi | 122 + .../data/0.49.3/org/eolang/io/dead-input.phi | 22 + .../data/0.49.3/org/eolang/io/dead-output.phi | 22 + .../0.49.3/org/eolang/io/input-length.phi | 21 + .../0.49.3/org/eolang/io/malloc-as-output.phi | 30 + .../data/0.49.3/org/eolang/io/stdin.phi | 45 + .../data/0.49.3/org/eolang/io/stdout.phi | 18 + .../data/0.49.3/org/eolang/io/tee-input.phi | 34 + .../data/0.49.3/org/eolang/malloc.phi | 55 + .../data/0.49.3/org/eolang/math/angle.phi | 30 + .../data/0.49.3/org/eolang/math/e.phi | 12 + .../data/0.49.3/org/eolang/math/integral.phi | 66 + .../data/0.49.3/org/eolang/math/numbers.phi | 42 + .../data/0.49.3/org/eolang/math/pi.phi | 12 + .../data/0.49.3/org/eolang/math/random.phi | 53 + .../data/0.49.3/org/eolang/math/real.phi | 49 + .../data/0.49.3/org/eolang/nan.phi | 44 + .../0.49.3/org/eolang/negative-infinity.phi | 61 + .../data/0.49.3/org/eolang/net/socket.phi | 535 +++ .../data/0.49.3/org/eolang/number.phi | 74 + .../0.49.3/org/eolang/positive-infinity.phi | 61 + .../data/0.49.3/org/eolang/seq.phi | 17 + .../data/0.49.3/org/eolang/string.phi | 155 + .../org/eolang/structs/bytes-as-array.phi | 23 + .../org/eolang/structs/hash-code-of.phi | 30 + .../data/0.49.3/org/eolang/structs/list.phi | 194 + .../data/0.49.3/org/eolang/structs/map.phi | 122 + .../org/eolang/structs/range-of-ints.phi | 26 + .../data/0.49.3/org/eolang/structs/range.phi | 23 + .../data/0.49.3/org/eolang/structs/set.phi | 37 + .../data/0.49.3/org/eolang/switch.phi | 18 + .../data/0.49.3/org/eolang/sys/getenv.phi | 19 + .../0.49.3/org/eolang/sys/line-separator.phi | 14 + .../data/0.49.3/org/eolang/sys/os.phi | 23 + .../data/0.49.3/org/eolang/sys/posix.phi | 35 + .../data/0.49.3/org/eolang/sys/win32.phi | 38 + .../data/0.49.3/org/eolang/true.phi | 21 + .../data/0.49.3/org/eolang/try.phi | 11 + .../data/0.49.3/org/eolang/tuple.phi | 39 + .../data/0.49.3/org/eolang/txt/regex.phi | 56 + .../data/0.49.3/org/eolang/txt/sprintf.phi | 14 + .../data/0.49.3/org/eolang/txt/sscanf.phi | 14 + .../data/0.49.3/org/eolang/txt/text.phi | 275 ++ .../data/0.49.3/org/eolang/while.phi | 22 + 60 files changed, 7543 insertions(+) create mode 100644 eo-phi-normalizer/data/0.49.3/dependencies.md create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/as-phi.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/bytes.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/cti.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/dataized.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/error.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/false.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/fs/dir.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/fs/file.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/fs/path.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/fs/tmpdir.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/go.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/i16.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/i32.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/i64.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/bytes-as-input.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/console.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-input.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-output.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/input-length.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/malloc-as-output.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/stdin.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/stdout.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/io/tee-input.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/malloc.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/angle.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/e.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/integral.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/numbers.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/pi.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/random.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/math/real.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/nan.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/negative-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/net/socket.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/number.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/positive-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/seq.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/string.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/bytes-as-array.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/hash-code-of.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/list.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/map.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/range-of-ints.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/range.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/structs/set.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/switch.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/sys/getenv.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/sys/line-separator.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/sys/os.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/sys/posix.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/sys/win32.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/true.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/try.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/tuple.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/txt/regex.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/txt/sprintf.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/txt/sscanf.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/txt/text.phi create mode 100644 eo-phi-normalizer/data/0.49.3/org/eolang/while.phi diff --git a/eo-phi-normalizer/data/0.49.3/dependencies.md b/eo-phi-normalizer/data/0.49.3/dependencies.md new file mode 100644 index 000000000..eef7d4edb --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/dependencies.md @@ -0,0 +1,3920 @@ +# Dependencies + +## [org/eolang/as-phi.phi](./org/eolang/as-phi.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + as-phi(x) ↦ ⟦ + λ ⤍ Lorg_eolang_as_phi + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/bytes.phi](./org/eolang/bytes.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/cti.phi](./org/eolang/cti.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/dataized.phi](./org/eolang/dataized.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/error.phi](./org/eolang/error.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/false.phi](./org/eolang/false.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + false ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/dir.phi](./org/eolang/fs/dir.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/file.phi](./org/eolang/fs/file.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/path.phi](./org/eolang/fs/path.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/tmpdir.phi](./org/eolang/fs/tmpdir.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + tmpdir ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1 ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/go.phi](./org/eolang/go.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + go ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i16.phi](./org/eolang/i16.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32 ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i32.phi](./org/eolang/i32.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i64.phi](./org/eolang/i64.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/bytes-as-input.phi](./org/eolang/io/bytes-as-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/console.phi](./org/eolang/io/console.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + console ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-input ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-output ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/input-length.phi](./org/eolang/io/input-length.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/malloc-as-output.phi](./org/eolang/io/malloc-as-output.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdin.phi](./org/eolang/io/stdin.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdin ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdout.phi](./org/eolang/io/stdout.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/tee-input.phi](./org/eolang/io/tee-input.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/malloc.phi](./org/eolang/malloc.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + malloc ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/angle.phi](./org/eolang/math/angle.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/e.phi](./org/eolang/math/e.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/integral.phi](./org/eolang/math/integral.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/numbers.phi](./org/eolang/math/numbers.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/pi.phi](./org/eolang/math/pi.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/random.phi](./org/eolang/math/random.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/real.phi](./org/eolang/math/real.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/nan.phi](./org/eolang/nan.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + nan ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + negative-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/net/socket.phi](./org/eolang/net/socket.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + net ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/number.phi](./org/eolang/number.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + positive-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/seq.phi](./org/eolang/seq.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/string.phi](./org/eolang/string.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/bytes-as-array.phi](./org/eolang/structs/bytes-as-array.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/hash-code-of.phi](./org/eolang/structs/hash-code-of.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/list.phi](./org/eolang/structs/list.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/map.phi](./org/eolang/structs/map.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54 ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12 ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6 ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18 ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range-of-ints.phi](./org/eolang/structs/range-of-ints.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8 ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range.phi](./org/eolang/structs/range.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/set.phi](./org/eolang/structs/set.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/switch.phi](./org/eolang/switch.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/getenv.phi](./org/eolang/sys/getenv.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/line-separator.phi](./org/eolang/sys/line-separator.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + line-separator ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/os.phi](./org/eolang/sys/os.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + os ↦ ⟦ + φ ↦ ξ.name, + is-windows ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/posix.phi](./org/eolang/sys/posix.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/win32.phi](./org/eolang/sys/win32.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/true.phi](./org/eolang/true.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + true ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/try.phi](./org/eolang/try.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/tuple.phi](./org/eolang/tuple.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/regex.phi](./org/eolang/txt/regex.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sprintf.phi](./org/eolang/txt/sprintf.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sscanf.phi](./org/eolang/txt/sscanf.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/text.phi](./org/eolang/txt/text.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/while.phi](./org/eolang/while.phi) + +```console +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/as-phi.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/as-phi.phi new file mode 100644 index 000000000..e7fe44c8f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/as-phi.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + as-phi(x) ↦ ⟦ + λ ⤍ Lorg_eolang_as_phi + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/bytes.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/bytes.phi new file mode 100644 index 000000000..263333ea7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/bytes.phi @@ -0,0 +1,95 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16 ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/cti.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/cti.phi new file mode 100644 index 000000000..23e09d15e --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/cti.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/dataized.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/dataized.phi new file mode 100644 index 000000000..4831387b5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/dataized.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/error.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/error.phi new file mode 100644 index 000000000..c09492f93 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/error.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/false.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/false.phi new file mode 100644 index 000000000..934a84ea8 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/false.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + false ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/fs/dir.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/dir.phi new file mode 100644 index 000000000..065da5041 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/dir.phi @@ -0,0 +1,71 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/fs/file.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/file.phi new file mode 100644 index 000000000..9d791cb4f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/file.phi @@ -0,0 +1,164 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18 ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/fs/path.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/path.phi new file mode 100644 index 000000000..e56859397 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/path.phi @@ -0,0 +1,273 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/fs/tmpdir.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/tmpdir.phi new file mode 100644 index 000000000..901568f23 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/fs/tmpdir.phi @@ -0,0 +1,39 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + fs ↦ ⟦ + tmpdir ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1 ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/go.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/go.phi new file mode 100644 index 000000000..02ad1de6a --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/go.phi @@ -0,0 +1,34 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + go ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/i16.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/i16.phi new file mode 100644 index 000000000..84002c9b7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/i16.phi @@ -0,0 +1,67 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32 ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/i32.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/i32.phi new file mode 100644 index 000000000..140963159 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/i32.phi @@ -0,0 +1,79 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/i64.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/i64.phi new file mode 100644 index 000000000..12ab7c0d4 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/i64.phi @@ -0,0 +1,59 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32 ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/bytes-as-input.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/bytes-as-input.phi new file mode 100644 index 000000000..a145375e4 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/bytes-as-input.phi @@ -0,0 +1,36 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/console.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/console.phi new file mode 100644 index 000000000..393d7fba7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/console.phi @@ -0,0 +1,122 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + console ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-input.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-input.phi new file mode 100644 index 000000000..f3fe02859 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-input.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-input ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-output.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-output.phi new file mode 100644 index 000000000..56c5c73e0 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/dead-output.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + dead-output ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/input-length.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/input-length.phi new file mode 100644 index 000000000..1ed2e1bea --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/input-length.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/malloc-as-output.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/malloc-as-output.phi new file mode 100644 index 000000000..fb787712d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/malloc-as-output.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdin.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdin.phi new file mode 100644 index 000000000..281cb68df --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdin.phi @@ -0,0 +1,45 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdin ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdout.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdout.phi new file mode 100644 index 000000000..4151c8f91 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/stdout.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/io/tee-input.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/io/tee-input.phi new file mode 100644 index 000000000..c139df912 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/io/tee-input.phi @@ -0,0 +1,34 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + io ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/malloc.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/malloc.phi new file mode 100644 index 000000000..bab61f094 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/malloc.phi @@ -0,0 +1,55 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + malloc ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/angle.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/angle.phi new file mode 100644 index 000000000..dac88cf76 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/angle.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/e.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/e.phi new file mode 100644 index 000000000..fd09f7146 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/e.phi @@ -0,0 +1,12 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/integral.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/integral.phi new file mode 100644 index 000000000..9587279e6 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/integral.phi @@ -0,0 +1,66 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/numbers.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/numbers.phi new file mode 100644 index 000000000..0633156a8 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/numbers.phi @@ -0,0 +1,42 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/pi.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/pi.phi new file mode 100644 index 000000000..05ab9d147 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/pi.phi @@ -0,0 +1,12 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/random.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/random.phi new file mode 100644 index 000000000..d93af88d1 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/random.phi @@ -0,0 +1,53 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/math/real.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/math/real.phi new file mode 100644 index 000000000..9005a4d27 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/math/real.phi @@ -0,0 +1,49 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + math ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/nan.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/nan.phi new file mode 100644 index 000000000..5bd65cdf5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/nan.phi @@ -0,0 +1,44 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + nan ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/negative-infinity.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/negative-infinity.phi new file mode 100644 index 000000000..622952c70 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/negative-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + negative-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/net/socket.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/net/socket.phi new file mode 100644 index 000000000..03ba5b913 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/net/socket.phi @@ -0,0 +1,535 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + net ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10 ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22 ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/number.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/number.phi new file mode 100644 index 000000000..18ff8c183 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/number.phi @@ -0,0 +1,74 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64 ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/positive-infinity.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/positive-infinity.phi new file mode 100644 index 000000000..4d0d34134 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/positive-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + positive-infinity ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/seq.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/seq.phi new file mode 100644 index 000000000..a1de0ce03 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/seq.phi @@ -0,0 +1,17 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/string.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/string.phi new file mode 100644 index 000000000..b50ac6c96 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/string.phi @@ -0,0 +1,155 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/bytes-as-array.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/bytes-as-array.phi new file mode 100644 index 000000000..7329c2169 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/bytes-as-array.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/hash-code-of.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/hash-code-of.phi new file mode 100644 index 000000000..b792ec697 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/hash-code-of.phi @@ -0,0 +1,30 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/list.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/list.phi new file mode 100644 index 000000000..616a110ed --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/list.phi @@ -0,0 +1,194 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/map.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/map.phi new file mode 100644 index 000000000..9ead205f5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/map.phi @@ -0,0 +1,122 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54 ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12 ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6 ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18 ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range-of-ints.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range-of-ints.phi new file mode 100644 index 000000000..269e097c3 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range-of-ints.phi @@ -0,0 +1,26 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8 ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range.phi new file mode 100644 index 000000000..a9b7f2048 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/range.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/structs/set.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/set.phi new file mode 100644 index 000000000..b4aaab41c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/structs/set.phi @@ -0,0 +1,37 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + structs ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/switch.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/switch.phi new file mode 100644 index 000000000..74d59bd77 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/switch.phi @@ -0,0 +1,18 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/sys/getenv.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/getenv.phi new file mode 100644 index 000000000..86fe10af2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/getenv.phi @@ -0,0 +1,19 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/sys/line-separator.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/line-separator.phi new file mode 100644 index 000000000..96e7398eb --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/line-separator.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + line-separator ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/sys/os.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/os.phi new file mode 100644 index 000000000..ce101948a --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/os.phi @@ -0,0 +1,23 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + os ↦ ⟦ + φ ↦ ξ.name, + is-windows ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/sys/posix.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/posix.phi new file mode 100644 index 000000000..34f897976 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/posix.phi @@ -0,0 +1,35 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/sys/win32.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/win32.phi new file mode 100644 index 000000000..16fb1772d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/sys/win32.phi @@ -0,0 +1,38 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + sys ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/true.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/true.phi new file mode 100644 index 000000000..5adeeff26 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/true.phi @@ -0,0 +1,21 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + true ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/try.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/try.phi new file mode 100644 index 000000000..45859a8cf --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/try.phi @@ -0,0 +1,11 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/tuple.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/tuple.phi new file mode 100644 index 000000000..ceb401fa2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/tuple.phi @@ -0,0 +1,39 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/txt/regex.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/regex.phi new file mode 100644 index 000000000..5aecce4f1 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/regex.phi @@ -0,0 +1,56 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sprintf.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sprintf.phi new file mode 100644 index 000000000..5add6db64 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sprintf.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sscanf.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sscanf.phi new file mode 100644 index 000000000..25f4ed513 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/sscanf.phi @@ -0,0 +1,14 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/txt/text.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/text.phi new file mode 100644 index 000000000..3736295c5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/txt/text.phi @@ -0,0 +1,275 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + txt ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.3/org/eolang/while.phi b/eo-phi-normalizer/data/0.49.3/org/eolang/while.phi new file mode 100644 index 000000000..66ba4c723 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.3/org/eolang/while.phi @@ -0,0 +1,22 @@ +{⟦ + org ↦ ⟦ + eolang ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file From 3dfdb08bacb4ce5bc6c8cd6f9ca9788c89bfb5d2 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 14:56:50 +0300 Subject: [PATCH 34/69] chore(flake): update hpack --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 35500ebea..a11525581 100644 --- a/flake.nix +++ b/flake.nix @@ -267,7 +267,7 @@ commands = { tools = [ stack-wrapped - pkgs.hpack + pkgs.haskellPackages.hpack_0_37_0 pkgs.gh pkgs.mdsh pkgs.mdbook From 8fe5d52e04f50f7d5f455fb77574754abde8ab22 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 15:00:37 +0300 Subject: [PATCH 35/69] feat(eo-phi-normalizer): copy the generated Print module --- eo-phi-normalizer/eo-phi-normalizer.cabal | 1 + .../src/Language/EO/Phi/Print.hs | 283 ++++++++++++++++++ 2 files changed, 284 insertions(+) create mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Print.hs diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 0521d42cd..2e31c1873 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -284,6 +284,7 @@ library Language.EO.Phi.Pipeline.EOTests.Data Language.EO.Phi.Pipeline.EOTests.PrepareTests Language.EO.Phi.Preprocess + Language.EO.Phi.Pretty Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Print.hs new file mode 100644 index 000000000..778131c4d --- /dev/null +++ b/eo-phi-normalizer/src/Language/EO/Phi/Print.hs @@ -0,0 +1,283 @@ +{- +Copyright EO/Polystat Development Team (c) 2023 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of EO/Polystat Development Team nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-} + +-- File generated by the BNF Converter (bnfc 2.9.5). + +{-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} +#if __GLASGOW_HASKELL__ <= 708 +{-# LANGUAGE OverlappingInstances #-} +#endif + +-- | Pretty-printer for Language. + +module Language.EO.Phi.Syntax.Print where + +import Prelude + ( ($), (.) + , Bool(..), (==), (<) + , Int, Integer, Double, (+), (-), (*) + , String, (++) + , ShowS, showChar, showString + , all, elem, foldr, id, map, null, replicate, shows, span + ) +import Data.Char ( Char, isSpace ) +import qualified Language.EO.Phi.Syntax.Abs + +-- | The top-level printing method. + +printTree :: Print a => a -> String +printTree = render . prt 0 + +type Doc = [ShowS] -> [ShowS] + +doc :: ShowS -> Doc +doc = (:) + +render :: Doc -> String +render d = rend 0 False (map ($ "") $ d []) "" + where + rend + :: Int -- ^ Indentation level. + -> Bool -- ^ Pending indentation to be output before next character? + -> [String] + -> ShowS + rend i p = \case + "[" :ts -> char '[' . rend i False ts + "(" :ts -> char '(' . rend i False ts + "{" :ts -> onNewLine i p . showChar '{' . new (i+1) ts + "}" : ";":ts -> onNewLine (i-1) p . showString "};" . new (i-1) ts + "}" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts + [";"] -> char ';' + ";" :ts -> char ';' . new i ts + t : ts@(s:_) | closingOrPunctuation s + -> pending . showString t . rend i False ts + t :ts -> pending . space t . rend i False ts + [] -> id + where + -- Output character after pending indentation. + char :: Char -> ShowS + char c = pending . showChar c + + -- Output pending indentation. + pending :: ShowS + pending = if p then indent i else id + + -- Indentation (spaces) for given indentation level. + indent :: Int -> ShowS + indent i = replicateS (2*i) (showChar ' ') + + -- Continue rendering in new line with new indentation. + new :: Int -> [String] -> ShowS + new j ts = showChar '\n' . rend j True ts + + -- Make sure we are on a fresh line. + onNewLine :: Int -> Bool -> ShowS + onNewLine i p = (if p then id else showChar '\n') . indent i + + -- Separate given string from following text by a space (if needed). + space :: String -> ShowS + space t s = + case (all isSpace t, null spc, null rest) of + (True , _ , True ) -> [] -- remove trailing space + (False, _ , True ) -> t -- remove trailing space + (False, True, False) -> t ++ ' ' : s -- add space if none + _ -> t ++ s + where + (spc, rest) = span isSpace s + + closingOrPunctuation :: String -> Bool + closingOrPunctuation [c] = c `elem` closerOrPunct + closingOrPunctuation _ = False + + closerOrPunct :: String + closerOrPunct = ")],;" + +parenth :: Doc -> Doc +parenth ss = doc (showChar '(') . ss . doc (showChar ')') + +concatS :: [ShowS] -> ShowS +concatS = foldr (.) id + +concatD :: [Doc] -> Doc +concatD = foldr (.) id + +replicateS :: Int -> ShowS -> ShowS +replicateS n f = concatS (replicate n f) + +-- | The printer class does the job. + +class Print a where + prt :: Int -> a -> Doc + +instance {-# OVERLAPPABLE #-} Print a => Print [a] where + prt i = concatD . map (prt i) + +instance Print Char where + prt _ c = doc (showChar '\'' . mkEsc '\'' c . showChar '\'') + +instance Print String where + prt _ = printString + +printString :: String -> Doc +printString s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"') + +mkEsc :: Char -> Char -> ShowS +mkEsc q = \case + s | s == q -> showChar '\\' . showChar s + '\\' -> showString "\\\\" + '\n' -> showString "\\n" + '\t' -> showString "\\t" + s -> showChar s + +prPrec :: Int -> Int -> Doc -> Doc +prPrec i j = if j < i then parenth else id + +instance Print Integer where + prt _ x = doc (shows x) + +instance Print Double where + prt _ x = doc (shows x) + +instance Print Language.EO.Phi.Syntax.Abs.Bytes where + prt _ (Language.EO.Phi.Syntax.Abs.Bytes i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.Function where + prt _ (Language.EO.Phi.Syntax.Abs.Function i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.LabelId where + prt _ (Language.EO.Phi.Syntax.Abs.LabelId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.AlphaIndex where + prt _ (Language.EO.Phi.Syntax.Abs.AlphaIndex i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.LabelMetaId where + prt _ (Language.EO.Phi.Syntax.Abs.LabelMetaId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.TailMetaId where + prt _ (Language.EO.Phi.Syntax.Abs.TailMetaId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.BindingsMetaId where + prt _ (Language.EO.Phi.Syntax.Abs.BindingsMetaId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.ObjectMetaId where + prt _ (Language.EO.Phi.Syntax.Abs.ObjectMetaId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where + prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where + prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where + prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where + prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.Program where + prt i = \case + Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")]) + +instance Print Language.EO.Phi.Syntax.Abs.MetaId where + prt i = \case + Language.EO.Phi.Syntax.Abs.MetaIdLabel labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) + Language.EO.Phi.Syntax.Abs.MetaIdTail tailmetaid -> prPrec i 0 (concatD [prt 0 tailmetaid]) + Language.EO.Phi.Syntax.Abs.MetaIdBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) + Language.EO.Phi.Syntax.Abs.MetaIdObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) + Language.EO.Phi.Syntax.Abs.MetaIdBytes bytesmetaid -> prPrec i 0 (concatD [prt 0 bytesmetaid]) + +instance Print Language.EO.Phi.Syntax.Abs.Object where + prt i = \case + Language.EO.Phi.Syntax.Abs.Formation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) + Language.EO.Phi.Syntax.Abs.Application object bindings -> prPrec i 0 (concatD [prt 0 object, doc (showString "("), prt 0 bindings, doc (showString ")")]) + Language.EO.Phi.Syntax.Abs.ObjectDispatch object attribute -> prPrec i 0 (concatD [prt 0 object, doc (showString "."), prt 0 attribute]) + Language.EO.Phi.Syntax.Abs.GlobalObject -> prPrec i 0 (concatD [doc (showString "\934")]) + Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg -> prPrec i 0 (concatD [doc (showString "\934\775")]) + Language.EO.Phi.Syntax.Abs.ThisObject -> prPrec i 0 (concatD [doc (showString "\958")]) + Language.EO.Phi.Syntax.Abs.Termination -> prPrec i 0 (concatD [doc (showString "\8869")]) + Language.EO.Phi.Syntax.Abs.ConstString str -> prPrec i 0 (concatD [printString str]) + Language.EO.Phi.Syntax.Abs.ConstIntRaw integersigned -> prPrec i 0 (concatD [prt 0 integersigned]) + Language.EO.Phi.Syntax.Abs.ConstFloatRaw doublesigned -> prPrec i 0 (concatD [prt 0 doublesigned]) + Language.EO.Phi.Syntax.Abs.MetaSubstThis object1 object2 -> prPrec i 0 (concatD [prt 0 object1, doc (showString "["), doc (showString "\958"), doc (showString "\8614"), prt 0 object2, doc (showString "]")]) + Language.EO.Phi.Syntax.Abs.MetaContextualize object1 object2 -> prPrec i 0 (concatD [doc (showString "\8968"), prt 0 object1, doc (showString ","), prt 0 object2, doc (showString "\8969")]) + Language.EO.Phi.Syntax.Abs.MetaObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) + Language.EO.Phi.Syntax.Abs.MetaTailContext object tailmetaid -> prPrec i 0 (concatD [prt 0 object, doc (showString "*"), prt 0 tailmetaid]) + Language.EO.Phi.Syntax.Abs.MetaFunction metafunctionname object -> prPrec i 0 (concatD [prt 0 metafunctionname, doc (showString "("), prt 0 object, doc (showString ")")]) + Language.EO.Phi.Syntax.Abs.ConstFloat d -> prPrec i 0 (concatD [prt 0 d]) + Language.EO.Phi.Syntax.Abs.ConstInt n -> prPrec i 0 (concatD [prt 0 n]) + +instance Print Language.EO.Phi.Syntax.Abs.Binding where + prt i = \case + Language.EO.Phi.Syntax.Abs.AlphaBinding attribute object -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), prt 0 object]) + Language.EO.Phi.Syntax.Abs.AlphaBindingSugar object -> prPrec i 0 (concatD [prt 0 object]) + Language.EO.Phi.Syntax.Abs.EmptyBinding attribute -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), doc (showString "\8709")]) + Language.EO.Phi.Syntax.Abs.DeltaBinding bytes -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytes]) + Language.EO.Phi.Syntax.Abs.DeltaEmptyBinding -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), doc (showString "\8709")]) + Language.EO.Phi.Syntax.Abs.LambdaBinding function -> prPrec i 0 (concatD [doc (showString "\955"), doc (showString "\10509"), prt 0 function]) + Language.EO.Phi.Syntax.Abs.MetaBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) + Language.EO.Phi.Syntax.Abs.MetaDeltaBinding bytesmetaid -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytesmetaid]) + +instance Print [Language.EO.Phi.Syntax.Abs.Binding] where + prt _ [] = concatD [] + prt _ [x] = concatD [prt 0 x] + prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] + +instance Print Language.EO.Phi.Syntax.Abs.Attribute where + prt i = \case + Language.EO.Phi.Syntax.Abs.Phi -> prPrec i 0 (concatD [doc (showString "\966")]) + Language.EO.Phi.Syntax.Abs.Rho -> prPrec i 0 (concatD [doc (showString "\961")]) + Language.EO.Phi.Syntax.Abs.Label labelid -> prPrec i 0 (concatD [prt 0 labelid]) + Language.EO.Phi.Syntax.Abs.Alpha alphaindex -> prPrec i 0 (concatD [prt 0 alphaindex]) + Language.EO.Phi.Syntax.Abs.MetaAttr labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) + Language.EO.Phi.Syntax.Abs.AttrSugar labelid labelids -> prPrec i 0 (concatD [doc (showString "~"), prt 0 labelid, doc (showString "("), prt 0 labelids, doc (showString ")")]) + +instance Print [Language.EO.Phi.Syntax.Abs.LabelId] where + prt _ [] = concatD [] + prt _ [x] = concatD [prt 0 x] + prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] + +instance Print Language.EO.Phi.Syntax.Abs.RuleAttribute where + prt i = \case + Language.EO.Phi.Syntax.Abs.ObjectAttr attribute -> prPrec i 0 (concatD [prt 0 attribute]) + Language.EO.Phi.Syntax.Abs.DeltaAttr -> prPrec i 0 (concatD [doc (showString "\916")]) + Language.EO.Phi.Syntax.Abs.LambdaAttr -> prPrec i 0 (concatD [doc (showString "\955")]) + +instance Print Language.EO.Phi.Syntax.Abs.PeeledObject where + prt i = \case + Language.EO.Phi.Syntax.Abs.PeeledObject objecthead objectactions -> prPrec i 0 (concatD [prt 0 objecthead, prt 0 objectactions]) + +instance Print Language.EO.Phi.Syntax.Abs.ObjectHead where + prt i = \case + Language.EO.Phi.Syntax.Abs.HeadFormation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) + Language.EO.Phi.Syntax.Abs.HeadGlobal -> prPrec i 0 (concatD [doc (showString "\934")]) + Language.EO.Phi.Syntax.Abs.HeadThis -> prPrec i 0 (concatD [doc (showString "\958")]) + Language.EO.Phi.Syntax.Abs.HeadTermination -> prPrec i 0 (concatD [doc (showString "\8869")]) + +instance Print Language.EO.Phi.Syntax.Abs.ObjectAction where + prt i = \case + Language.EO.Phi.Syntax.Abs.ActionApplication bindings -> prPrec i 0 (concatD [doc (showString "("), prt 0 bindings, doc (showString ")")]) + Language.EO.Phi.Syntax.Abs.ActionDispatch attribute -> prPrec i 0 (concatD [doc (showString "."), prt 0 attribute]) + +instance Print [Language.EO.Phi.Syntax.Abs.ObjectAction] where + prt _ [] = concatD [] + prt _ (x:xs) = concatD [prt 0 x, prt 0 xs] From b51e426c78236c14fd9db2596a77dbb657c4e78d Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 25 Dec 2024 15:01:04 +0300 Subject: [PATCH 36/69] feat(eo-phi-normalizer): add prettyprinter to build-depends --- eo-phi-normalizer/eo-phi-normalizer.cabal | 5 +++++ eo-phi-normalizer/package.yaml | 1 + 2 files changed, 6 insertions(+) diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 2e31c1873..fa1f3dd10 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -335,6 +335,7 @@ library , megaparsec , mtl , parser-combinators + , prettyprinter , regex-compat , replace-megaparsec , scientific @@ -385,6 +386,7 @@ executable eo-phi-normalizer , mtl , optparse-applicative , parser-combinators + , prettyprinter , regex-compat , replace-megaparsec , scientific @@ -414,6 +416,7 @@ test-suite doctests Language.EO.Phi.Pipeline.EOTests.Data Language.EO.Phi.Pipeline.EOTests.PrepareTests Language.EO.Phi.Preprocess + Language.EO.Phi.Pretty Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common @@ -466,6 +469,7 @@ test-suite doctests , megaparsec , mtl , parser-combinators + , prettyprinter , regex-compat , replace-megaparsec , scientific @@ -524,6 +528,7 @@ test-suite spec , megaparsec , mtl , parser-combinators + , prettyprinter , regex-compat , replace-megaparsec , scientific diff --git a/eo-phi-normalizer/package.yaml b/eo-phi-normalizer/package.yaml index 85ac6b42b..bc390057b 100644 --- a/eo-phi-normalizer/package.yaml +++ b/eo-phi-normalizer/package.yaml @@ -96,6 +96,7 @@ dependencies: - replace-megaparsec - megaparsec - parser-combinators + - prettyprinter default-extensions: - ImportQualifiedPost From 0faaa0cc3d54b242d7c30b6851e29bc419ad8816 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 14:54:01 +0300 Subject: [PATCH 37/69] fix(eo-phi-normalizer): remove some generated files instead of gitignoring them --- .gitignore | 4 ---- eo-phi-normalizer/Setup.hs | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index fdf5a29b7..945189f45 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,6 @@ *.bak eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.hs eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.hs -eo-phi-normalizer/src/Language/EO/Phi/Syntax/ErrM.hs -eo-phi-normalizer/src/Language/EO/Phi/Syntax/Skel.hs -eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test.hs -eo-phi-normalizer/src/Language/EO/Phi/Syntax/Test eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.info .cache/ .DS_Store diff --git a/eo-phi-normalizer/Setup.hs b/eo-phi-normalizer/Setup.hs index 99d950dbb..11f5f6fc8 100644 --- a/eo-phi-normalizer/Setup.hs +++ b/eo-phi-normalizer/Setup.hs @@ -90,6 +90,7 @@ main = , "cd src/Language/EO/Phi/Syntax" , "alex Lex.x" , "happy --info Par.y" + , "rm ErrM.hs Skel.hs Test.hs Abs.hs.bak Print.hs.bak" , "true" ] From 39d12c509a5abfe7ddf48bb084a3f853a575ed1f Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:27:14 +0300 Subject: [PATCH 38/69] refactor(eo-phi-normalizer): rename file --- eo-phi-normalizer/src/Language/EO/Phi/{Print.hs => Pretty.hs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename eo-phi-normalizer/src/Language/EO/Phi/{Print.hs => Pretty.hs} (100%) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs similarity index 100% rename from eo-phi-normalizer/src/Language/EO/Phi/Print.hs rename to eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs From 6d58725443dfe36e33f8be0afb7625b6ef33b3f3 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:28:54 +0300 Subject: [PATCH 39/69] fix(eo-phi-normalizer): explicitly write instances of DesugarableInitially --- eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 6c001f181..1176dcf75 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -159,9 +159,11 @@ instance DesugarableInitially Binding where AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) obj -> obj -instance {-# OVERLAPPABLE #-} DesugarableInitially a where - desugarInitially :: a -> a - desugarInitially = id +instance DesugarableInitially Attribute where desugarInitially = id +instance DesugarableInitially RuleAttribute where desugarInitially = id +instance DesugarableInitially PeeledObject where desugarInitially = id +instance DesugarableInitially ObjectHead where desugarInitially = id +instance DesugarableInitially MetaId where desugarInitially = id class SugarableFinally a where sugarFinally :: a -> a From cf9ee85d7681c555d5bc1c9ce78539067078ac53 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:30:49 +0300 Subject: [PATCH 40/69] fix(eo-phi-normalizer): - add SugarableFinally instance for Program - remove default instances of SugarableFinally --- eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 1176dcf75..b6d6e1746 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -168,6 +168,10 @@ instance DesugarableInitially MetaId where desugarInitially = id class SugarableFinally a where sugarFinally :: a -> a +instance SugarableFinally Program where + sugarFinally :: Program -> Program + sugarFinally (Program bindings) = Program (sugarFinally bindings) + instance SugarableFinally Object where sugarFinally :: Object -> Object sugarFinally = \case @@ -211,10 +215,6 @@ instance SugarableFinally Binding where AlphaBinding a obj -> AlphaBinding a (sugarFinally obj) x -> x -instance {-# OVERLAPPABLE #-} SugarableFinally a where - sugarFinally :: a -> a - sugarFinally = id - desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) From 58e6f544b5f3dc4e0e2df9a33ed1b8e35104e7f0 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:44:14 +0300 Subject: [PATCH 41/69] feat(eo-phi-normalizer): implement new pretty-printer --- .../src/Language/EO/Phi/Pretty.hs | 387 +++++++----------- 1 file changed, 139 insertions(+), 248 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs index 778131c4d..b1a414f71 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -30,254 +30,145 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} - -- File generated by the BNF Converter (bnfc 2.9.5). - -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} -#if __GLASGOW_HASKELL__ <= 708 -{-# LANGUAGE OverlappingInstances #-} -#endif - --- | Pretty-printer for Language. - -module Language.EO.Phi.Syntax.Print where - -import Prelude - ( ($), (.) - , Bool(..), (==), (<) - , Int, Integer, Double, (+), (-), (*) - , String, (++) - , ShowS, showChar, showString - , all, elem, foldr, id, map, null, replicate, shows, span - ) -import Data.Char ( Char, isSpace ) -import qualified Language.EO.Phi.Syntax.Abs - --- | The top-level printing method. - -printTree :: Print a => a -> String -printTree = render . prt 0 - -type Doc = [ShowS] -> [ShowS] - -doc :: ShowS -> Doc -doc = (:) - -render :: Doc -> String -render d = rend 0 False (map ($ "") $ d []) "" - where - rend - :: Int -- ^ Indentation level. - -> Bool -- ^ Pending indentation to be output before next character? - -> [String] - -> ShowS - rend i p = \case - "[" :ts -> char '[' . rend i False ts - "(" :ts -> char '(' . rend i False ts - "{" :ts -> onNewLine i p . showChar '{' . new (i+1) ts - "}" : ";":ts -> onNewLine (i-1) p . showString "};" . new (i-1) ts - "}" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts - [";"] -> char ';' - ";" :ts -> char ';' . new i ts - t : ts@(s:_) | closingOrPunctuation s - -> pending . showString t . rend i False ts - t :ts -> pending . space t . rend i False ts - [] -> id - where - -- Output character after pending indentation. - char :: Char -> ShowS - char c = pending . showChar c - - -- Output pending indentation. - pending :: ShowS - pending = if p then indent i else id - - -- Indentation (spaces) for given indentation level. - indent :: Int -> ShowS - indent i = replicateS (2*i) (showChar ' ') - - -- Continue rendering in new line with new indentation. - new :: Int -> [String] -> ShowS - new j ts = showChar '\n' . rend j True ts - - -- Make sure we are on a fresh line. - onNewLine :: Int -> Bool -> ShowS - onNewLine i p = (if p then id else showChar '\n') . indent i - - -- Separate given string from following text by a space (if needed). - space :: String -> ShowS - space t s = - case (all isSpace t, null spc, null rest) of - (True , _ , True ) -> [] -- remove trailing space - (False, _ , True ) -> t -- remove trailing space - (False, True, False) -> t ++ ' ' : s -- add space if none - _ -> t ++ s - where - (spc, rest) = span isSpace s - - closingOrPunctuation :: String -> Bool - closingOrPunctuation [c] = c `elem` closerOrPunct - closingOrPunctuation _ = False - - closerOrPunct :: String - closerOrPunct = ")],;" - -parenth :: Doc -> Doc -parenth ss = doc (showChar '(') . ss . doc (showChar ')') - -concatS :: [ShowS] -> ShowS -concatS = foldr (.) id - -concatD :: [Doc] -> Doc -concatD = foldr (.) id - -replicateS :: Int -> ShowS -> ShowS -replicateS n f = concatS (replicate n f) - --- | The printer class does the job. - -class Print a where - prt :: Int -> a -> Doc - -instance {-# OVERLAPPABLE #-} Print a => Print [a] where - prt i = concatD . map (prt i) - -instance Print Char where - prt _ c = doc (showChar '\'' . mkEsc '\'' c . showChar '\'') - -instance Print String where - prt _ = printString - -printString :: String -> Doc -printString s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"') - -mkEsc :: Char -> Char -> ShowS -mkEsc q = \case - s | s == q -> showChar '\\' . showChar s - '\\' -> showString "\\\\" - '\n' -> showString "\\n" - '\t' -> showString "\\t" - s -> showChar s - -prPrec :: Int -> Int -> Doc -> Doc -prPrec i j = if j < i then parenth else id - -instance Print Integer where - prt _ x = doc (shows x) - -instance Print Double where - prt _ x = doc (shows x) - -instance Print Language.EO.Phi.Syntax.Abs.Bytes where - prt _ (Language.EO.Phi.Syntax.Abs.Bytes i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.Function where - prt _ (Language.EO.Phi.Syntax.Abs.Function i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.LabelId where - prt _ (Language.EO.Phi.Syntax.Abs.LabelId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.AlphaIndex where - prt _ (Language.EO.Phi.Syntax.Abs.AlphaIndex i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.LabelMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.LabelMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.TailMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.TailMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.BindingsMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.BindingsMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.ObjectMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.ObjectMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where - prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where - prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where - prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.Program where - prt i = \case - Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")]) - -instance Print Language.EO.Phi.Syntax.Abs.MetaId where - prt i = \case - Language.EO.Phi.Syntax.Abs.MetaIdLabel labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdTail tailmetaid -> prPrec i 0 (concatD [prt 0 tailmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdBytes bytesmetaid -> prPrec i 0 (concatD [prt 0 bytesmetaid]) - -instance Print Language.EO.Phi.Syntax.Abs.Object where - prt i = \case - Language.EO.Phi.Syntax.Abs.Formation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) - Language.EO.Phi.Syntax.Abs.Application object bindings -> prPrec i 0 (concatD [prt 0 object, doc (showString "("), prt 0 bindings, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ObjectDispatch object attribute -> prPrec i 0 (concatD [prt 0 object, doc (showString "."), prt 0 attribute]) - Language.EO.Phi.Syntax.Abs.GlobalObject -> prPrec i 0 (concatD [doc (showString "\934")]) - Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg -> prPrec i 0 (concatD [doc (showString "\934\775")]) - Language.EO.Phi.Syntax.Abs.ThisObject -> prPrec i 0 (concatD [doc (showString "\958")]) - Language.EO.Phi.Syntax.Abs.Termination -> prPrec i 0 (concatD [doc (showString "\8869")]) - Language.EO.Phi.Syntax.Abs.ConstString str -> prPrec i 0 (concatD [printString str]) - Language.EO.Phi.Syntax.Abs.ConstIntRaw integersigned -> prPrec i 0 (concatD [prt 0 integersigned]) - Language.EO.Phi.Syntax.Abs.ConstFloatRaw doublesigned -> prPrec i 0 (concatD [prt 0 doublesigned]) - Language.EO.Phi.Syntax.Abs.MetaSubstThis object1 object2 -> prPrec i 0 (concatD [prt 0 object1, doc (showString "["), doc (showString "\958"), doc (showString "\8614"), prt 0 object2, doc (showString "]")]) - Language.EO.Phi.Syntax.Abs.MetaContextualize object1 object2 -> prPrec i 0 (concatD [doc (showString "\8968"), prt 0 object1, doc (showString ","), prt 0 object2, doc (showString "\8969")]) - Language.EO.Phi.Syntax.Abs.MetaObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) - Language.EO.Phi.Syntax.Abs.MetaTailContext object tailmetaid -> prPrec i 0 (concatD [prt 0 object, doc (showString "*"), prt 0 tailmetaid]) - Language.EO.Phi.Syntax.Abs.MetaFunction metafunctionname object -> prPrec i 0 (concatD [prt 0 metafunctionname, doc (showString "("), prt 0 object, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ConstFloat d -> prPrec i 0 (concatD [prt 0 d]) - Language.EO.Phi.Syntax.Abs.ConstInt n -> prPrec i 0 (concatD [prt 0 n]) - -instance Print Language.EO.Phi.Syntax.Abs.Binding where - prt i = \case - Language.EO.Phi.Syntax.Abs.AlphaBinding attribute object -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), prt 0 object]) - Language.EO.Phi.Syntax.Abs.AlphaBindingSugar object -> prPrec i 0 (concatD [prt 0 object]) - Language.EO.Phi.Syntax.Abs.EmptyBinding attribute -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), doc (showString "\8709")]) - Language.EO.Phi.Syntax.Abs.DeltaBinding bytes -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytes]) - Language.EO.Phi.Syntax.Abs.DeltaEmptyBinding -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), doc (showString "\8709")]) - Language.EO.Phi.Syntax.Abs.LambdaBinding function -> prPrec i 0 (concatD [doc (showString "\955"), doc (showString "\10509"), prt 0 function]) - Language.EO.Phi.Syntax.Abs.MetaBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) - Language.EO.Phi.Syntax.Abs.MetaDeltaBinding bytesmetaid -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytesmetaid]) - -instance Print [Language.EO.Phi.Syntax.Abs.Binding] where - prt _ [] = concatD [] - prt _ [x] = concatD [prt 0 x] - prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] - -instance Print Language.EO.Phi.Syntax.Abs.Attribute where - prt i = \case - Language.EO.Phi.Syntax.Abs.Phi -> prPrec i 0 (concatD [doc (showString "\966")]) - Language.EO.Phi.Syntax.Abs.Rho -> prPrec i 0 (concatD [doc (showString "\961")]) - Language.EO.Phi.Syntax.Abs.Label labelid -> prPrec i 0 (concatD [prt 0 labelid]) - Language.EO.Phi.Syntax.Abs.Alpha alphaindex -> prPrec i 0 (concatD [prt 0 alphaindex]) - Language.EO.Phi.Syntax.Abs.MetaAttr labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) - Language.EO.Phi.Syntax.Abs.AttrSugar labelid labelids -> prPrec i 0 (concatD [doc (showString "~"), prt 0 labelid, doc (showString "("), prt 0 labelids, doc (showString ")")]) - -instance Print [Language.EO.Phi.Syntax.Abs.LabelId] where - prt _ [] = concatD [] - prt _ [x] = concatD [prt 0 x] - prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] - -instance Print Language.EO.Phi.Syntax.Abs.RuleAttribute where - prt i = \case - Language.EO.Phi.Syntax.Abs.ObjectAttr attribute -> prPrec i 0 (concatD [prt 0 attribute]) - Language.EO.Phi.Syntax.Abs.DeltaAttr -> prPrec i 0 (concatD [doc (showString "\916")]) - Language.EO.Phi.Syntax.Abs.LambdaAttr -> prPrec i 0 (concatD [doc (showString "\955")]) - -instance Print Language.EO.Phi.Syntax.Abs.PeeledObject where - prt i = \case - Language.EO.Phi.Syntax.Abs.PeeledObject objecthead objectactions -> prPrec i 0 (concatD [prt 0 objecthead, prt 0 objectactions]) - -instance Print Language.EO.Phi.Syntax.Abs.ObjectHead where - prt i = \case - Language.EO.Phi.Syntax.Abs.HeadFormation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) - Language.EO.Phi.Syntax.Abs.HeadGlobal -> prPrec i 0 (concatD [doc (showString "\934")]) - Language.EO.Phi.Syntax.Abs.HeadThis -> prPrec i 0 (concatD [doc (showString "\958")]) - Language.EO.Phi.Syntax.Abs.HeadTermination -> prPrec i 0 (concatD [doc (showString "\8869")]) - -instance Print Language.EO.Phi.Syntax.Abs.ObjectAction where - prt i = \case - Language.EO.Phi.Syntax.Abs.ActionApplication bindings -> prPrec i 0 (concatD [doc (showString "("), prt 0 bindings, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ActionDispatch attribute -> prPrec i 0 (concatD [doc (showString "."), prt 0 attribute]) - -instance Print [Language.EO.Phi.Syntax.Abs.ObjectAction] where - prt _ [] = concatD [] - prt _ (x:xs) = concatD [prt 0 x, prt 0 xs] +{-# OPTIONS_GHC -Wno-orphans #-} + +-- {-# LANGUAGE OverloadedStrings #-} + +module Language.EO.Phi.Pretty where + +import Language.EO.Phi.Syntax.Abs as Abs +import Prettyprinter + +instance Pretty Abs.Bytes where + pretty (Abs.Bytes i) = pretty i + +instance Pretty Abs.Function where + pretty (Abs.Function i) = pretty i + +instance Pretty Abs.LabelId where + pretty (Abs.LabelId i) = pretty i + +instance Pretty Abs.AlphaIndex where + pretty (Abs.AlphaIndex i) = pretty i + +instance Pretty Abs.LabelMetaId where + pretty (Abs.LabelMetaId i) = pretty i + +instance Pretty Abs.TailMetaId where + pretty (Abs.TailMetaId i) = pretty i + +instance Pretty Abs.BindingsMetaId where + pretty (Abs.BindingsMetaId i) = pretty i + +instance Pretty Abs.ObjectMetaId where + pretty (Abs.ObjectMetaId i) = pretty i + +instance Pretty Abs.BytesMetaId where + pretty (Abs.BytesMetaId i) = pretty i + +instance Pretty Abs.MetaFunctionName where + pretty (Abs.MetaFunctionName i) = pretty i + +instance Pretty Abs.IntegerSigned where + pretty (Abs.IntegerSigned i) = pretty i + +instance Pretty Abs.DoubleSigned where + pretty (Abs.DoubleSigned i) = pretty i + +instance Pretty Abs.Program where + pretty = \case + Abs.Program bindings -> + vsep + [ lbrace + , indent + 2 + ( vsep + [ pretty "⟦" + , indent 2 (pretty bindings) + , pretty "⟧" + ] + ) + , rbrace + ] + +instance Pretty Abs.MetaId where + pretty = \case + Abs.MetaIdLabel labelmetaid -> pretty labelmetaid + Abs.MetaIdTail tailmetaid -> pretty tailmetaid + Abs.MetaIdBindings bindingsmetaid -> pretty bindingsmetaid + Abs.MetaIdObject objectmetaid -> pretty objectmetaid + Abs.MetaIdBytes bytesmetaid -> pretty bytesmetaid + +instance Pretty Abs.Object where + pretty = \case + Abs.Formation bindings -> vsep [pretty "⟦", indent 2 (pretty bindings), pretty "⟧"] + Abs.Application object bindings -> vsep [pretty object <> lparen, indent 2 (pretty bindings), rparen] + Abs.ObjectDispatch object attribute -> pretty object <> pretty "." <> pretty attribute + Abs.GlobalObject -> pretty "Φ" + Abs.GlobalObjectPhiOrg -> pretty "Φ̇" + Abs.ThisObject -> pretty "ξ" + Abs.Termination -> pretty "⊥" + Abs.ConstString str -> pretty (show str) + Abs.ConstIntRaw integersigned -> pretty integersigned + Abs.ConstFloatRaw doublesigned -> pretty doublesigned + Abs.MetaSubstThis object1 object2 -> pretty object1 <+> lbracket <+> pretty "ξ ↦" <+> pretty object2 <+> rbracket + Abs.MetaContextualize object1 object2 -> pretty "⌈" <+> pretty object1 <> pretty "," <+> pretty object2 <> pretty "⌉" + Abs.MetaObject objectmetaid -> pretty objectmetaid + Abs.MetaTailContext object tailmetaid -> pretty object <+> pretty "*" <+> pretty tailmetaid + Abs.MetaFunction metafunctionname object -> vsep [pretty metafunctionname <+> lparen, pretty object, rparen] + Abs.ConstFloat d -> pretty d + Abs.ConstInt n -> pretty n + +instance Pretty Abs.Binding where + pretty = \case + Abs.AlphaBinding attribute object -> pretty attribute <+> pretty "↦" <+> pretty object + Abs.AlphaBindingSugar object -> pretty object + Abs.EmptyBinding attribute -> pretty attribute <+> pretty "↦ ∅" + Abs.DeltaBinding bytes -> pretty "Δ ⤍" <+> pretty bytes + Abs.DeltaEmptyBinding -> pretty "Δ ⤍ ∅" + Abs.LambdaBinding function -> pretty "λ ⤍" <+> pretty function + Abs.MetaBindings bindingsmetaid -> pretty bindingsmetaid + Abs.MetaDeltaBinding bytesmetaid -> pretty "Δ ⤍" <+> pretty bytesmetaid + +instance {-# OVERLAPPING #-} Pretty [Abs.Binding] where + pretty = vsep . punctuate comma . fmap pretty + +instance Pretty Abs.Attribute where + pretty = \case + Abs.Phi -> pretty "φ" + Abs.Rho -> pretty "ρ" + Abs.Label labelid -> pretty labelid + Abs.Alpha alphaindex -> pretty alphaindex + Abs.MetaAttr labelmetaid -> pretty labelmetaid + Abs.AttrSugar labelid labelids -> pretty labelid <> lparen <> pretty labelids <> rparen + +instance {-# OVERLAPPING #-} Pretty [Abs.LabelId] where + pretty = hsep . punctuate comma . fmap pretty + +instance Pretty Abs.RuleAttribute where + pretty = \case + Abs.ObjectAttr attribute -> pretty attribute + Abs.DeltaAttr -> pretty "Δ" + Abs.LambdaAttr -> pretty "λ" + +instance Pretty Abs.PeeledObject where + pretty = \case + Abs.PeeledObject objecthead objectactions -> pretty objecthead <+> pretty objectactions + +instance Pretty Abs.ObjectHead where + pretty = \case + Abs.HeadFormation bindings -> vsep [pretty "⟦", indent 2 (pretty bindings), pretty "⟧"] + Abs.HeadGlobal -> pretty "Φ" + Abs.HeadThis -> pretty "ξ" + Abs.HeadTermination -> pretty "⊥" + +instance Pretty Abs.ObjectAction where + pretty = \case + Abs.ActionApplication bindings -> vsep [lparen, indent 2 (pretty bindings), rparen] + Abs.ActionDispatch attribute -> pretty "." <> pretty attribute + +instance {-# OVERLAPPING #-} Pretty [Abs.ObjectAction] where + pretty = hsep . fmap pretty From f0597a21de45f5a3fde11c44fbf8b56e00a52464 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:46:46 +0300 Subject: [PATCH 42/69] fix(eo-phi-normalizer): use a new pretty printer --- .../src/Language/EO/Phi/Syntax.hs | 119 +++--------------- 1 file changed, 14 insertions(+), 105 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index b6d6e1746..cd3123d94 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -35,7 +35,6 @@ module Language.EO.Phi.Syntax ( module Language.EO.Phi.Syntax.Abs, desugar, printTree, - shrinkDots, -- * Conversion to 'Bytes' intToBytes, @@ -84,23 +83,25 @@ module Language.EO.Phi.Syntax ( import Data.ByteString (ByteString) import Data.ByteString qualified as ByteString.Strict -import Data.Char (isSpace, toUpper) +import Data.Char (toUpper) import Data.Int import Data.List (intercalate) import Data.Serialize qualified as Serialize import Data.String (IsString (fromString)) +import Data.Text qualified as T import Data.Text qualified as Text import Data.Text.Encoding qualified as Text import GHC.Float (isDoubleFinite) import Language.EO.Phi.Preprocess (preprocess) +import Language.EO.Phi.Pretty () import Language.EO.Phi.Syntax.Abs import Language.EO.Phi.Syntax.Lex (Token) import Language.EO.Phi.Syntax.Par -import Language.EO.Phi.Syntax.Print qualified as Phi import Numeric (readHex, showHex) +import Prettyprinter (LayoutOptions (..), PageWidth (..), Pretty (pretty), defaultLayoutOptions, layoutPretty) +import Prettyprinter.Render.Text (renderStrict) import PyF (fmt) import Text.Printf (printf) -import Text.Read (readMaybe) -- $setup -- >>> :set -XOverloadedStrings @@ -303,107 +304,6 @@ wrapBytesAsBool bytes | bytesToInt bytes == 0 = [fmt|Φ.org.eolang.false|] | otherwise = [fmt|Φ.org.eolang.true|] --- * Overriding generated pretty-printer - --- | Like 'Phi.printTree', but without spaces around dots and no indentation for curly braces. -printTree :: (Phi.Print a, SugarableFinally a) => a -> String -printTree = shrinkDots . render . Phi.prt 0 . sugarFinally - --- | Remove spaces around dots. --- --- >>> shrinkDots "a ↦ ξ . a" == "a ↦ ξ.a" --- True -shrinkDots :: String -> String -shrinkDots [] = [] -shrinkDots (' ' : '.' : ' ' : cs) = '.' : shrinkDots cs -shrinkDots (c : cs) = c : shrinkDots cs - -readFloat :: String -> Maybe Double -readFloat s | '.' `elem` s = readMaybe s -readFloat _ = Nothing - -fixFloat :: String -> String -fixFloat s = - case readFloat s of - Just x -> printf "%f" x - Nothing -> s - --- | Copy of 'Phi.render', except no indentation is made for curly braces. -render :: Phi.Doc -> String -render d = rend 0 False (map (fixFloat . ($ "")) $ d []) "" - where - rend :: - Int -> - -- \^ Indentation level. - Bool -> - -- \^ Pending indentation to be output before next character? - [String] -> - ShowS - rend i p = \case - "[" : "]" : ts -> showString "[]" . rend i False ts - "(" : ")" : (t : ts) -> handleTrailingComma "()" t ts - "⟦" : "⟧" : (t : ts) -> handleTrailingComma "⟦⟧" t ts - "[" : ts -> char '[' . rend i False ts - "(" : ts -> char '(' . new (i + 1) ts - "{" : "⟦" : ts -> showChar '{' . onNewLine (i + 1) p . showChar '⟦' . new (i + 2) ts - "⟦" : ts -> showChar '⟦' . new (i + 1) ts - ")" : "," : ts -> onNewLine (i - 1) p . showString ")," . new (i - 1) ts - "⟧" : "," : ts -> onNewLine (i - 1) p . showString "⟧," . new (i - 1) ts - ["⟧", "}"] -> onNewLine (i - 1) p . showChar '⟧' . new (i - 2) ["}"] - "⟧" : ts -> onNewLine (i - 1) p . showChar '⟧' . new (i - 1) ts - ")" : ts -> onNewLine (i - 1) p . showChar ')' . new (i - 1) ts - [";"] -> char ';' - ";" : ts -> char ';' . new i ts - "." : ts -> rend i p (" ." : ts) - t : (s : ss) | closingOrPunctuation s -> handleTrailingComma t s ss - t : ts -> pending . space t . rend i False ts - [] -> id - where - -- Output character after pending indentation. - char :: Char -> ShowS - char c = pending . showChar c - - handleTrailingComma str t ts = - (pending . showString str) - . ( case t of - "," -> showChar ',' . new i ts - _ -> rend i False (t : ts) - ) - - -- Output pending indentation. - pending :: ShowS - pending = if p then indent i else id - - -- Indentation (spaces) for given indentation level. - indent :: Int -> ShowS - indent i = Phi.replicateS (2 * i) (showChar ' ') - - -- Continue rendering in new line with new indentation. - new :: Int -> [String] -> ShowS - new j ts = showChar '\n' . rend j True ts - - -- Separate given string from following text by a space (if needed). - space :: String -> ShowS - space t s = - case (all isSpace t, null spc, null rest) of - (True, _, True) -> [] -- remove trailing space - (False, _, True) -> t -- remove trailing space - (False, True, False) -> t ++ ' ' : s -- add space if none - _ -> t ++ s - where - (spc, rest) = span isSpace s - - closingOrPunctuation :: String -> Bool - closingOrPunctuation [c] = c `elem` closerOrPunct - closingOrPunctuation _ = False - - closerOrPunct :: String - closerOrPunct = ")],;" - - -- Make sure we are on a fresh line. - onNewLine :: Int -> Bool -> ShowS - onNewLine i p = (if p then id else showChar '\n') . indent i - padLeft :: Int -> [Char] -> [Char] padLeft n s = replicate (n - length s) '0' ++ s @@ -750,3 +650,12 @@ unsafeParseWith parser input = case parseWith parser input of Left parseError -> error parseError Right object -> object + +-- | The top-level printing method. +printTree :: (Pretty a, SugarableFinally a) => a -> String +printTree = + T.unpack + . renderStrict + . layoutPretty defaultLayoutOptions{layoutPageWidth = Unbounded} + . pretty + . sugarFinally From e9bc42b2033354f0c01b0aef9a47e0c7bf343cd2 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 15:59:42 +0300 Subject: [PATCH 43/69] fix(eo-phi-normalizer): don't use generated Print module --- eo-phi-normalizer/Setup.hs | 3 +- eo-phi-normalizer/eo-phi-normalizer.cabal | 2 - .../src/Language/EO/Phi/Syntax/Print.hs | 283 ------------------ 3 files changed, 1 insertion(+), 287 deletions(-) delete mode 100644 eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs diff --git a/eo-phi-normalizer/Setup.hs b/eo-phi-normalizer/Setup.hs index 11f5f6fc8..5a30e7105 100644 --- a/eo-phi-normalizer/Setup.hs +++ b/eo-phi-normalizer/Setup.hs @@ -90,7 +90,7 @@ main = , "cd src/Language/EO/Phi/Syntax" , "alex Lex.x" , "happy --info Par.y" - , "rm ErrM.hs Skel.hs Test.hs Abs.hs.bak Print.hs.bak" + , "rm -f Print.hs ErrM.hs Skel.hs Test.hs Abs.hs.bak Print.hs.bak" , "true" ] @@ -100,7 +100,6 @@ main = _ <- callCommand fullCommand _ <- addLicense "Abs.hs" - _ <- addLicense "Print.hs" postConf simpleUserHooks args flags packageDesc localBuildInfo } diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index fa1f3dd10..8eb482f3a 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -296,7 +296,6 @@ library Language.EO.Phi.Syntax.Abs Language.EO.Phi.Syntax.Lex Language.EO.Phi.Syntax.Par - Language.EO.Phi.Syntax.Print Language.EO.Phi.TH Language.EO.Phi.ToLaTeX Language.EO.Test.Yaml @@ -428,7 +427,6 @@ test-suite doctests Language.EO.Phi.Syntax.Abs Language.EO.Phi.Syntax.Lex Language.EO.Phi.Syntax.Par - Language.EO.Phi.Syntax.Print Language.EO.Phi.TH Language.EO.Phi.ToLaTeX Language.EO.Test.Yaml diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs deleted file mode 100644 index 778131c4d..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs +++ /dev/null @@ -1,283 +0,0 @@ -{- -Copyright EO/Polystat Development Team (c) 2023 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of EO/Polystat Development Team nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --} - --- File generated by the BNF Converter (bnfc 2.9.5). - -{-# LANGUAGE CPP #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE LambdaCase #-} -#if __GLASGOW_HASKELL__ <= 708 -{-# LANGUAGE OverlappingInstances #-} -#endif - --- | Pretty-printer for Language. - -module Language.EO.Phi.Syntax.Print where - -import Prelude - ( ($), (.) - , Bool(..), (==), (<) - , Int, Integer, Double, (+), (-), (*) - , String, (++) - , ShowS, showChar, showString - , all, elem, foldr, id, map, null, replicate, shows, span - ) -import Data.Char ( Char, isSpace ) -import qualified Language.EO.Phi.Syntax.Abs - --- | The top-level printing method. - -printTree :: Print a => a -> String -printTree = render . prt 0 - -type Doc = [ShowS] -> [ShowS] - -doc :: ShowS -> Doc -doc = (:) - -render :: Doc -> String -render d = rend 0 False (map ($ "") $ d []) "" - where - rend - :: Int -- ^ Indentation level. - -> Bool -- ^ Pending indentation to be output before next character? - -> [String] - -> ShowS - rend i p = \case - "[" :ts -> char '[' . rend i False ts - "(" :ts -> char '(' . rend i False ts - "{" :ts -> onNewLine i p . showChar '{' . new (i+1) ts - "}" : ";":ts -> onNewLine (i-1) p . showString "};" . new (i-1) ts - "}" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts - [";"] -> char ';' - ";" :ts -> char ';' . new i ts - t : ts@(s:_) | closingOrPunctuation s - -> pending . showString t . rend i False ts - t :ts -> pending . space t . rend i False ts - [] -> id - where - -- Output character after pending indentation. - char :: Char -> ShowS - char c = pending . showChar c - - -- Output pending indentation. - pending :: ShowS - pending = if p then indent i else id - - -- Indentation (spaces) for given indentation level. - indent :: Int -> ShowS - indent i = replicateS (2*i) (showChar ' ') - - -- Continue rendering in new line with new indentation. - new :: Int -> [String] -> ShowS - new j ts = showChar '\n' . rend j True ts - - -- Make sure we are on a fresh line. - onNewLine :: Int -> Bool -> ShowS - onNewLine i p = (if p then id else showChar '\n') . indent i - - -- Separate given string from following text by a space (if needed). - space :: String -> ShowS - space t s = - case (all isSpace t, null spc, null rest) of - (True , _ , True ) -> [] -- remove trailing space - (False, _ , True ) -> t -- remove trailing space - (False, True, False) -> t ++ ' ' : s -- add space if none - _ -> t ++ s - where - (spc, rest) = span isSpace s - - closingOrPunctuation :: String -> Bool - closingOrPunctuation [c] = c `elem` closerOrPunct - closingOrPunctuation _ = False - - closerOrPunct :: String - closerOrPunct = ")],;" - -parenth :: Doc -> Doc -parenth ss = doc (showChar '(') . ss . doc (showChar ')') - -concatS :: [ShowS] -> ShowS -concatS = foldr (.) id - -concatD :: [Doc] -> Doc -concatD = foldr (.) id - -replicateS :: Int -> ShowS -> ShowS -replicateS n f = concatS (replicate n f) - --- | The printer class does the job. - -class Print a where - prt :: Int -> a -> Doc - -instance {-# OVERLAPPABLE #-} Print a => Print [a] where - prt i = concatD . map (prt i) - -instance Print Char where - prt _ c = doc (showChar '\'' . mkEsc '\'' c . showChar '\'') - -instance Print String where - prt _ = printString - -printString :: String -> Doc -printString s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"') - -mkEsc :: Char -> Char -> ShowS -mkEsc q = \case - s | s == q -> showChar '\\' . showChar s - '\\' -> showString "\\\\" - '\n' -> showString "\\n" - '\t' -> showString "\\t" - s -> showChar s - -prPrec :: Int -> Int -> Doc -> Doc -prPrec i j = if j < i then parenth else id - -instance Print Integer where - prt _ x = doc (shows x) - -instance Print Double where - prt _ x = doc (shows x) - -instance Print Language.EO.Phi.Syntax.Abs.Bytes where - prt _ (Language.EO.Phi.Syntax.Abs.Bytes i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.Function where - prt _ (Language.EO.Phi.Syntax.Abs.Function i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.LabelId where - prt _ (Language.EO.Phi.Syntax.Abs.LabelId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.AlphaIndex where - prt _ (Language.EO.Phi.Syntax.Abs.AlphaIndex i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.LabelMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.LabelMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.TailMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.TailMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.BindingsMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.BindingsMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.ObjectMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.ObjectMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where - prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where - prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where - prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where - prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.Program where - prt i = \case - Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")]) - -instance Print Language.EO.Phi.Syntax.Abs.MetaId where - prt i = \case - Language.EO.Phi.Syntax.Abs.MetaIdLabel labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdTail tailmetaid -> prPrec i 0 (concatD [prt 0 tailmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) - Language.EO.Phi.Syntax.Abs.MetaIdBytes bytesmetaid -> prPrec i 0 (concatD [prt 0 bytesmetaid]) - -instance Print Language.EO.Phi.Syntax.Abs.Object where - prt i = \case - Language.EO.Phi.Syntax.Abs.Formation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) - Language.EO.Phi.Syntax.Abs.Application object bindings -> prPrec i 0 (concatD [prt 0 object, doc (showString "("), prt 0 bindings, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ObjectDispatch object attribute -> prPrec i 0 (concatD [prt 0 object, doc (showString "."), prt 0 attribute]) - Language.EO.Phi.Syntax.Abs.GlobalObject -> prPrec i 0 (concatD [doc (showString "\934")]) - Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg -> prPrec i 0 (concatD [doc (showString "\934\775")]) - Language.EO.Phi.Syntax.Abs.ThisObject -> prPrec i 0 (concatD [doc (showString "\958")]) - Language.EO.Phi.Syntax.Abs.Termination -> prPrec i 0 (concatD [doc (showString "\8869")]) - Language.EO.Phi.Syntax.Abs.ConstString str -> prPrec i 0 (concatD [printString str]) - Language.EO.Phi.Syntax.Abs.ConstIntRaw integersigned -> prPrec i 0 (concatD [prt 0 integersigned]) - Language.EO.Phi.Syntax.Abs.ConstFloatRaw doublesigned -> prPrec i 0 (concatD [prt 0 doublesigned]) - Language.EO.Phi.Syntax.Abs.MetaSubstThis object1 object2 -> prPrec i 0 (concatD [prt 0 object1, doc (showString "["), doc (showString "\958"), doc (showString "\8614"), prt 0 object2, doc (showString "]")]) - Language.EO.Phi.Syntax.Abs.MetaContextualize object1 object2 -> prPrec i 0 (concatD [doc (showString "\8968"), prt 0 object1, doc (showString ","), prt 0 object2, doc (showString "\8969")]) - Language.EO.Phi.Syntax.Abs.MetaObject objectmetaid -> prPrec i 0 (concatD [prt 0 objectmetaid]) - Language.EO.Phi.Syntax.Abs.MetaTailContext object tailmetaid -> prPrec i 0 (concatD [prt 0 object, doc (showString "*"), prt 0 tailmetaid]) - Language.EO.Phi.Syntax.Abs.MetaFunction metafunctionname object -> prPrec i 0 (concatD [prt 0 metafunctionname, doc (showString "("), prt 0 object, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ConstFloat d -> prPrec i 0 (concatD [prt 0 d]) - Language.EO.Phi.Syntax.Abs.ConstInt n -> prPrec i 0 (concatD [prt 0 n]) - -instance Print Language.EO.Phi.Syntax.Abs.Binding where - prt i = \case - Language.EO.Phi.Syntax.Abs.AlphaBinding attribute object -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), prt 0 object]) - Language.EO.Phi.Syntax.Abs.AlphaBindingSugar object -> prPrec i 0 (concatD [prt 0 object]) - Language.EO.Phi.Syntax.Abs.EmptyBinding attribute -> prPrec i 0 (concatD [prt 0 attribute, doc (showString "\8614"), doc (showString "\8709")]) - Language.EO.Phi.Syntax.Abs.DeltaBinding bytes -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytes]) - Language.EO.Phi.Syntax.Abs.DeltaEmptyBinding -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), doc (showString "\8709")]) - Language.EO.Phi.Syntax.Abs.LambdaBinding function -> prPrec i 0 (concatD [doc (showString "\955"), doc (showString "\10509"), prt 0 function]) - Language.EO.Phi.Syntax.Abs.MetaBindings bindingsmetaid -> prPrec i 0 (concatD [prt 0 bindingsmetaid]) - Language.EO.Phi.Syntax.Abs.MetaDeltaBinding bytesmetaid -> prPrec i 0 (concatD [doc (showString "\916"), doc (showString "\10509"), prt 0 bytesmetaid]) - -instance Print [Language.EO.Phi.Syntax.Abs.Binding] where - prt _ [] = concatD [] - prt _ [x] = concatD [prt 0 x] - prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] - -instance Print Language.EO.Phi.Syntax.Abs.Attribute where - prt i = \case - Language.EO.Phi.Syntax.Abs.Phi -> prPrec i 0 (concatD [doc (showString "\966")]) - Language.EO.Phi.Syntax.Abs.Rho -> prPrec i 0 (concatD [doc (showString "\961")]) - Language.EO.Phi.Syntax.Abs.Label labelid -> prPrec i 0 (concatD [prt 0 labelid]) - Language.EO.Phi.Syntax.Abs.Alpha alphaindex -> prPrec i 0 (concatD [prt 0 alphaindex]) - Language.EO.Phi.Syntax.Abs.MetaAttr labelmetaid -> prPrec i 0 (concatD [prt 0 labelmetaid]) - Language.EO.Phi.Syntax.Abs.AttrSugar labelid labelids -> prPrec i 0 (concatD [doc (showString "~"), prt 0 labelid, doc (showString "("), prt 0 labelids, doc (showString ")")]) - -instance Print [Language.EO.Phi.Syntax.Abs.LabelId] where - prt _ [] = concatD [] - prt _ [x] = concatD [prt 0 x] - prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs] - -instance Print Language.EO.Phi.Syntax.Abs.RuleAttribute where - prt i = \case - Language.EO.Phi.Syntax.Abs.ObjectAttr attribute -> prPrec i 0 (concatD [prt 0 attribute]) - Language.EO.Phi.Syntax.Abs.DeltaAttr -> prPrec i 0 (concatD [doc (showString "\916")]) - Language.EO.Phi.Syntax.Abs.LambdaAttr -> prPrec i 0 (concatD [doc (showString "\955")]) - -instance Print Language.EO.Phi.Syntax.Abs.PeeledObject where - prt i = \case - Language.EO.Phi.Syntax.Abs.PeeledObject objecthead objectactions -> prPrec i 0 (concatD [prt 0 objecthead, prt 0 objectactions]) - -instance Print Language.EO.Phi.Syntax.Abs.ObjectHead where - prt i = \case - Language.EO.Phi.Syntax.Abs.HeadFormation bindings -> prPrec i 0 (concatD [doc (showString "\10214"), prt 0 bindings, doc (showString "\10215")]) - Language.EO.Phi.Syntax.Abs.HeadGlobal -> prPrec i 0 (concatD [doc (showString "\934")]) - Language.EO.Phi.Syntax.Abs.HeadThis -> prPrec i 0 (concatD [doc (showString "\958")]) - Language.EO.Phi.Syntax.Abs.HeadTermination -> prPrec i 0 (concatD [doc (showString "\8869")]) - -instance Print Language.EO.Phi.Syntax.Abs.ObjectAction where - prt i = \case - Language.EO.Phi.Syntax.Abs.ActionApplication bindings -> prPrec i 0 (concatD [doc (showString "("), prt 0 bindings, doc (showString ")")]) - Language.EO.Phi.Syntax.Abs.ActionDispatch attribute -> prPrec i 0 (concatD [doc (showString "."), prt 0 attribute]) - -instance Print [Language.EO.Phi.Syntax.Abs.ObjectAction] where - prt _ [] = concatD [] - prt _ (x:xs) = concatD [prt 0 x, prt 0 xs] From 396b9012d627515cc94ce171ea0b5dbd141265c8 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:01:25 +0300 Subject: [PATCH 44/69] fix(eo-phi-normalizer): add and simplify instances --- .../src/Language/EO/Phi/Syntax.hs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index cd3123d94..9508747ab 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -115,6 +115,7 @@ errorExpectedDesugaredBinding x = error ("impossible: expected desugared Binding class DesugarableInitially a where desugarInitially :: a -> a + desugarInitially = id instance DesugarableInitially Object where desugarInitially :: Object -> Object @@ -160,14 +161,15 @@ instance DesugarableInitially Binding where AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) obj -> obj -instance DesugarableInitially Attribute where desugarInitially = id -instance DesugarableInitially RuleAttribute where desugarInitially = id -instance DesugarableInitially PeeledObject where desugarInitially = id -instance DesugarableInitially ObjectHead where desugarInitially = id -instance DesugarableInitially MetaId where desugarInitially = id +instance DesugarableInitially Attribute +instance DesugarableInitially RuleAttribute +instance DesugarableInitially PeeledObject +instance DesugarableInitially ObjectHead +instance DesugarableInitially MetaId class SugarableFinally a where sugarFinally :: a -> a + sugarFinally = id instance SugarableFinally Program where sugarFinally :: Program -> Program @@ -216,6 +218,15 @@ instance SugarableFinally Binding where AlphaBinding a obj -> AlphaBinding a (sugarFinally obj) x -> x +instance SugarableFinally ObjectMetaId +instance SugarableFinally BindingsMetaId +instance SugarableFinally LabelMetaId +instance SugarableFinally BytesMetaId +instance SugarableFinally Attribute +instance SugarableFinally TailMetaId +instance SugarableFinally Bytes +instance SugarableFinally MetaId + desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) From ad944dd531b187fb6891e655b910c63579d7ab5e Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:06:53 +0300 Subject: [PATCH 45/69] chore(eo): switch 0.49.3 -> 0.49.4 --- eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo b/eo index e6e5f99c2..115e7ff6e 160000 --- a/eo +++ b/eo @@ -1 +1 @@ -Subproject commit e6e5f99c20f23ab8c27ece633efedc73309289f5 +Subproject commit 115e7ff6e9564f01c3b4bff2e35c1568a45633ed From caa9041e4c9037563bd12ad5b8fb65ffac37fd77 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:16:24 +0300 Subject: [PATCH 46/69] fix(ci): use arrays --- .github/workflows/ghc.yml | 11 ++++++----- scripts/lib.sh | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ghc.yml b/.github/workflows/ghc.yml index e0a199899..8aecd9681 100644 --- a/.github/workflows/ghc.yml +++ b/.github/workflows/ghc.yml @@ -271,14 +271,15 @@ jobs: if: always() && env.branch_is_not_master && runner.os == 'Linux' && steps.check-pipeline-lock.outputs.PIPELINE_LOCK_CHANGED run: | source scripts/lib.sh - commit_and_push_if_changed "$PIPELINE_LOCK_FILE_RELATIVE" "$PIPELINE_LOCK_FILE_RELATIVE" + paths=("$PIPELINE_LOCK_FILE_RELATIVE") + commit_and_push_if_changed "$PIPELINE_LOCK_FILE_RELATIVE" "$paths" - name: Commit and push changes in eo-phi-normalizer data files if: always() && env.branch_is_not_master && runner.os == 'Linux' run: | source scripts/lib.sh - data_directory="$PIPELINE_EO_PHI_NORMALIZER_DATA_DIR" - commit_and_push_if_changed "$data_directory" "eo-phi-normalizer data files" + paths=("$PIPELINE_EO_PHI_NORMALIZER_DATA_DIR") + commit_and_push_if_changed "eo-phi-normalizer data files" "$paths" - name: Install mdsh if: env.branch_is_not_master && runner.os == 'Linux' @@ -296,8 +297,8 @@ jobs: if: env.branch_is_not_master && runner.os == 'Linux' run: | source scripts/lib.sh - files=('site' 'proposals' 'README.md' 'CONTRIBUTING.md') - commit_and_push_if_changed "$files" "Markdown files" + paths=('site' 'proposals' 'README.md' 'CONTRIBUTING.md') + commit_and_push_if_changed "Markdown files" "$paths" - name: Create a directory for docs if: runner.os == 'Linux' diff --git a/scripts/lib.sh b/scripts/lib.sh index ef5ee460c..ffc4d50e8 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -169,8 +169,8 @@ function get_eo_version { export -f get_eo_version function commit_and_push_if_changed { - local files="$1" - local updated_message="$2" + local updated_message="$1" + local files="$2" if [ -n "$(git status --porcelain "${files[@]}")" ]; then git add "${files[@]}" git commit -m "Update $updated_message" From b4c36b19eb01bb976e1567ba568edfafaa4c75cf Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:16:31 +0300 Subject: [PATCH 47/69] feat(eo-phi-normalizer): add data files for EO 0.49.3 to .cabal --- eo-phi-normalizer/eo-phi-normalizer.cabal | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 8eb482f3a..11fe8679c 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -250,6 +250,66 @@ extra-source-files: data/0.49.1/org/eolang/txt/sscanf.phi data/0.49.1/org/eolang/txt/text.phi data/0.49.1/org/eolang/while.phi + data/0.49.3/dependencies.md + data/0.49.3/org/eolang/as-phi.phi + data/0.49.3/org/eolang/bytes.phi + data/0.49.3/org/eolang/cti.phi + data/0.49.3/org/eolang/dataized.phi + data/0.49.3/org/eolang/error.phi + data/0.49.3/org/eolang/false.phi + data/0.49.3/org/eolang/fs/dir.phi + data/0.49.3/org/eolang/fs/file.phi + data/0.49.3/org/eolang/fs/path.phi + data/0.49.3/org/eolang/fs/tmpdir.phi + data/0.49.3/org/eolang/go.phi + data/0.49.3/org/eolang/i16.phi + data/0.49.3/org/eolang/i32.phi + data/0.49.3/org/eolang/i64.phi + data/0.49.3/org/eolang/io/bytes-as-input.phi + data/0.49.3/org/eolang/io/console.phi + data/0.49.3/org/eolang/io/dead-input.phi + data/0.49.3/org/eolang/io/dead-output.phi + data/0.49.3/org/eolang/io/input-length.phi + data/0.49.3/org/eolang/io/malloc-as-output.phi + data/0.49.3/org/eolang/io/stdin.phi + data/0.49.3/org/eolang/io/stdout.phi + data/0.49.3/org/eolang/io/tee-input.phi + data/0.49.3/org/eolang/malloc.phi + data/0.49.3/org/eolang/math/angle.phi + data/0.49.3/org/eolang/math/e.phi + data/0.49.3/org/eolang/math/integral.phi + data/0.49.3/org/eolang/math/numbers.phi + data/0.49.3/org/eolang/math/pi.phi + data/0.49.3/org/eolang/math/random.phi + data/0.49.3/org/eolang/math/real.phi + data/0.49.3/org/eolang/nan.phi + data/0.49.3/org/eolang/negative-infinity.phi + data/0.49.3/org/eolang/net/socket.phi + data/0.49.3/org/eolang/number.phi + data/0.49.3/org/eolang/positive-infinity.phi + data/0.49.3/org/eolang/seq.phi + data/0.49.3/org/eolang/string.phi + data/0.49.3/org/eolang/structs/bytes-as-array.phi + data/0.49.3/org/eolang/structs/hash-code-of.phi + data/0.49.3/org/eolang/structs/list.phi + data/0.49.3/org/eolang/structs/map.phi + data/0.49.3/org/eolang/structs/range-of-ints.phi + data/0.49.3/org/eolang/structs/range.phi + data/0.49.3/org/eolang/structs/set.phi + data/0.49.3/org/eolang/switch.phi + data/0.49.3/org/eolang/sys/getenv.phi + data/0.49.3/org/eolang/sys/line-separator.phi + data/0.49.3/org/eolang/sys/os.phi + data/0.49.3/org/eolang/sys/posix.phi + data/0.49.3/org/eolang/sys/win32.phi + data/0.49.3/org/eolang/true.phi + data/0.49.3/org/eolang/try.phi + data/0.49.3/org/eolang/tuple.phi + data/0.49.3/org/eolang/txt/regex.phi + data/0.49.3/org/eolang/txt/sprintf.phi + data/0.49.3/org/eolang/txt/sscanf.phi + data/0.49.3/org/eolang/txt/text.phi + data/0.49.3/org/eolang/while.phi test/eo/phi/rules/new.yaml test/eo/phi/rules/streams.yaml From 1b84ca77db9b0f70e8daf90f1a8a33a4dac189ec Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:20:03 +0300 Subject: [PATCH 48/69] fix(eo-phi-normalizer): add license note --- .../src/Language/EO/Phi/Pretty.hs | 56 ++++++++----------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs index b1a414f71..f6c6a64aa 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -1,36 +1,26 @@ -{- -Copyright EO/Polystat Development Team (c) 2023 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of EO/Polystat Development Team nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --} --- File generated by the BNF Converter (bnfc 2.9.5). +{- FOURMOLU_DISABLE -} +-- The MIT License (MIT) + +-- Copyright (c) 2016-2024 Objectionary.com + +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: + +-- The above copyright notice and this permission notice shall be included +-- in all copies or substantial portions of the Software. + +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-- SOFTWARE. +{- FOURMOLU_ENABLE -} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -Wno-orphans #-} From f83b32d9bb55032caf2afb0cb9fc7926ae691977 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Dec 2024 13:25:54 +0000 Subject: [PATCH 49/69] Update pipeline/pipeline.lock --- pipeline/pipeline.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index b0ab47f7a..95285e6ef 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ -EO_HEAD_HASH="e6e5f99c20f23ab8c27ece633efedc73309289f5" +EO_HEAD_HASH="115e7ff6e9564f01c3b4bff2e35c1568a45633ed" PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" From 5f985056829a47fa95b38114f321502a03745f6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Dec 2024 13:25:54 +0000 Subject: [PATCH 50/69] Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.49.4/dependencies.md | 3904 +++++++++++++++++ .../data/0.49.4/org/eolang/bytes.phi | 95 + .../data/0.49.4/org/eolang/cti.phi | 11 + .../data/0.49.4/org/eolang/dataized.phi | 18 + .../data/0.49.4/org/eolang/error.phi | 11 + .../data/0.49.4/org/eolang/false.phi | 21 + .../data/0.49.4/org/eolang/fs/dir.phi | 71 + .../data/0.49.4/org/eolang/fs/file.phi | 164 + .../data/0.49.4/org/eolang/fs/path.phi | 273 ++ .../data/0.49.4/org/eolang/fs/tmpdir.phi | 39 + .../data/0.49.4/org/eolang/go.phi | 34 + .../data/0.49.4/org/eolang/i16.phi | 67 + .../data/0.49.4/org/eolang/i32.phi | 79 + .../data/0.49.4/org/eolang/i64.phi | 59 + .../0.49.4/org/eolang/io/bytes-as-input.phi | 36 + .../data/0.49.4/org/eolang/io/console.phi | 122 + .../data/0.49.4/org/eolang/io/dead-input.phi | 22 + .../data/0.49.4/org/eolang/io/dead-output.phi | 22 + .../0.49.4/org/eolang/io/input-length.phi | 21 + .../0.49.4/org/eolang/io/malloc-as-output.phi | 30 + .../data/0.49.4/org/eolang/io/stdin.phi | 45 + .../data/0.49.4/org/eolang/io/stdout.phi | 18 + .../data/0.49.4/org/eolang/io/tee-input.phi | 34 + .../data/0.49.4/org/eolang/malloc.phi | 55 + .../data/0.49.4/org/eolang/math/angle.phi | 30 + .../data/0.49.4/org/eolang/math/e.phi | 12 + .../data/0.49.4/org/eolang/math/integral.phi | 66 + .../data/0.49.4/org/eolang/math/numbers.phi | 42 + .../data/0.49.4/org/eolang/math/pi.phi | 12 + .../data/0.49.4/org/eolang/math/random.phi | 53 + .../data/0.49.4/org/eolang/math/real.phi | 49 + .../data/0.49.4/org/eolang/nan.phi | 44 + .../0.49.4/org/eolang/negative-infinity.phi | 61 + .../data/0.49.4/org/eolang/net/socket.phi | 535 +++ .../data/0.49.4/org/eolang/number.phi | 74 + .../0.49.4/org/eolang/positive-infinity.phi | 61 + .../data/0.49.4/org/eolang/seq.phi | 17 + .../data/0.49.4/org/eolang/string.phi | 155 + .../org/eolang/structs/bytes-as-array.phi | 23 + .../org/eolang/structs/hash-code-of.phi | 30 + .../data/0.49.4/org/eolang/structs/list.phi | 194 + .../data/0.49.4/org/eolang/structs/map.phi | 122 + .../org/eolang/structs/range-of-ints.phi | 26 + .../data/0.49.4/org/eolang/structs/range.phi | 23 + .../data/0.49.4/org/eolang/structs/set.phi | 37 + .../data/0.49.4/org/eolang/switch.phi | 18 + .../data/0.49.4/org/eolang/sys/getenv.phi | 19 + .../0.49.4/org/eolang/sys/line-separator.phi | 14 + .../data/0.49.4/org/eolang/sys/os.phi | 23 + .../data/0.49.4/org/eolang/sys/posix.phi | 35 + .../data/0.49.4/org/eolang/sys/win32.phi | 38 + .../data/0.49.4/org/eolang/true.phi | 21 + .../data/0.49.4/org/eolang/try.phi | 11 + .../data/0.49.4/org/eolang/tuple.phi | 39 + .../data/0.49.4/org/eolang/txt/regex.phi | 56 + .../data/0.49.4/org/eolang/txt/sprintf.phi | 14 + .../data/0.49.4/org/eolang/txt/sscanf.phi | 14 + .../data/0.49.4/org/eolang/txt/text.phi | 275 ++ .../data/0.49.4/org/eolang/while.phi | 22 + 59 files changed, 7516 insertions(+) create mode 100644 eo-phi-normalizer/data/0.49.4/dependencies.md create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/bytes.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/cti.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/dataized.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/error.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/false.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/fs/dir.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/fs/file.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/fs/path.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/fs/tmpdir.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/go.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/i16.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/i32.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/i64.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/bytes-as-input.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/console.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-input.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-output.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/input-length.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/malloc-as-output.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/stdin.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/stdout.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/io/tee-input.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/malloc.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/angle.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/e.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/integral.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/numbers.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/pi.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/random.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/math/real.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/nan.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/negative-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/net/socket.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/number.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/positive-infinity.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/seq.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/string.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/bytes-as-array.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/hash-code-of.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/list.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/map.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/range-of-ints.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/range.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/structs/set.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/switch.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/sys/getenv.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/sys/line-separator.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/sys/os.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/sys/posix.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/sys/win32.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/true.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/try.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/tuple.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/txt/regex.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/txt/sprintf.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/txt/sscanf.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/txt/text.phi create mode 100644 eo-phi-normalizer/data/0.49.4/org/eolang/while.phi diff --git a/eo-phi-normalizer/data/0.49.4/dependencies.md b/eo-phi-normalizer/data/0.49.4/dependencies.md new file mode 100644 index 000000000..24417f6c7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/dependencies.md @@ -0,0 +1,3904 @@ +# Dependencies + +## [org/eolang/bytes.phi](./org/eolang/bytes.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number() ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/cti.phi](./org/eolang/cti.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/dataized.phi](./org/eolang/dataized.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/error.phi](./org/eolang/error.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/false.phi](./org/eolang/false.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + false() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/dir.phi](./org/eolang/fs/dir.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted() ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/file.phi](./org/eolang/fs/file.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path() ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/path.phi](./org/eolang/fs/path.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute() ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/tmpdir.phi](./org/eolang/fs/tmpdir.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + tmpdir() ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1() ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/go.phi](./org/eolang/go.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + go() ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token() ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i16.phi](./org/eolang/i16.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32() ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i32.phi](./org/eolang/i32.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i64.phi](./org/eolang/i64.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number() ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/bytes-as-input.phi](./org/eolang/io/bytes-as-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/console.phi](./org/eolang/io/console.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + console() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-input() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-output() ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block() ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/input-length.phi](./org/eolang/io/input-length.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/malloc-as-output.phi](./org/eolang/io/malloc-as-output.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdin.phi](./org/eolang/io/stdin.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdin() ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines() ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line() ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdout.phi](./org/eolang/io/stdout.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/tee-input.phi](./org/eolang/io/tee-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/malloc.phi](./org/eolang/malloc.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + malloc() ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/angle.phi](./org/eolang/math/angle.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan() ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan() ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/e.phi](./org/eolang/math/e.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/integral.phi](./org/eolang/math/integral.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/numbers.phi](./org/eolang/math/numbers.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/pi.phi](./org/eolang/math/pi.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/random.phi](./org/eolang/math/random.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo() ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/real.phi](./org/eolang/math/real.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod() ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs() ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/nan.phi](./org/eolang/nan.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + nan() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + negative-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/net/socket.phi](./org/eolang/net/socket.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + net() ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror() ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error() ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/number.phi](./org/eolang/number.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor() ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer() ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite() ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + positive-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/seq.phi](./org/eolang/seq.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/string.phi](./org/eolang/string.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length() ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/bytes-as-array.phi](./org/eolang/structs/bytes-as-array.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/hash-code-of.phi](./org/eolang/structs/hash-code-of.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/list.phi](./org/eolang/structs/list.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted() ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/map.phi](./org/eolang/structs/map.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54() ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found() ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12() ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6() ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18() ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range-of-ints.phi](./org/eolang/structs/range-of-ints.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8() ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range.phi](./org/eolang/structs/range.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/set.phi](./org/eolang/structs/set.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/switch.phi](./org/eolang/switch.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/getenv.phi](./org/eolang/sys/getenv.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/line-separator.phi](./org/eolang/sys/line-separator.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + line-separator() ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/os.phi](./org/eolang/sys/os.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + os() ↦ ⟦ + φ ↦ ξ.name, + is-windows() ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/posix.phi](./org/eolang/sys/posix.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/win32.phi](./org/eolang/sys/win32.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/true.phi](./org/eolang/true.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + true() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/try.phi](./org/eolang/try.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/tuple.phi](./org/eolang/tuple.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty() ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/regex.phi](./org/eolang/txt/regex.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled() ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sprintf.phi](./org/eolang/txt/sprintf.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sscanf.phi](./org/eolang/txt/sscanf.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/text.phi](./org/eolang/txt/text.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased() ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased() ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number() ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/while.phi](./org/eolang/while.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/bytes.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/bytes.phi new file mode 100644 index 000000000..3ea77b146 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/bytes.phi @@ -0,0 +1,95 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number() ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", Φ̇.tuple.empty + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/cti.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/cti.phi new file mode 100644 index 000000000..f5f437e2b --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/cti.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/dataized.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/dataized.phi new file mode 100644 index 000000000..401169b55 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/dataized.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/error.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/error.phi new file mode 100644 index 000000000..ab9f2ef00 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/error.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/false.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/false.phi new file mode 100644 index 000000000..f0859bbab --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/false.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + false() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/fs/dir.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/dir.phi new file mode 100644 index 000000000..b361844f5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/dir.phi @@ -0,0 +1,71 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted() ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/fs/file.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/file.phi new file mode 100644 index 000000000..a3976389f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/file.phi @@ -0,0 +1,164 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path() ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-216-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-216-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-258-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-258-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/fs/path.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/path.phi new file mode 100644 index 000000000..ed033be99 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/path.phi @@ -0,0 +1,273 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute() ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/fs/tmpdir.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/tmpdir.phi new file mode 100644 index 000000000..13fb1e7a9 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/fs/tmpdir.phi @@ -0,0 +1,39 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + tmpdir() ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1() ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/go.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/go.phi new file mode 100644 index 000000000..71dc11671 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/go.phi @@ -0,0 +1,34 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + go() ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + φ ↦ ξ.m.put(ξ.m.id), + m ↦ ∅ + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token() ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/i16.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/i16.phi new file mode 100644 index 000000000..74c23c0a3 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/i16.phi @@ -0,0 +1,67 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32() ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/i32.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/i32.phi new file mode 100644 index 000000000..6ae94a781 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/i32.phi @@ -0,0 +1,79 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/i64.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/i64.phi new file mode 100644 index 000000000..058f2a5d1 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/i64.phi @@ -0,0 +1,59 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number() ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/bytes-as-input.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/bytes-as-input.phi new file mode 100644 index 000000000..9cca7961f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/bytes-as-input.phi @@ -0,0 +1,36 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/console.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/console.phi new file mode 100644 index 000000000..f3927bdbc --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/console.phi @@ -0,0 +1,122 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + console() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-input.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-input.phi new file mode 100644 index 000000000..85207b6ab --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-input.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-input() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-output.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-output.phi new file mode 100644 index 000000000..d42577e42 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/dead-output.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-output() ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block() ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/input-length.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/input-length.phi new file mode 100644 index 000000000..88fa9373e --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/input-length.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/malloc-as-output.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/malloc-as-output.phi new file mode 100644 index 000000000..411aff509 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/malloc-as-output.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdin.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdin.phi new file mode 100644 index 000000000..cf3083bdc --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdin.phi @@ -0,0 +1,45 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdin() ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines() ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line() ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdout.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdout.phi new file mode 100644 index 000000000..0f0ffc3d7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/stdout.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/io/tee-input.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/io/tee-input.phi new file mode 100644 index 000000000..877892a2c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/io/tee-input.phi @@ -0,0 +1,34 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/malloc.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/malloc.phi new file mode 100644 index 000000000..36907019c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/malloc.phi @@ -0,0 +1,55 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + malloc() ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/angle.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/angle.phi new file mode 100644 index 000000000..36e3a037d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/angle.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan() ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan() ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/e.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/e.phi new file mode 100644 index 000000000..d317affda --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/e.phi @@ -0,0 +1,12 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/integral.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/integral.phi new file mode 100644 index 000000000..3e5d01b25 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/integral.phi @@ -0,0 +1,66 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-59-21, + ⟦ + φ ↦ Φ̇.true, + i ↦ ∅ + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-59-21(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/numbers.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/numbers.phi new file mode 100644 index 000000000..0d8b00b73 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/numbers.phi @@ -0,0 +1,42 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/pi.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/pi.phi new file mode 100644 index 000000000..30ce1a6b3 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/pi.phi @@ -0,0 +1,12 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/random.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/random.phi new file mode 100644 index 000000000..fbd838b98 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/random.phi @@ -0,0 +1,53 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo() ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/math/real.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/math/real.phi new file mode 100644 index 000000000..ca17c2711 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/math/real.phi @@ -0,0 +1,49 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod() ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs() ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/nan.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/nan.phi new file mode 100644 index 000000000..623d64a32 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/nan.phi @@ -0,0 +1,44 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + nan() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/negative-infinity.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/negative-infinity.phi new file mode 100644 index 000000000..66a584d23 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/negative-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + negative-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/net/socket.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/net/socket.phi new file mode 100644 index 000000000..505fa10a9 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/net/socket.phi @@ -0,0 +1,535 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + net() ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror() ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-276-10), + auto-named-attr-at-276-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-300-10), + auto-named-attr-at-300-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-325-22)).as-bytes + ) + ), + auto-named-attr-at-325-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error() ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-485-10), + auto-named-attr-at-485-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-509-10), + auto-named-attr-at-509-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-534-22)).as-bytes + ) + ), + auto-named-attr-at-534-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + φ ↦ Φ̇.error(ξ.ex), + ex ↦ ∅ + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/number.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/number.phi new file mode 100644 index 000000000..5408a0ed7 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/number.phi @@ -0,0 +1,74 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor() ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer() ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite() ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/positive-infinity.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/positive-infinity.phi new file mode 100644 index 000000000..22f1d8c15 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/positive-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + positive-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/seq.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/seq.phi new file mode 100644 index 000000000..6eb23c23b --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/seq.phi @@ -0,0 +1,17 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/string.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/string.phi new file mode 100644 index 000000000..a7101ec39 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/string.phi @@ -0,0 +1,155 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length() ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/bytes-as-array.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/bytes-as-array.phi new file mode 100644 index 000000000..3693ebf06 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/bytes-as-array.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/hash-code-of.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/hash-code-of.phi new file mode 100644 index 000000000..66d91abdf --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/hash-code-of.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/list.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/list.phi new file mode 100644 index 000000000..8714f8dbf --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/list.phi @@ -0,0 +1,194 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-124-32), + auto-named-attr-at-124-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-131-24) + ), + auto-named-attr-at-131-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-142-20) + ), + auto-named-attr-at-142-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-157-24) + ), + auto-named-attr-at-157-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + φ ↦ ξ.accum.with(ξ.item), + accum ↦ ∅, + item ↦ ∅ + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-177-24), + auto-named-attr-at-177-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-190-24), + auto-named-attr-at-190-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted() ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-243-32), + auto-named-attr-at-243-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-264-32) + ) + ) + ) + ), + auto-named-attr-at-264-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-280-26) + ) + ), + auto-named-attr-at-280-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/map.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/map.phi new file mode 100644 index 000000000..724bf23ec --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/map.phi @@ -0,0 +1,122 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.key, + entry ↦ ∅ + ⟧ + ) + ⟧, + values() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + φ ↦ ξ.entry.value, + entry ↦ ∅ + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-133-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-133-54() ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found() ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-153-50 + ).origin.with(ξ.auto-named-attr-at-154-12) + ), + auto-named-attr-at-153-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-154-12() ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-167-48 + ).origin + ), + auto-named-attr-at-167-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6() ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18() ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range-of-ints.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range-of-ints.phi new file mode 100644 index 000000000..f477d2a18 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range-of-ints.phi @@ -0,0 +1,26 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8() ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range.phi new file mode 100644 index 000000000..338bb09dd --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/range.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/structs/set.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/set.phi new file mode 100644 index 000000000..2a5206aa5 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/structs/set.phi @@ -0,0 +1,37 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true), + item ↦ ∅ + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/switch.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/switch.phi new file mode 100644 index 000000000..07c5340cd --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/switch.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/sys/getenv.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/getenv.phi new file mode 100644 index 000000000..4697eba5d --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/getenv.phi @@ -0,0 +1,19 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/sys/line-separator.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/line-separator.phi new file mode 100644 index 000000000..34a457b2e --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/line-separator.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + line-separator() ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/sys/os.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/os.phi new file mode 100644 index 000000000..e545be378 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/os.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + os() ↦ ⟦ + φ ↦ ξ.name, + is-windows() ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/sys/posix.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/posix.phi new file mode 100644 index 000000000..5dcb9673b --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/posix.phi @@ -0,0 +1,35 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/sys/win32.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/win32.phi new file mode 100644 index 000000000..25465a93e --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/sys/win32.phi @@ -0,0 +1,38 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/true.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/true.phi new file mode 100644 index 000000000..095bf119c --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/true.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + true() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/try.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/try.phi new file mode 100644 index 000000000..0117c82f8 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/try.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/tuple.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/tuple.phi new file mode 100644 index 000000000..a71f13342 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/tuple.phi @@ -0,0 +1,39 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty() ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/txt/regex.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/regex.phi new file mode 100644 index 000000000..f4c9ca8d2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/regex.phi @@ -0,0 +1,56 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled() ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sprintf.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sprintf.phi new file mode 100644 index 000000000..e17f08b1f --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sprintf.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sscanf.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sscanf.phi new file mode 100644 index 000000000..b8353c056 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/sscanf.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/txt/text.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/text.phi new file mode 100644 index 000000000..341bd40c2 --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/txt/text.phi @@ -0,0 +1,275 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased() ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased() ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number() ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + φ ↦ ξ.accum.concat(ξ.str.as-bytes), + accum ↦ ∅, + str ↦ ∅ + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.49.4/org/eolang/while.phi b/eo-phi-normalizer/data/0.49.4/org/eolang/while.phi new file mode 100644 index 000000000..79cb84cea --- /dev/null +++ b/eo-phi-normalizer/data/0.49.4/org/eolang/while.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file From f392e55c00564b153ea82cd74bd6d6afa7a3d5bf Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:37:59 +0300 Subject: [PATCH 51/69] fix(eo-phi-normalizer): pretty-printing tests --- .../src/Language/EO/Phi/Pretty.hs | 19 +++++++-------- .../test/eo/phi/from-eo/as-phi.yaml | 24 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs index f6c6a64aa..a9e98dc61 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -73,14 +73,7 @@ instance Pretty Abs.Program where Abs.Program bindings -> vsep [ lbrace - , indent - 2 - ( vsep - [ pretty "⟦" - , indent 2 (pretty bindings) - , pretty "⟧" - ] - ) + , indent 2 (pretty (Formation bindings)) , rbrace ] @@ -94,8 +87,14 @@ instance Pretty Abs.MetaId where instance Pretty Abs.Object where pretty = \case - Abs.Formation bindings -> vsep [pretty "⟦", indent 2 (pretty bindings), pretty "⟧"] - Abs.Application object bindings -> vsep [pretty object <> lparen, indent 2 (pretty bindings), rparen] + Abs.Formation bindings -> + case bindings of + [] -> pretty "⟦" <> pretty "⟧" + _ -> vsep [pretty "⟦", indent 2 (pretty bindings), pretty "⟧"] + Abs.Application object bindings -> + case bindings of + [] -> pretty object <> lparen <> rparen + _ -> vsep [pretty object <> lparen, indent 2 (pretty bindings), rparen] Abs.ObjectDispatch object attribute -> pretty object <> pretty "." <> pretty attribute Abs.GlobalObject -> pretty "Φ" Abs.GlobalObjectPhiOrg -> pretty "Φ̇" diff --git a/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml b/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml index 7d0660ecc..6853bd9a1 100644 --- a/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml +++ b/eo-phi-normalizer/test/eo/phi/from-eo/as-phi.yaml @@ -33,26 +33,25 @@ tests: org ↦ ⟦ eolang ↦ ⟦ prints-itself ↦ ⟦ - φ ↦ Φ.org.eolang.as-phi ( - α0 ↦ ξ - ) - .length.gt ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( + φ ↦ Φ̇.as-phi( + ξ + ).length.gt( + Φ̇.int( + Φ̇.bytes( Δ ⤍ 00-00-00-00-00-00-00-00 ) ) ) ⟧, prints-itself-to-console ↦ ⟦ - x ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( + x ↦ Φ̇.int( + Φ̇.bytes( Δ ⤍ 00-00-00-00-00-00-00-2A ) ), - φ ↦ Φ.org.eolang.io.stdout ( - α0 ↦ Φ.org.eolang.as-phi ( - α0 ↦ ξ + φ ↦ Φ̇.io.stdout( + Φ̇.as-phi( + ξ ) ) ⟧, @@ -72,7 +71,6 @@ tests: ⟦ m ↦ ⟦ x ↦ ⟦⟧ - ⟧ - () + ⟧() ⟧ } From 9ebf99ffc802a75d62556fa897301b43c8d1670b Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 16:40:07 +0300 Subject: [PATCH 52/69] fix(scripts): ci message --- scripts/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index ffc4d50e8..6abbe43ee 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -173,7 +173,7 @@ function commit_and_push_if_changed { local files="$2" if [ -n "$(git status --porcelain "${files[@]}")" ]; then git add "${files[@]}" - git commit -m "Update $updated_message" + git commit -m "chore(ci): Update $updated_message" git push else echo "Nothing to commit."; From 50f41334c8dd02a08d9f7a7788a4f355afb90cbc Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 18:32:37 +0300 Subject: [PATCH 53/69] refactor(eo-phi-normalizer): format test inputs --- .../test/eo/phi/dataization.yaml | 471 +++++++++++++----- 1 file changed, 344 insertions(+), 127 deletions(-) diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index 4791a3e3a..5e84097c5 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -27,13 +27,24 @@ tests: - ./data/0.49.1/org/eolang/number.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - c ↦ Φ.org.eolang.number( - as-bytes ↦ Φ̇.bytes(Δ ⤍ 40-39-00-00-00-00-00-00) - ), // 25.0 - φ ↦ ξ.c.times(x ↦ ⟦ Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD ⟧) // 1.8 - .plus(x ↦ ⟦ Δ ⤍ 40-40-00-00-00-00-00-00 ⟧), // 32.0 - ⟧} + { + ⟦ + c ↦ Φ̇.number( + as-bytes ↦ Φ̇.bytes( + Δ ⤍ 40-39-00-00-00-00-00-00 + ) + ), + φ ↦ ξ.c.times( + x ↦ ⟦ + Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD + ⟧ + ).plus( + x ↦ ⟦ + Δ ⤍ 40-40-00-00-00-00-00-00 + ⟧ + ) + ⟧ + } output: object: "77.0" @@ -50,7 +61,27 @@ tests: - name: "Program with ξ.ρ.ρ" dependencies: [] input: | - {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b, ρ ↦ ∅ ⟧.a, ρ ↦ ∅ ⟧.c, ρ ↦ ∅ ⟧.φ, λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + b ↦ ⟦ + Δ ⤍ 01- + ⟧, + φ ↦ ⟦ + b ↦ ⟦ + Δ ⤍ 02- + ⟧, + c ↦ ⟦ + a ↦ ξ.ρ.ρ.b, + ρ ↦ ∅ + ⟧.a, + ρ ↦ ∅ + ⟧.c, + ρ ↦ ∅ + ⟧.φ, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -58,7 +89,16 @@ tests: - name: "Preprocessing and dispatch" dependencies: [] input: | - {⟦ a ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧ ⟧.b , λ ⤍ Package ⟧} + { + ⟦ + a ↦ ⟦ + b ↦ ⟦ + Δ ⤍ 01- + ⟧ + ⟧.b, + λ ⤍ Package + ⟧ + } output: object: | ⟦ a ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -66,7 +106,20 @@ tests: - name: "New values in copy through ξ" dependencies: [] input: | - {⟦ a ↦ ⟦ b ↦ ∅, c ↦ ξ.b ⟧, d ↦ ξ.a(b ↦ ⟦ Δ ⤍ 01- ⟧).c , λ ⤍ Package ⟧} + { + ⟦ + a ↦ ⟦ + b ↦ ∅, + c ↦ ξ.b + ⟧, + d ↦ ξ.a( + b ↦ ⟦ + Δ ⤍ 01- + ⟧ + ).c, + λ ⤍ Package + ⟧ + } output: object: | ⟦ a ↦ ⟦ b ↦ ∅, c ↦ ξ.b ⟧, d ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -74,7 +127,20 @@ tests: - name: "ρ-applications and stacked dispatches" dependencies: [] input: | - {⟦ x ↦ ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ⟦ Δ ⤍ 01- ⟧ ⟧ ⟧ ⟧.a.b.c , λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + a ↦ ⟦ + b ↦ ⟦ + c ↦ ⟦ + Δ ⤍ 01- + ⟧ + ⟧ + ⟧ + ⟧.a.b.c, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -82,7 +148,20 @@ tests: - name: "ρ-applications and immediate dispatches" dependencies: [] input: | - {⟦ x ↦ ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ⟦ Δ ⤍ 01- ⟧ ⟧.c ⟧.b ⟧.a , λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + a ↦ ⟦ + b ↦ ⟦ + c ↦ ⟦ + Δ ⤍ 01- + ⟧ + ⟧.c + ⟧.b + ⟧.a, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -90,7 +169,22 @@ tests: - name: "new values in copy through ρ" dependencies: [] input: | - {⟦ x ↦ ⟦ a ↦ ⟦ b ↦ ξ.ρ.c ⟧.b, c ↦ ∅ ⟧, d ↦ ξ.x(c ↦ ⟦ Δ ⤍ 01- ⟧).a , λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + a ↦ ⟦ + b ↦ ξ.ρ.c + ⟧.b, + c ↦ ∅ + ⟧, + d ↦ ξ.x( + c ↦ ⟦ + Δ ⤍ 01- + ⟧ + ).a, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ a ↦ ⟦ b ↦ ξ.ρ.c ⟧.b, c ↦ ∅ ⟧, d ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -98,7 +192,18 @@ tests: - name: "ρ and nested dispatches" dependencies: [] input: | - {⟦ x ↦ ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ξ.ρ ⟧.c ⟧.b ⟧.a , λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + a ↦ ⟦ + b ↦ ⟦ + c ↦ ξ.ρ + ⟧.c + ⟧.b + ⟧.a, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ b ↦ ⟦ c ↦ ξ.ρ ⟧.ρ, ρ ↦ ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ξ.ρ ⟧.ρ ⟧ ⟧ ⟧, λ ⤍ Package ⟧ @@ -106,7 +211,14 @@ tests: - name: "usage of Φ with a loop" dependencies: [] input: | - {⟦ a ↦ ⟦ b ↦ Φ.a ⟧ , λ ⤍ Package ⟧} + { + ⟦ + a ↦ ⟦ + b ↦ Φ.a + ⟧, + λ ⤍ Package + ⟧ + } output: object: | ⟦ a ↦ ⟦ b ↦ Φ.a ⟧, λ ⤍ Package ⟧ @@ -114,7 +226,20 @@ tests: - name: "ρ passed to both term of object application?" dependencies: [] input: | - {⟦ x ↦ ⟦ c ↦ ⟦ a ↦ ∅ ⟧ (a ↦ ⟦ d ↦ ξ.ρ ⟧) ⟧.c , λ ⤍ Package ⟧} + { + ⟦ + x ↦ ⟦ + c ↦ ⟦ + a ↦ ∅ + ⟧( + a ↦ ⟦ + d ↦ ξ.ρ + ⟧ + ) + ⟧.c, + λ ⤍ Package + ⟧ + } output: object: | ⟦ x ↦ ⟦ @@ -130,11 +255,24 @@ tests: - name: "Object with ξ.ρ is an argument in application" dependencies: [] input: | - {⟦ - a ↦ ⟦ b ↦ ∅, x ↦ ⟦ Δ ⤍ 01- ⟧ ⟧ (b ↦ ⟦ c ↦ ξ.ρ.x ⟧ ).b.c, - x ↦ ⟦ Δ ⤍ 02- ⟧, - λ ⤍ Package - ⟧} + { + ⟦ + a ↦ ⟦ + b ↦ ∅, + x ↦ ⟦ + Δ ⤍ 01- + ⟧ + ⟧( + b ↦ ⟦ + c ↦ ξ.ρ.x + ⟧ + ).b.c, + x ↦ ⟦ + Δ ⤍ 02- + ⟧, + λ ⤍ Package + ⟧ + } output: object: | ⟦ a ↦ ⟦ Δ ⤍ 02- ⟧, x ↦ ⟦ Δ ⤍ 02- ⟧, λ ⤍ Package ⟧ @@ -163,7 +301,17 @@ tests: - name: "ξ chain" dependencies: [] input: | - {⟦ a ↦ ξ.b, b ↦ ξ.c, c ↦ ξ.d, d ↦ ⟦ Δ ⤍ 01- ⟧ , λ ⤍ Package ⟧} + { + ⟦ + a ↦ ξ.b, + b ↦ ξ.c, + c ↦ ξ.d, + d ↦ ⟦ + Δ ⤍ 01- + ⟧, + λ ⤍ Package + ⟧ + } output: object: | ⟦ a ↦ ⟦ Δ ⤍ 01- ⟧, b ↦ ⟦ Δ ⤍ 01- ⟧, c ↦ ⟦ Δ ⤍ 01- ⟧, d ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ @@ -235,30 +383,39 @@ tests: dependencies: - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - org ↦ ⟦ - eolang ↦ ⟦ - bool ↦ ⟦ α0 ↦ ∅, φ ↦ ξ.α0 ⟧, - x ↦ ⟦ - φ ↦ Φ.org.eolang.bool( - α0 ↦ Φ.org.eolang.bytes(Δ ⤍ 01-) - ) - ⟧, - z ↦ ⟦ - y ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.x + { + ⟦ + org ↦ ⟦ + eolang ↦ ⟦ + bool ↦ ⟦ + α0 ↦ ∅, + φ ↦ ξ.α0 + ⟧, + x ↦ ⟦ + φ ↦ Φ̇.bool( + Φ̇.bytes( + Δ ⤍ 01- + ) + ) ⟧, - φ ↦ Φ.org.eolang.bool( - α0 ↦ Φ.org.eolang.bytes(Δ ⤍ 01-) - ) + z ↦ ⟦ + y ↦ ⟦ + x ↦ ∅, + φ ↦ ξ.x + ⟧, + φ ↦ Φ̇.bool( + Φ̇.bytes( + Δ ⤍ 01- + ) + ) + ⟧, + λ ⤍ Package ⟧, λ ⤍ Package ⟧, λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧} + ⟧ + } output: object: | ⟦ @@ -279,17 +436,25 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - x ↦ ⟦ - x ↦ ⟦ Δ ⤍ 09- ⟧, - ρ ↦ ⟦ Δ ⤍ 04- ⟧, - λ ⤍ Lorg_eolang_int_times - ⟧, - ρ ↦ ⟦ Δ ⤍ 06- ⟧, - λ ⤍ Lorg_eolang_int_plus + { + ⟦ + φ ↦ ⟦ + x ↦ ⟦ + x ↦ ⟦ + Δ ⤍ 09- + ⟧, + ρ ↦ ⟦ + Δ ⤍ 04- + ⟧, + λ ⤍ Lorg_eolang_int_times + ⟧, + ρ ↦ ⟦ + Δ ⤍ 06- + ⟧, + λ ⤍ Lorg_eolang_int_plus + ⟧ ⟧ - ⟧} + } output: object: "42" @@ -300,13 +465,19 @@ tests: - ./data/0.49.1/org/eolang/false.phi - ./data/0.49.1/org/eolang/true.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 06- ⟧, - x ↦ ⟦ Δ ⤍ 09- ⟧, - λ ⤍ Lorg_eolang_int_gt + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 06- + ⟧, + x ↦ ⟦ + Δ ⤍ 09- + ⟧, + λ ⤍ Lorg_eolang_int_gt + ⟧ ⟧ - ⟧} + } output: bytes: "00-" @@ -316,13 +487,19 @@ tests: dependencies: - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - b ↦ ⟦ Δ ⤍ 15- ⟧, - ρ ↦ ⟦ Δ ⤍ 0D- ⟧, - λ ⤍ Lorg_eolang_bytes_and + { + ⟦ + φ ↦ ⟦ + b ↦ ⟦ + Δ ⤍ 15- + ⟧, + ρ ↦ ⟦ + Δ ⤍ 0D- + ⟧, + λ ⤍ Lorg_eolang_bytes_and + ⟧ ⟧ - ⟧} + } output: bytes: "00-00-00-00-00-00-00-05" @@ -330,12 +507,16 @@ tests: dependencies: - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 50-3D-10-C0-6F-12-42-69 ⟧, - λ ⤍ Lorg_eolang_bytes_not + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 50-3D-10-C0-6F-12-42-69 + ⟧, + λ ⤍ Lorg_eolang_bytes_not + ⟧ ⟧ - ⟧} + } output: bytes: "AF-C2-EF-3F-90-ED-BD-96" @@ -344,12 +525,16 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 00-11-22-33-44 ⟧, - λ ⤍ Lorg_eolang_bytes_size + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 00-11-22-33-44 + ⟧, + λ ⤍ Lorg_eolang_bytes_size + ⟧ ⟧ - ⟧} + } output: bytes: "00-00-00-00-00-00-00-05" @@ -360,17 +545,23 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/false.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 02-24-46-68-8A-AC-CE-F1 ⟧, - b ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 11-22-33-44-55-66-77-88 ⟧, - x ↦ 3, - λ ⤍ Lorg_eolang_bytes_right - ⟧, - λ ⤍ Lorg_eolang_bytes_eq + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 02-24-46-68-8A-AC-CE-F1 + ⟧, + b ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 11-22-33-44-55-66-77-88 + ⟧, + x ↦ 3, + λ ⤍ Lorg_eolang_bytes_right + ⟧, + λ ⤍ Lorg_eolang_bytes_eq + ⟧ ⟧ - ⟧} + } output: bytes: "01-" @@ -381,17 +572,25 @@ tests: - ./data/0.49.1/org/eolang/number.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - x ↦ ⟦ - x ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧, // == 5.0 - ρ ↦ ⟦ Δ ⤍ 40-2A-66-66-66-66-66-66 ⟧, // == 13.2 - λ ⤍ Lorg_eolang_number_times - ⟧, - ρ ↦ ⟦ Δ ⤍ 40-0B-5C-28-F5-C2-8F-5C ⟧, // == 3.42 - λ ⤍ Lorg_eolang_number_plus + { + ⟦ + φ ↦ ⟦ + x ↦ ⟦ + x ↦ ⟦ + Δ ⤍ 40-14-00-00-00-00-00-00 + ⟧, + ρ ↦ ⟦ + Δ ⤍ 40-2A-66-66-66-66-66-66 + ⟧, + λ ⤍ Lorg_eolang_number_times + ⟧, + ρ ↦ ⟦ + Δ ⤍ 40-0B-5C-28-F5-C2-8F-5C + ⟧, + λ ⤍ Lorg_eolang_number_plus + ⟧ ⟧ - ⟧} + } output: object: "69.42" @@ -400,17 +599,19 @@ tests: - ./data/0.49.1/org/eolang/number.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - x ↦ ⟦ - x ↦ 5.0, - ρ ↦ 13.2, - λ ⤍ Lorg_eolang_number_times - ⟧, - ρ ↦ 3.42, - λ ⤍ Lorg_eolang_number_plus + { + ⟦ + φ ↦ ⟦ + x ↦ ⟦ + x ↦ 5.0, + ρ ↦ 13.2, + λ ⤍ Lorg_eolang_number_times + ⟧, + ρ ↦ 3.42, + λ ⤍ Lorg_eolang_number_plus + ⟧ ⟧ - ⟧} + } output: object: "69.42" @@ -421,14 +622,22 @@ tests: - ./data/0.49.1/org/eolang/string.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - start ↦ ⟦ Δ ⤍ 40-00-00-00-00-00-00-00 ⟧, // 2.0 - len ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧, // 5.0 - ρ ↦ ⟦ Δ ⤍ 48-65-6C-6C-6F-20-77-6F-72-6C-64 ⟧, // == "Hello world" - λ ⤍ Lorg_eolang_string_slice + { + ⟦ + φ ↦ ⟦ + start ↦ ⟦ + Δ ⤍ 40-00-00-00-00-00-00-00 + ⟧, + len ↦ ⟦ + Δ ⤍ 40-14-00-00-00-00-00-00 + ⟧, + ρ ↦ ⟦ + Δ ⤍ 48-65-6C-6C-6F-20-77-6F-72-6C-64 + ⟧, + λ ⤍ Lorg_eolang_string_slice + ⟧ ⟧ - ⟧} + } output: object: "\"llo w\"" @@ -438,14 +647,16 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - start ↦ 2.0, - len ↦ 5.0, - ρ ↦ "Hello world", - λ ⤍ Lorg_eolang_string_slice + { + ⟦ + φ ↦ ⟦ + start ↦ 2.0, + len ↦ 5.0, + ρ ↦ "Hello world", + λ ⤍ Lorg_eolang_string_slice + ⟧ ⟧ - ⟧} + } output: object: "\"llo w\"" @@ -455,12 +666,16 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 48-65-6C-6C-6F-20-77-6F-72-6C-64 ⟧, // == "Hello world" - λ ⤍ Lorg_eolang_string_length + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 48-65-6C-6C-6F-20-77-6F-72-6C-64 + ⟧, + λ ⤍ Lorg_eolang_string_length + ⟧ ⟧ - ⟧} + } output: object: "11" # == 11 @@ -470,12 +685,14 @@ tests: - ./data/0.49.1/org/eolang/i64.phi - ./data/0.49.1/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ "Hello world", - λ ⤍ Lorg_eolang_string_length + { + ⟦ + φ ↦ ⟦ + ρ ↦ "Hello world", + λ ⤍ Lorg_eolang_string_length + ⟧ ⟧ - ⟧} + } output: object: "11" # == 11 From f9bb19b89c0b48e31ce96e8be5e6f1a8c7609818 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 18:35:06 +0300 Subject: [PATCH 54/69] chore(eo-phi-normalizer): update depdency versions 0.49.1 -> 0.49.4 --- .../test/eo/phi/dataization.yaml | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index 5e84097c5..ae3b9d8d3 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -24,8 +24,8 @@ title: Dataization tests tests: - name: "Celsius example" dependencies: - - ./data/0.49.1/org/eolang/number.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/number.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -50,9 +50,9 @@ tests: - name: "Equality of booleans (via equality of bytes)" dependencies: - - ./data/0.49.1/org/eolang/bytes.phi - - ./data/0.49.1/org/eolang/true.phi - - ./data/0.49.1/org/eolang/false.phi + - ./data/0.49.4/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/true.phi + - ./data/0.49.4/org/eolang/false.phi input: | {⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ̇.true) ⟧} output: @@ -381,7 +381,7 @@ tests: - name: "Dataize in siblings of Package" dependencies: - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -433,8 +433,8 @@ tests: - name: "int times and plus" dependencies: - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -460,10 +460,10 @@ tests: - name: "int greater than" dependencies: - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi - - ./data/0.49.1/org/eolang/false.phi - - ./data/0.49.1/org/eolang/true.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/false.phi + - ./data/0.49.4/org/eolang/true.phi input: | { ⟦ @@ -485,7 +485,7 @@ tests: - name: "bitwise and" dependencies: - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -505,7 +505,7 @@ tests: - name: "bitwise not" dependencies: - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -522,8 +522,8 @@ tests: - name: "bytes size" dependencies: - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -540,10 +540,10 @@ tests: - name: "bytes shift and equal" dependencies: - - ./data/0.49.1/org/eolang/bytes.phi - - ./data/0.49.1/org/eolang/true.phi - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/false.phi + - ./data/0.49.4/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/true.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/false.phi input: | { ⟦ @@ -569,8 +569,8 @@ tests: - name: "float times and plus (raw bytes)" dependencies: - - ./data/0.49.1/org/eolang/number.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/number.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -596,8 +596,8 @@ tests: - name: "float times and plus" dependencies: - - ./data/0.49.1/org/eolang/number.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/number.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -619,8 +619,8 @@ tests: - name: "string slice (raw bytes)" dependencies: - - ./data/0.49.1/org/eolang/string.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -643,9 +643,9 @@ tests: - name: "string slice" dependencies: - - ./data/0.49.1/org/eolang/string.phi - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -662,9 +662,9 @@ tests: - name: "string length (raw bytes)" dependencies: - - ./data/0.49.1/org/eolang/string.phi - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ @@ -681,9 +681,9 @@ tests: - name: "string length" dependencies: - - ./data/0.49.1/org/eolang/string.phi - - ./data/0.49.1/org/eolang/i64.phi - - ./data/0.49.1/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | { ⟦ From 93bf01468f36a225737c7de82c71190f4089cc36 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Thu, 26 Dec 2024 18:49:43 +0300 Subject: [PATCH 55/69] feat(eo-phi-normalizer): add data files for EO 0.49.4 to .cabal --- eo-phi-normalizer/eo-phi-normalizer.cabal | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 11fe8679c..57d4f4f83 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -310,6 +310,65 @@ extra-source-files: data/0.49.3/org/eolang/txt/sscanf.phi data/0.49.3/org/eolang/txt/text.phi data/0.49.3/org/eolang/while.phi + data/0.49.4/dependencies.md + data/0.49.4/org/eolang/bytes.phi + data/0.49.4/org/eolang/cti.phi + data/0.49.4/org/eolang/dataized.phi + data/0.49.4/org/eolang/error.phi + data/0.49.4/org/eolang/false.phi + data/0.49.4/org/eolang/fs/dir.phi + data/0.49.4/org/eolang/fs/file.phi + data/0.49.4/org/eolang/fs/path.phi + data/0.49.4/org/eolang/fs/tmpdir.phi + data/0.49.4/org/eolang/go.phi + data/0.49.4/org/eolang/i16.phi + data/0.49.4/org/eolang/i32.phi + data/0.49.4/org/eolang/i64.phi + data/0.49.4/org/eolang/io/bytes-as-input.phi + data/0.49.4/org/eolang/io/console.phi + data/0.49.4/org/eolang/io/dead-input.phi + data/0.49.4/org/eolang/io/dead-output.phi + data/0.49.4/org/eolang/io/input-length.phi + data/0.49.4/org/eolang/io/malloc-as-output.phi + data/0.49.4/org/eolang/io/stdin.phi + data/0.49.4/org/eolang/io/stdout.phi + data/0.49.4/org/eolang/io/tee-input.phi + data/0.49.4/org/eolang/malloc.phi + data/0.49.4/org/eolang/math/angle.phi + data/0.49.4/org/eolang/math/e.phi + data/0.49.4/org/eolang/math/integral.phi + data/0.49.4/org/eolang/math/numbers.phi + data/0.49.4/org/eolang/math/pi.phi + data/0.49.4/org/eolang/math/random.phi + data/0.49.4/org/eolang/math/real.phi + data/0.49.4/org/eolang/nan.phi + data/0.49.4/org/eolang/negative-infinity.phi + data/0.49.4/org/eolang/net/socket.phi + data/0.49.4/org/eolang/number.phi + data/0.49.4/org/eolang/positive-infinity.phi + data/0.49.4/org/eolang/seq.phi + data/0.49.4/org/eolang/string.phi + data/0.49.4/org/eolang/structs/bytes-as-array.phi + data/0.49.4/org/eolang/structs/hash-code-of.phi + data/0.49.4/org/eolang/structs/list.phi + data/0.49.4/org/eolang/structs/map.phi + data/0.49.4/org/eolang/structs/range-of-ints.phi + data/0.49.4/org/eolang/structs/range.phi + data/0.49.4/org/eolang/structs/set.phi + data/0.49.4/org/eolang/switch.phi + data/0.49.4/org/eolang/sys/getenv.phi + data/0.49.4/org/eolang/sys/line-separator.phi + data/0.49.4/org/eolang/sys/os.phi + data/0.49.4/org/eolang/sys/posix.phi + data/0.49.4/org/eolang/sys/win32.phi + data/0.49.4/org/eolang/true.phi + data/0.49.4/org/eolang/try.phi + data/0.49.4/org/eolang/tuple.phi + data/0.49.4/org/eolang/txt/regex.phi + data/0.49.4/org/eolang/txt/sprintf.phi + data/0.49.4/org/eolang/txt/sscanf.phi + data/0.49.4/org/eolang/txt/text.phi + data/0.49.4/org/eolang/while.phi test/eo/phi/rules/new.yaml test/eo/phi/rules/streams.yaml From 828e4a2f2a7a2eb9eac5808c197af2c9ac029111 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 12:35:14 +0300 Subject: [PATCH 56/69] fix(eo-phi-normalizer): bytes application --- .../src/Language/EO/Phi/Syntax.hs | 20 +++++++++---------- .../test/eo/phi/dataization.yaml | 12 +++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 9508747ab..750bc9c1b 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -259,15 +259,15 @@ desugarBinding = \case -- MetaSubstThis wrapBytesInInt :: Bytes -> Object -wrapBytesInInt (Bytes bytes) = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|] +wrapBytesInInt (Bytes bytes) = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bytes} ⟧))|] wrapBytesInFloat :: Bytes -> Object -wrapBytesInFloat (Bytes bytes) = [fmt|Φ.org.eolang.number(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|] +wrapBytesInFloat (Bytes bytes) = [fmt|Φ.org.eolang.number(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bytes} ⟧))|] wrapBytesInString :: Bytes -> Object -wrapBytesInString (Bytes bytes) = [fmt|Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|] +wrapBytesInString (Bytes bytes) = [fmt|Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bytes} ⟧))|] wrapBytesInBytes :: Bytes -> Object -wrapBytesInBytes (Bytes bytes) = [fmt|Φ.org.eolang.bytes(Δ ⤍ {bytes})|] +wrapBytesInBytes (Bytes bytes) = [fmt|Φ.org.eolang.bytes(⟦ Δ ⤍ {bytes} ⟧)|] wrapTermination :: Object -wrapTermination = [fmt|Φ.org.eolang.error(α0 ↦ Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes})))|] +wrapTermination = [fmt|Φ.org.eolang.error(α0 ↦ Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bytes} ⟧)))|] where Bytes bytes = stringToBytes "unknown error" @@ -276,21 +276,21 @@ wrapBytesInConstInt = wrapBytesInConstInt64 wrapBytesInConstInt64 :: Bytes -> Object wrapBytesInConstInt64 bytes@(Bytes bs) - | n < 0 = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|] + | n < 0 = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bs} ⟧))|] | otherwise = [fmt|Φ.org.eolang.i64(as-bytes ↦ {n})|] where n = bytesToInt bytes wrapBytesInConstInt32 :: Bytes -> Object wrapBytesInConstInt32 bytes@(Bytes bs) - | n < 0 = [fmt|Φ.org.eolang.i32(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|] + | n < 0 = [fmt|Φ.org.eolang.i32(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bs} ⟧))|] | otherwise = [fmt|Φ.org.eolang.i32(as-bytes ↦ {n})|] where n = bytesToInt bytes wrapBytesInConstInt16 :: Bytes -> Object wrapBytesInConstInt16 bytes@(Bytes bs) - | n < 0 = [fmt|Φ.org.eolang.i16(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|] + | n < 0 = [fmt|Φ.org.eolang.i16(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bs} ⟧))|] | otherwise = [fmt|Φ.org.eolang.i16(as-bytes ↦ {n})|] where n = bytesToInt bytes @@ -299,13 +299,13 @@ wrapBytesInConstFloat :: Bytes -> Object wrapBytesInConstFloat bytes@(Bytes bs) | x == 0 = [fmt|Φ.org.eolang.number(as-bytes ↦ 0.0)|] | x > 0 && isDoubleFinite x == 1 = [fmt|Φ.org.eolang.number(as-bytes ↦ {printf "%f" x :: String})|] - | otherwise = [fmt|Φ.org.eolang.number(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|] + | otherwise = [fmt|Φ.org.eolang.number(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bs} ⟧))|] where x = bytesToFloat bytes wrapBytesInConstString :: Bytes -> Object wrapBytesInConstString bytes@(Bytes bs) - | '\\' `elem` s = [fmt|Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|] + | '\\' `elem` s = [fmt|Φ.org.eolang.string(as-bytes ↦ Φ.org.eolang.bytes(⟦ Δ ⤍ {bs} ⟧))|] | otherwise = [fmt|Φ.org.eolang.string(as-bytes ↦ {s})|] where s = show (bytesToString bytes) diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index ae3b9d8d3..1057b0e1f 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -31,7 +31,7 @@ tests: ⟦ c ↦ Φ̇.number( as-bytes ↦ Φ̇.bytes( - Δ ⤍ 40-39-00-00-00-00-00-00 + ⟦ Δ ⤍ 40-39-00-00-00-00-00-00 ⟧ ) ), φ ↦ ξ.c.times( @@ -54,7 +54,11 @@ tests: - ./data/0.49.4/org/eolang/true.phi - ./data/0.49.4/org/eolang/false.phi input: | - {⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ̇.true) ⟧} + { + ⟦ + φ ↦ Φ̇.true.eq(α0 ↦ Φ̇.true) + ⟧ + } output: bytes: "01-" @@ -394,7 +398,7 @@ tests: x ↦ ⟦ φ ↦ Φ̇.bool( Φ̇.bytes( - Δ ⤍ 01- + ⟦ Δ ⤍ 01- ⟧ ) ) ⟧, @@ -405,7 +409,7 @@ tests: ⟧, φ ↦ Φ̇.bool( Φ̇.bytes( - Δ ⤍ 01- + ⟦ Δ ⤍ 01- ⟧ ) ) ⟧, From 094838fd72f4c8611ab659e6b18ea63fcb00cd19 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 12:56:21 +0300 Subject: [PATCH 57/69] fix(eo-phi-normalizer): use yegor's old rules by default --- eo-phi-normalizer/app/Main.hs | 14 +- eo-phi-normalizer/eo-phi-normalizer.cabal | 1 + .../src/Language/EO/Phi/Rules/RunYegor.hs | 2 +- .../src/Language/EO/Phi/Syntax.hs | 11 +- .../test/Language/EO/Phi/DataizeSpec.hs | 42 +-- .../test/Language/EO/Rules/PhiPaperSpec.hs | 5 +- .../test/Language/EO/YamlSpec.hs | 1 + .../test/eo/phi/rules/yegor.yaml | 288 ++++++++++++++++++ 8 files changed, 338 insertions(+), 26 deletions(-) create mode 100644 eo-phi-normalizer/test/eo/phi/rules/yegor.yaml diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 35a514c11..d450cb208 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -276,7 +276,7 @@ data CommandParser = CommandParser } rulesFile :: String -rulesFile = "new.yaml" +rulesFile = "yegor.yaml" commandParser :: CommandParser commandParser = @@ -606,7 +606,7 @@ main = withCorrectLocale do -- Temporary hack while rules are not stabilized. -- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule]) Nothing -> do - ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml") + ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/yegor.yaml") return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) unless (single || json || latex) $ logStrLn ruleSetTitle bindingsWithDeps <- case deepMergePrograms (program' : deps) of @@ -702,6 +702,16 @@ main = withCorrectLocale do bindingsWithDeps <- case deepMergePrograms (program' : deps) of Left err -> throwIO (CouldNotMergeDependencies err) Right (Program bindingsWithDeps) -> return bindingsWithDeps + -- (builtin, ruleSetTitle, rules) <- + -- case rulesPath of + -- Just path -> do + -- ruleSet <- parseRuleSetFromFile path + -- return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) + -- -- Temporary hack while rules are not stabilized. + -- -- Nothing -> return (True, "Yegor's rules (builtin)", [fastYegorInsideOutAsRule]) + -- Nothing -> do + -- ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml") + -- return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) (builtin, _ruleSetTitle, rules) <- case rulesPath of Just path -> do diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index 57d4f4f83..a6b95e02b 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -371,6 +371,7 @@ extra-source-files: data/0.49.4/org/eolang/while.phi test/eo/phi/rules/new.yaml test/eo/phi/rules/streams.yaml + test/eo/phi/rules/yegor.yaml source-repository head type: git diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs index ffe95167a..a057f9819 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/RunYegor.hs @@ -37,7 +37,7 @@ yegorRuleSet :: Yaml.RuleSet {-# NOINLINE yegorRuleSet #-} yegorRuleSet = unsafePerformIO $ - Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/new.yaml" + Yaml.parseRuleSetFromFile "eo-phi-normalizer/test/eo/phi/rules/yegor.yaml" yegorRules :: [NamedRule] yegorRules = map Yaml.convertRuleNamed (Yaml.rules yegorRuleSet) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 750bc9c1b..19bd10320 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -35,6 +35,7 @@ module Language.EO.Phi.Syntax ( module Language.EO.Phi.Syntax.Abs, desugar, printTree, + printTreeDontSugar, -- * Conversion to 'Bytes' intToBytes, @@ -662,11 +663,15 @@ unsafeParseWith parser input = Left parseError -> error parseError Right object -> object --- | The top-level printing method. -printTree :: (Pretty a, SugarableFinally a) => a -> String -printTree = +printTreeDontSugar :: (Pretty a) => a -> String +printTreeDontSugar = T.unpack . renderStrict . layoutPretty defaultLayoutOptions{layoutPageWidth = Unbounded} . pretty + +-- | The top-level printing method. +printTree :: (Pretty a, SugarableFinally a) => a -> String +printTree = + printTreeDontSugar . sugarFinally diff --git a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs index 594443964..bc0f8530a 100644 --- a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs @@ -30,7 +30,7 @@ module Language.EO.Phi.DataizeSpec where import Control.Monad (forM_) import Test.Hspec -import Language.EO.Phi (printTree) +import Language.EO.Phi (printTree, printTreeDontSugar) import Language.EO.Phi qualified as Phi import Language.EO.Phi.Dataize (dataizeRecursively) import Language.EO.Phi.Dataize.Context (defaultContext) @@ -62,23 +62,29 @@ getProgram inputFile = do spec :: Spec spec = do DataizeTestGroup{..} <- runIO (dataizationTests "test/eo/phi/dataization.yaml") - ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/new.yaml" - let rules = map convertRuleNamed ruleset.rules - describe title $ - forM_ tests $ - \test -> do - deps <- runIO $ mapM getProgram test.dependencies - let mergedProgs = case deepMergePrograms (test.input : deps) of - Left err -> error ("Error merging programs: " ++ err) - Right prog -> prog - let ctx = defaultContext rules (progToObj mergedProgs) - let inputObj = progToObj test.input - let expectedResult = case test.output of - Object obj -> Left obj - Bytes bytes -> Right bytes - it test.name $ do - let dataizedResult = dataizeRecursively ctx inputObj - ObjectOrBytes dataizedResult `shouldBe` ObjectOrBytes expectedResult + forM_ + [ ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml") + -- TODO #617:10m Enable + -- , ("New Yegor's rules", "test/eo/phi/rules/new.yaml") + ] + $ \(title, rulesFile) -> do + ruleset <- runIO $ parseRuleSetFromFile rulesFile + let rules = map convertRuleNamed ruleset.rules + describe title $ + forM_ tests $ + \test -> do + deps <- runIO $ mapM getProgram test.dependencies + let mergedProgs = case deepMergePrograms (test.input : deps) of + Left err -> error ("Error merging programs: " ++ err) + Right prog -> prog + let ctx = defaultContext rules (progToObj mergedProgs) + let inputObj = progToObj test.input + let expectedResult = case test.output of + Object obj -> Left obj + Bytes bytes -> Right bytes + it test.name $ do + let dataizedResult = dataizeRecursively ctx inputObj + ObjectOrBytes dataizedResult `shouldBe` ObjectOrBytes expectedResult progToObj :: Phi.Program -> Phi.Object progToObj (Phi.Program bindings) = Phi.Formation bindings diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 215014361..de0ae524a 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -337,12 +337,13 @@ spec :: Spec spec = forM_ [ ("New Yegor's rules", "test/eo/phi/rules/new.yaml") + , ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml") ] - $ \(name, rulesFile) -> do + $ \(title, rulesFile) -> do ruleset <- runIO $ parseRuleSetFromFile rulesFile let rulesFromYaml = map convertRuleNamed (rules ruleset) inputs <- runIO $ parseTests "test/eo/phi/confluence.yaml" - describe name $ do + describe title $ do it "Are confluent (via QuickCheck)" (confluent rulesFromYaml) describe "Are confluent (regression tests)" diff --git a/eo-phi-normalizer/test/Language/EO/YamlSpec.hs b/eo-phi-normalizer/test/Language/EO/YamlSpec.hs index e01713e15..fa1e17fe3 100644 --- a/eo-phi-normalizer/test/Language/EO/YamlSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/YamlSpec.hs @@ -32,5 +32,6 @@ spec :: Spec spec = Test.spec [ "test/eo/phi/rules/new.yaml" + , "test/eo/phi/rules/yegor.yaml" , "test/eo/phi/rules/streams.yaml" ] diff --git a/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml b/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml new file mode 100644 index 000000000..e5d72e3d2 --- /dev/null +++ b/eo-phi-normalizer/test/eo/phi/rules/yegor.yaml @@ -0,0 +1,288 @@ +# The MIT License (MIT) + +# Copyright (c) 2016-2024 Objectionary.com + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +title: "Rule set based on Yegor's draft" +rules: + + - name: Phi + description: 'Φ-dispatch' + context: + global_object: '!b' + pattern: | + Φ + result: | + !b + when: + - apply_in_subformations: false + tests: [] + + - name: xi + description: 'ξ-dispatch' + context: + current_object: '!b' + pattern: | + ξ + result: | + !b + when: + - apply_in_subformations: false + tests: + - name: Does not replace ξ inside a subformation + input: '⟦ a ↦ ⟦ ⟧, x ↦ ξ.a, ρ ↦ ⟦ ⟧ ⟧' + output: [] + # How to test replacing without already having context? + + - name: DOT + description: 'Accessing an α-binding' + pattern: | + ⟦ !τ ↦ !b, !B ⟧.!τ + result: | + !b[ ξ ↦ ⟦ !τ ↦ !b, !B ⟧ ] + when: + - apply_in_abstract_subformations: false + - nf_inside_formation: '!b' + - nf: '⟦ !B ⟧' + - not_equal: ['!τ', 'ρ'] + tests: + - name: Should match + input: ⟦ hello ↦ ⟦⟧ ⟧.hello + output: ['⟦ ρ ↦ ⟦ hello ↦ ⟦⟧ ⟧ ⟧'] + - name: Shouldn't match + input: ⟦ ⟧.hello + output: [] + - name: Shouldn't match + input: ⟦ ρ ↦ ⟦⟧ ⟧.ρ + output: [] + - name: Should apply in subformations + input: ⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ⟦⟧ ⟧ ⟧.b ⟧ + output: ['⟦ a ↦ ⟦ c ↦ ⟦⟧, ρ ↦ ⟦ b ↦ ⟦ c ↦ ⟦⟧ ⟧ ⟧ ⟧ ⟧'] + - name: Should respect surrounding context + input: ⟦ hello ↦ ⟦⟧, goodbye ↦ ⟦ a ↦ ⟦⟧ ⟧ ⟧.hello + output: ['⟦ ρ ↦ ⟦ hello ↦ ⟦⟧, goodbye ↦ ⟦ a ↦ ⟦⟧ ⟧ ⟧ ⟧'] + + - name: DOTrho + description: 'Accessing ρ-binding' + pattern: | + ⟦ ρ ↦ !b, !B ⟧.ρ + result: | + !b + when: + - nf: '⟦ !B ⟧' + tests: + - name: Should match + input: ⟦ ρ ↦ ⟦ ⟧ ⟧.ρ + output: ['⟦ ⟧'] + + - name: phi + description: 'Accessing a decorated object' + pattern: | + ⟦!B ⟧.!τ + result: | + ⟦!B ⟧.φ.!τ + when: + - present_attrs: + attrs: ['φ'] + bindings: ['!B'] + - absent_attrs: + attrs: ['!τ'] + bindings: ['!B'] + tests: + - name: 'Attribute does not exist' + input: '⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.b' + output: ['⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.φ.b'] + - name: 'Attribute exists' + input: '⟦ φ ↦ ⟦ ⟧, a ↦ ⟦ ⟧ ⟧.a' + output: [] + - name: 'Both attributes do not exist' + input: '⟦ b ↦ ⟦⟧ ⟧.a' + output: [] + + - name: COPY + description: 'Application of α-binding' + context: + current_object: "!b2" + pattern: | + ⟦ !τ ↦ ∅, !B1 ⟧(!τ ↦ !b1, !B2) + result: | + ⟦ !τ ↦ !b1[ ξ ↦ !b2 ], !B1 ⟧(!B2) + when: + - apply_in_subformations: false + - nf: '!b1' + tests: + - name: Should match + input: ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) + output: ['⟦ a ↦ ⟦ ρ ↦ ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) ⟧ ⟧()'] + - name: Should not match in subformations + input: ⟦ a ↦ ⟦b ↦ ∅⟧(b ↦ ⟦⟧) ⟧ + output: [] + + - name: COPY1 + description: 'Application of α-binding' + # Warning: this is not correct for the chain variant because it only matches the first binding + # i.e., doesn't match an empty binding after an attached one. + # We should instead match the first empty binding. + context: + current_object: "!b2" + pattern: | + ⟦ !τ ↦ ∅, !B ⟧(α0 ↦ !b1) + result: | + ⟦ !τ ↦ !b1[ ξ ↦ !b2 ], !B ⟧ + when: + - apply_in_subformations: false + - nf: '!b1' + tests: + - name: Should match first void attribute + input: ⟦ hello ↦ ⟦⟧, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧) + output: ['⟦ bye ↦ ⟦ ρ ↦ ⟦ hello ↦ ⟦⟧, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧) ⟧, hello ↦ ⟦⟧, hey ↦ ∅ ⟧'] + options: + - take_one: true + + - name: COPY2 + description: 'Application of α-binding' + # Warning: this is not correct for the chain variant because it only matches the first two bindings + # i.e., doesn't match an empty binding after an attached one. + # We should instead match the first two empty bindings. + context: + current_object: "!b3" + pattern: | + ⟦ !τ1 ↦ ∅, !τ2 ↦ ∅, !B ⟧(α0 ↦ !b1, α1 ↦ !b2) + result: | + ⟦ !τ1 ↦ !b1[ ξ ↦ !b3 ], !τ2 ↦ !b2[ ξ ↦ !b3 ], !B ⟧ + when: + - apply_in_subformations: false + - nf: '!b1' + - nf: '!b2' + tests: + - name: Should match positional arguments + input: ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) + output: ['⟦ hello ↦ ⟦ ρ ↦ ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) ⟧, bye ↦ ⟦ a ↦ ⟦⟧, ρ ↦ ⟦ hello ↦ ∅, bye ↦ ∅, hey ↦ ∅ ⟧(α0 ↦ ⟦⟧, α1 ↦ ⟦ a ↦ ⟦⟧ ⟧) ⟧, hey ↦ ∅ ⟧'] + options: + - take_one: true + + - name: COPYdelta + description: 'Application of Δ-binding' + pattern: | + ⟦ Δ ⤍ ∅, !B ⟧(Δ ⤍ !y) + result: | + ⟦ Δ ⤍ !y, !B ⟧ + when: + - apply_in_abstract_subformations: false + tests: [] + + - name: EMPTY + description: 'Empty application' + pattern: | + ⟦ !B1 ⟧() + result: | + ⟦ !B1 ⟧ + when: [] + tests: + - name: Should match + input: ⟦ a ↦ ⟦⟧ ⟧() + output: ['⟦ a ↦ ⟦⟧ ⟧'] + - name: Should not match + input: ⟦ a ↦ ∅ ⟧(a ↦ ⟦⟧) + output: [] + - name: Should match in subformation + input: ⟦ a ↦ ⟦ b ↦ ⟦⟧() ⟧ ⟧ + output: ['⟦ a ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧'] + - name: Should work with empty formation + input: ⟦⟧() + output: ['⟦⟧'] + + - name: OVER + description: 'Invalid application (attribute already attached)' + pattern: ⟦ !τ ↦ !b1, !B1 ⟧(!τ ↦ !b2, !B2) + result: ⊥ + when: [] + tests: + - name: '' + input: '⟦ t ↦ ⟦ a ↦ ∅ ⟧ ⟧(t ↦ ⟦ b ↦ ∅ ⟧)' + output: ['⊥'] + + - name: STOP + description: 'Invalid attribute access' + pattern: | + ⟦ !B ⟧.!τ + result: | + ⊥ + when: + - absent_attrs: + attrs: ['!τ', 'φ', 'λ'] + bindings: ['!B'] + - present_attrs: + attrs: ['ρ'] + bindings: ['!B'] + - nf: '⟦ !B ⟧' + tests: + - name: 'Accessing nonexistent attribute' + input: '⟦ ρ ↦ ⟦ ⟧ ⟧.x' + output: ['⊥'] + + - name: MISS + description: 'Invalid application (absent attribute)' + pattern: ⟦ !B1 ⟧(!τ ↦ !b, !B2) + result: ⊥ + when: + - absent_attrs: + attrs: ['!τ', 'φ', 'λ'] + bindings: ['!B1'] + tests: + - name: '' + input: '⟦ t1 ↦ ⟦ a ↦ ∅ ⟧ ⟧(t ↦ ⟦ b ↦ ∅ ⟧)' + output: ['⊥'] + - name: Should not match if attr is present + input: ⟦ t ↦ ⟦⟧ ⟧(t ↦ ⟦ a ↦ ∅ ⟧) + output: [] + - name: Should not match if phi is present + input: ⟦ φ ↦ ⟦⟧, a ↦ ⟦⟧ ⟧(t ↦ ⟦ a ↦ ∅ ⟧) + output: [] + - name: Should apply in subformations + input: ⟦ a ↦ ⟦ b ↦ ⟦⟧(t ↦ ⟦⟧) ⟧ ⟧ + output: ['⟦ a ↦ ⟦ b ↦ ⊥ ⟧ ⟧'] + + - name: DD + description: 'Accessing an attribute on bottom' + pattern: | + ⊥.!τ + result: | + ⊥ + when: [] + tests: + - name: 'Dispatch on bottom is bottom' + input: '⊥.a' + output: ['⊥'] + - name: 'Dispatch on anything else is not touched' + input: '⟦ ⟧.a' + output: [] + + - name: DC + description: 'Application on bottom is bottom' + pattern: | + ⊥(!B) + result: | + ⊥ + when: [] + tests: + - name: Should apply in subformations + input: ⟦ a ↦ ⟦ b ↦ ⊥(t ↦ ⟦⟧, u ↦ ⟦⟧) ⟧ ⟧ + output: ['⟦ a ↦ ⟦ b ↦ ⊥ ⟧ ⟧'] From 49756fb0a5e70dc20e9f05c41e065ddef05a2442 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 13:18:42 +0300 Subject: [PATCH 58/69] fix(eo-phi-normalizer): run dataization tests under the common title --- .../test/Language/EO/Phi/DataizeSpec.hs | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs index bc0f8530a..b31909648 100644 --- a/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs @@ -21,6 +21,7 @@ -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. {- FOURMOLU_ENABLE -} +{-# LANGUAGE BlockArguments #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE RecordWildCards #-} @@ -30,7 +31,7 @@ module Language.EO.Phi.DataizeSpec where import Control.Monad (forM_) import Test.Hspec -import Language.EO.Phi (printTree, printTreeDontSugar) +import Language.EO.Phi (printTree) import Language.EO.Phi qualified as Phi import Language.EO.Phi.Dataize (dataizeRecursively) import Language.EO.Phi.Dataize.Context (defaultContext) @@ -62,29 +63,30 @@ getProgram inputFile = do spec :: Spec spec = do DataizeTestGroup{..} <- runIO (dataizationTests "test/eo/phi/dataization.yaml") - forM_ - [ ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml") - -- TODO #617:10m Enable - -- , ("New Yegor's rules", "test/eo/phi/rules/new.yaml") - ] - $ \(title, rulesFile) -> do - ruleset <- runIO $ parseRuleSetFromFile rulesFile - let rules = map convertRuleNamed ruleset.rules - describe title $ - forM_ tests $ - \test -> do - deps <- runIO $ mapM getProgram test.dependencies - let mergedProgs = case deepMergePrograms (test.input : deps) of - Left err -> error ("Error merging programs: " ++ err) - Right prog -> prog - let ctx = defaultContext rules (progToObj mergedProgs) - let inputObj = progToObj test.input - let expectedResult = case test.output of - Object obj -> Left obj - Bytes bytes -> Right bytes - it test.name $ do - let dataizedResult = dataizeRecursively ctx inputObj - ObjectOrBytes dataizedResult `shouldBe` ObjectOrBytes expectedResult + describe title do + forM_ + [ ("Old Yegor's rules", "test/eo/phi/rules/yegor.yaml") + -- TODO #617:10m Enable + -- , ("New Yegor's rules", "test/eo/phi/rules/new.yaml") + ] + $ \(rulesTitle, rulesFile) -> do + ruleset <- runIO $ parseRuleSetFromFile rulesFile + let rules = map convertRuleNamed ruleset.rules + describe rulesTitle do + forM_ tests $ + \test -> do + deps <- runIO $ mapM getProgram test.dependencies + let mergedProgs = case deepMergePrograms (test.input : deps) of + Left err -> error ("Error merging programs: " ++ err) + Right prog -> prog + let ctx = defaultContext rules (progToObj mergedProgs) + let inputObj = progToObj test.input + let expectedResult = case test.output of + Object obj -> Left obj + Bytes bytes -> Right bytes + it test.name $ do + let dataizedResult = dataizeRecursively ctx inputObj + ObjectOrBytes dataizedResult `shouldBe` ObjectOrBytes expectedResult progToObj :: Phi.Program -> Phi.Object progToObj (Phi.Program bindings) = Phi.Formation bindings From e9c22c3bb42f7b8ffff800843a2c1a9cb1adad15 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 17:49:13 +0300 Subject: [PATCH 59/69] feat(eo-phi-normalizer): support custom strings --- eo-phi-normalizer/app/Main.hs | 1 + eo-phi-normalizer/grammar/EO/Phi/Syntax.cf | 8 +++++--- eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs | 1 + eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs | 11 ++++++++++- eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs | 2 ++ eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs | 1 + eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs | 7 +++++++ eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs | 3 +++ eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs | 6 +++++- eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt | 6 +++++- eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x | 6 ++++++ eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y | 6 +++++- eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs | 1 + .../test/Language/EO/Rules/PhiPaperSpec.hs | 3 +++ 14 files changed, 55 insertions(+), 7 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index d450cb208..e7c931edc 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -569,6 +569,7 @@ wrapRawBytesIn = \case obj@MetaTailContext{} -> obj obj@MetaFunction{} -> obj obj@ConstString{} -> wrapRawBytesIn (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> wrapRawBytesIn (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> wrapRawBytesIn (desugar obj) diff --git a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf index 80e4db791..b30fe1c95 100644 --- a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf +++ b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf @@ -41,6 +41,7 @@ token BytesMetaId {"!y"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; token MetaFunctionName {"@"} (char - [" \r\n\t,.|':;!-?][}{)(⟧⟦"])* ; token IntegerSigned ('-'? digit+) ; token DoubleSigned ('-'? digit+ '.' digit+ ('e' '-'? digit+)?) ; +token StringRaw '"' ((char - ["\"\\"]) | ('\\' ["\"\\tnrfu"]))* '"'; Program. Program ::= "{" "⟦" [Binding] "⟧" "}" ; @@ -57,7 +58,7 @@ GlobalObject. Object ::= "Φ"; GlobalObjectPhiOrg. Object ::= "Φ̇"; ThisObject. Object ::= "ξ"; Termination. Object ::= "⊥" ; -ConstString. Object ::= String ; +ConstStringRaw. Object ::= StringRaw ; ConstIntRaw. Object ::= IntegerSigned ; ConstFloatRaw. Object ::= DoubleSigned ; MetaSubstThis. Object ::= Object "[" "ξ" "↦" Object "]" ; @@ -66,8 +67,9 @@ MetaObject. Object ::= ObjectMetaId ; MetaTailContext. Object ::= Object "*" TailMetaId ; MetaFunction. Object ::= MetaFunctionName "(" Object ")" ; -internal ConstFloat. Object ::= Double; -internal ConstInt. Object ::= Integer; +internal ConstFloat. Object ::= Double; +internal ConstInt. Object ::= Integer; +internal ConstString. Object ::= String; AlphaBinding. Binding ::= Attribute "↦" Object ; AlphaBindingSugar. Binding ::= Object ; diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs index 9ecba29b3..7a87863fd 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Normalize.hs @@ -80,6 +80,7 @@ peelObject = \case MetaSubstThis{} -> error "impossible" MetaContextualize{} -> error "impossible" obj@ConstString{} -> peelObject (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> peelObject (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> peelObject (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs index a9e98dc61..82101379a 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -68,6 +68,9 @@ instance Pretty Abs.IntegerSigned where instance Pretty Abs.DoubleSigned where pretty (Abs.DoubleSigned i) = pretty i +instance Pretty Abs.StringRaw where + pretty (Abs.StringRaw i) = pretty i + instance Pretty Abs.Program where pretty = \case Abs.Program bindings -> @@ -100,7 +103,8 @@ instance Pretty Abs.Object where Abs.GlobalObjectPhiOrg -> pretty "Φ̇" Abs.ThisObject -> pretty "ξ" Abs.Termination -> pretty "⊥" - Abs.ConstString str -> pretty (show str) + Abs.ConstStringRaw str -> pretty str + Abs.ConstString str -> pretty str Abs.ConstIntRaw integersigned -> pretty integersigned Abs.ConstFloatRaw doublesigned -> pretty doublesigned Abs.MetaSubstThis object1 object2 -> pretty object1 <+> lbracket <+> pretty "ξ ↦" <+> pretty object2 <+> rbracket @@ -134,6 +138,11 @@ instance Pretty Abs.Attribute where Abs.MetaAttr labelmetaid -> pretty labelmetaid Abs.AttrSugar labelid labelids -> pretty labelid <> lparen <> pretty labelids <> rparen +-- instance {-# OVERLAPPING #-} Pretty AttributeSugar where +-- pretty = \case +-- (Abs.AttrSugar labelid labelids) -> pretty labelid <> lparen <> pretty labelids <> rparen +-- (Abs.AttrNormal labelid) -> pretty labelid + instance {-# OVERLAPPING #-} Pretty [Abs.LabelId] where pretty = hsep . punctuate comma . fmap pretty diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs index a5e621285..7c01340b0 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Common.hs @@ -127,6 +127,7 @@ withSubObject f ctx root = MetaSubstThis _ _ -> [] MetaContextualize _ _ -> [] ConstString{} -> [] + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt{} -> [] obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] @@ -206,6 +207,7 @@ objectSize = \case obj@MetaContextualize{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@MetaTailContext{} -> error ("impossible: expected a desugared object, but got: " <> printTree obj) obj@ConstString{} -> objectSize (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> objectSize (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> objectSize (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs index 58c0a2ff6..25eeda6ad 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Fast.hs @@ -213,6 +213,7 @@ fastYegorInsideOut ctx = \case MetaTailContext{} -> error "impossible MetaTailContext!" MetaFunction{} -> error "impossible MetaFunction!" obj@ConstString{} -> obj -- fastYegorInsideOut ctx (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstInt{} -> obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj -- fastYegorInsideOut ctx (desugar obj) obj@ConstFloat{} -> obj -- fastYegorInsideOut ctx (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index a4d5aec1d..75ac44454 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -240,6 +240,7 @@ objectLabelIds = \case MetaSubstThis obj obj' -> objectLabelIds obj <> objectLabelIds obj' MetaContextualize obj obj' -> objectLabelIds obj <> objectLabelIds obj' obj@ConstString{} -> objectLabelIds (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> objectLabelIds (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> objectLabelIds (desugar obj) @@ -291,6 +292,7 @@ objectMetaIds (MetaTailContext obj x) = objectMetaIds obj <> Set.singleton (Meta objectMetaIds (MetaSubstThis obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds (MetaContextualize obj obj') = foldMap objectMetaIds [obj, obj'] objectMetaIds obj@ConstString{} = objectMetaIds (desugar obj) +objectMetaIds obj@ConstStringRaw{} = errorExpectedDesugaredObject obj objectMetaIds obj@ConstInt{} = objectMetaIds (desugar obj) objectMetaIds obj@ConstIntRaw{} = errorExpectedDesugaredObject obj objectMetaIds obj@ConstFloat{} = objectMetaIds (desugar obj) @@ -328,6 +330,7 @@ objectHasMetavars MetaTailContext{} = True objectHasMetavars (MetaSubstThis _ _) = True -- technically not a metavar, but a substitution objectHasMetavars (MetaContextualize _ _) = True objectHasMetavars obj@ConstString{} = objectHasMetavars (desugar obj) +objectHasMetavars obj@ConstStringRaw{} = errorExpectedDesugaredObject obj objectHasMetavars obj@ConstInt{} = objectHasMetavars (desugar obj) objectHasMetavars obj@ConstIntRaw{} = errorExpectedDesugaredObject obj objectHasMetavars obj@ConstFloat{} = objectHasMetavars (desugar obj) @@ -464,6 +467,7 @@ applySubst subst@Subst{..} = \case let holeSubst = mempty{objectMetas = [(holeMetaId, applySubst subst obj)]} in applySubst holeSubst contextObject obj@ConstString{} -> applySubst subst (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> applySubst subst (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> applySubst subst (desugar obj) @@ -538,6 +542,7 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart ThisObject -> [] Termination -> [] ConstString{} -> [] + ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt{} -> [] ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] @@ -658,6 +663,7 @@ substThis thisObj = go obj@MetaObject{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@MetaFunction{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@ConstString{} -> obj + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> obj obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> obj @@ -698,6 +704,7 @@ contextualize thisObj = go obj@MetaObject{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@MetaFunction{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@ConstString{} -> go (desugar obj) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> go (desugar obj) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> go (desugar obj) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index 19bd10320..f57457ae9 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -122,6 +122,7 @@ instance DesugarableInitially Object where desugarInitially :: Object -> Object desugarInitially = \case obj@(ConstString{}) -> obj + ConstStringRaw (StringRaw s) -> ConstString (init (tail s)) obj@(ConstInt{}) -> obj ConstIntRaw (IntegerSigned x) -> ConstInt (read x) obj@(ConstFloat{}) -> obj @@ -181,6 +182,7 @@ instance SugarableFinally Object where sugarFinally = \case "Φ.org.eolang" -> GlobalObjectPhiOrg obj@ConstString{} -> obj + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> obj obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> obj @@ -231,6 +233,7 @@ instance SugarableFinally MetaId desugar :: Object -> Object desugar = \case ConstString string -> wrapBytesInString (stringToBytes string) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt n -> wrapBytesInInt (intToBytes (fromInteger n)) obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat x -> wrapBytesInFloat (floatToBytes x) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index b92fbeee6..004441766 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs @@ -67,7 +67,7 @@ data Object | GlobalObjectPhiOrg | ThisObject | Termination - | ConstString String + | ConstStringRaw StringRaw | ConstIntRaw IntegerSigned | ConstFloatRaw DoubleSigned | MetaSubstThis Object Object @@ -77,6 +77,7 @@ data Object | MetaFunction MetaFunctionName Object | ConstFloat Double | ConstInt Integer + | ConstString String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic) data Binding @@ -149,3 +150,6 @@ newtype IntegerSigned = IntegerSigned String newtype DoubleSigned = DoubleSigned String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) +newtype StringRaw = StringRaw String + deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) + diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt index 803b9db59..719cf9d9f 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt @@ -38,6 +38,7 @@ except ``"`` unless preceded by ``\``. + Bytes literals are recognized by the regular expression `````{"--"} | ["0123456789ABCDEF"] ["0123456789ABCDEF"] '-' | ["0123456789ABCDEF"] ["0123456789ABCDEF"] ('-' ["0123456789ABCDEF"] ["0123456789ABCDEF"])+````` @@ -82,6 +83,9 @@ IntegerSigned literals are recognized by the regular expression DoubleSigned literals are recognized by the regular expression `````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` +StringRaw literals are recognized by the regular expression +`````'"' (char - [""\"] | '\' [""\fnrtu"])* '"'````` + ===Reserved words and symbols=== The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions. @@ -119,7 +123,7 @@ All other symbols are terminals. | | **|** | ``Φ̇`` | | **|** | ``ξ`` | | **|** | ``⊥`` - | | **|** | //String// + | | **|** | //StringRaw// | | **|** | //IntegerSigned// | | **|** | //DoubleSigned// | | **|** | //Object// ``[`` ``ξ`` ``↦`` //Object// ``]`` diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x index 90f1522e1..945d1192c 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x @@ -93,6 +93,10 @@ $s [$u # [\t \n \r \ \! \' \( \) \, \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * \- ? $d + \. $d + (e \- ? $d +)? { tok (eitherResIdent T_DoubleSigned) } +-- token StringRaw +\" ([$u # [\" \\]] | \\ [\" \\ f n r t u]) * \" + { tok (eitherResIdent T_StringRaw) } + -- Keywords and Ident $l $i* { tok (eitherResIdent TV) } @@ -134,6 +138,7 @@ data Tok | T_MetaFunctionName !String | T_IntegerSigned !String | T_DoubleSigned !String + | T_StringRaw !String deriving (Eq, Show, Ord) -- | Smart constructor for 'Tok' for the sake of backwards compatibility. @@ -208,6 +213,7 @@ tokenText t = case t of PT _ (T_MetaFunctionName s) -> s PT _ (T_IntegerSigned s) -> s PT _ (T_DoubleSigned s) -> s + PT _ (T_StringRaw s) -> s -- | Convert a token to a string. prToken :: Token -> String diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index fb0f57941..1f8726e8d 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y @@ -85,6 +85,7 @@ import Language.EO.Phi.Syntax.Lex L_MetaFunctionName { PT _ (T_MetaFunctionName $$) } L_IntegerSigned { PT _ (T_IntegerSigned $$) } L_DoubleSigned { PT _ (T_DoubleSigned $$) } + L_StringRaw { PT _ (T_StringRaw $$) } %% @@ -133,6 +134,9 @@ IntegerSigned : L_IntegerSigned { Language.EO.Phi.Syntax.Abs.IntegerSigned $1 } DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } +StringRaw :: { Language.EO.Phi.Syntax.Abs.StringRaw } +StringRaw : L_StringRaw { Language.EO.Phi.Syntax.Abs.StringRaw $1 } + Program :: { Language.EO.Phi.Syntax.Abs.Program } Program : '{' '⟦' ListBinding '⟧' '}' { Language.EO.Phi.Syntax.Abs.Program $3 } @@ -154,7 +158,7 @@ Object | 'Φ̇' { Language.EO.Phi.Syntax.Abs.GlobalObjectPhiOrg } | 'ξ' { Language.EO.Phi.Syntax.Abs.ThisObject } | '⊥' { Language.EO.Phi.Syntax.Abs.Termination } - | String { Language.EO.Phi.Syntax.Abs.ConstString $1 } + | StringRaw { Language.EO.Phi.Syntax.Abs.ConstStringRaw $1 } | IntegerSigned { Language.EO.Phi.Syntax.Abs.ConstIntRaw $1 } | DoubleSigned { Language.EO.Phi.Syntax.Abs.ConstFloatRaw $1 } | Object '[' 'ξ' '↦' Object ']' { Language.EO.Phi.Syntax.Abs.MetaSubstThis $1 $5 } diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index 3b084236d..a56655863 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -91,6 +91,7 @@ instance ToLatex Object where toLatex (MetaSubstThis obj1 obj2) = LaTeX "\\mathbb{S}(" <> toLatex obj1 <> ", " <> toLatex obj2 <> ")" toLatex (MetaContextualize obj1 obj2) = LaTeX "\\lceil" <> toLatex obj1 <> ", " <> toLatex obj2 <> "\\rceil" toLatex (ConstString string) = "|" <> LaTeX (show string) <> "|" + toLatex obj@(ConstStringRaw{}) = errorExpectedDesugaredObject obj toLatex (ConstInt n) = LaTeX (show n) toLatex obj@(ConstIntRaw{}) = errorExpectedDesugaredObject obj toLatex (ConstFloat x) = LaTeX (show x) diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index de0ae524a..2dc84c754 100644 --- a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs @@ -112,6 +112,9 @@ instance Arbitrary Binding where shrink (AlphaBinding attr obj) = AlphaBinding attr <$> shrink obj shrink _ = [] -- do not shrink deltas and lambdas +instance Arbitrary Phi.StringRaw where + arbitrary = Phi.StringRaw <$> arbitraryNonEmptyString + -- | Split an integer into a list of positive integers, -- whose sum is less than or equal the initial one. -- From 48692da5bd5a254e2f3f1d6042ea626bb3aaf195 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 18:14:48 +0300 Subject: [PATCH 60/69] chore(eo): bump 0.49.4 -> 0.50.0 --- eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo b/eo index 115e7ff6e..27abe8bef 160000 --- a/eo +++ b/eo @@ -1 +1 @@ -Subproject commit 115e7ff6e9564f01c3b4bff2e35c1568a45633ed +Subproject commit 27abe8befa33f8b1e64a89ffb90a015f150f4ec7 From 983b7302863bc079369c36ec16ffde69164f8c77 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 18:17:23 +0300 Subject: [PATCH 61/69] fix(node): bump eolang 0.28.0 -> 0.28.1 --- package-lock.json | 60 +++++++++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index 45a95a8e2..d84c65fde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "eo-phi-normalizer", "devDependencies": { - "eolang": "^0.28.0", + "eolang": "^0.28.1", "prettier": "^3.2.5" } }, @@ -53,10 +53,11 @@ "dev": true }, "node_modules/axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "dev": true, + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -64,10 +65,11 @@ } }, "node_modules/axios/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -184,11 +186,13 @@ } }, "node_modules/eo2js": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/eo2js/-/eo2js-0.0.7.tgz", - "integrity": "sha512-+JhyDtl+762yZXQJPd3Uhyt6whvrdYig0ivvwyW/jvFukbanL16j81nl43h5J69YEV3o0FouESxgghoGW/aEVw==", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/eo2js/-/eo2js-0.0.8.tgz", + "integrity": "sha512-siZUx2QFdKP6ikRkmASD2+S2I1TFY6WFgFmuZAZUau6ebPxLReBoJbm3KoTyduk6F7IldOtuaf2Mx0dihBSXrQ==", "dev": true, + "license": "MIT", "dependencies": { + "colors": "1.4.0", "commander": "^12.0.0", "fast-xml-parser": "^4.3.5", "saxon-js": "^2.6.0" @@ -198,9 +202,9 @@ } }, "node_modules/eolang": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/eolang/-/eolang-0.28.0.tgz", - "integrity": "sha512-Wa6DH7ZU/GYOLnr7kt8Kzd46BlmJ7npg/EhxFiIuB7mxwDwf/y8J2uNk0wTF83SJHAVZwZcAU+FdU4xDSux3GA==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/eolang/-/eolang-0.28.1.tgz", + "integrity": "sha512-cIJzLu73OBmP9fsTYXK+9kKwIsev1NAtUOL7l7cd33puVg9uGGnJeNib//d7QaoL7wWUJy44ELJrYnwkQtx+rA==", "dev": true, "license": "MIT", "os": [ @@ -211,9 +215,9 @@ "dependencies": { "colors": "1.4.0", "commander": "12.1.0", - "eo2js": "0.0.7", + "eo2js": "0.0.8", "fast-xml-parser": "4.5.1", - "node": "23.4.0", + "node": "23.5.0", "relative": "3.0.2", "semver": "7.6.3", "sync-request": "6.1.0", @@ -260,9 +264,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", "dev": true, "funding": [ { @@ -270,6 +274,7 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -460,9 +465,9 @@ } }, "node_modules/node": { - "version": "23.4.0", - "resolved": "https://registry.npmjs.org/node/-/node-23.4.0.tgz", - "integrity": "sha512-uzDNv0OyY8xC7x1/CuYx2c9G3g33GznkhPFs89Q2trrk7M9JzYFj8nlEbv9E666ihJdop+WaeCQST2Hbm/iKuw==", + "version": "23.5.0", + "resolved": "https://registry.npmjs.org/node/-/node-23.5.0.tgz", + "integrity": "sha512-Wco8qYfFUAotVJJoMbB30cYdPbTqFd9QtzC528GvTCYWMldnPUu1pLNz4sKNKxal+dgBuAyUu8tRkeLVx1VT8Q==", "dev": true, "hasInstallScript": true, "license": "ISC", @@ -533,7 +538,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/qs": { "version": "6.11.2", @@ -584,10 +590,11 @@ "dev": true }, "node_modules/saxon-js": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/saxon-js/-/saxon-js-2.6.0.tgz", - "integrity": "sha512-4dinQEGz/OQX0cnmwLTbjVFY9KciMGRyfA6AUsMCO/mKDOwDxOJFmzoLStieTpEiOB/98E1E4VKV1ElsiD88yQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/saxon-js/-/saxon-js-2.7.0.tgz", + "integrity": "sha512-uGAv7H85EuWtAyyXVezXBg3/j2UvhEfT3N9+sqkGwCJVW33KlkadllDCdES/asCDklUo0UlM6178tZ0n3GPZjQ==", "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "axios": "^1.5.1" } @@ -653,7 +660,8 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/sync-request": { "version": "6.1.0", diff --git a/package.json b/package.json index 4ba71419e..611013512 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eo-phi-normalizer", "devDependencies": { - "eolang": "^0.28.0", + "eolang": "^0.28.1", "prettier": "^3.2.5" } } From 5625ec197df109538beebbd7f53ea33567011393 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Dec 2024 15:20:30 +0000 Subject: [PATCH 62/69] chore(ci): Update pipeline/pipeline.lock --- pipeline/pipeline.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index 95285e6ef..b6f06f929 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ -EO_HEAD_HASH="115e7ff6e9564f01c3b4bff2e35c1568a45633ed" +EO_HEAD_HASH="27abe8befa33f8b1e64a89ffb90a015f150f4ec7" PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" From 89b1ea46da1ecfb0e6d397ba2057a868863c5180 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Dec 2024 15:20:30 +0000 Subject: [PATCH 63/69] chore(ci): Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.50.0/dependencies.md | 3905 +++++++++++++++++ .../data/0.50.0/org/eolang/bytes.phi | 96 + .../data/0.50.0/org/eolang/cti.phi | 11 + .../data/0.50.0/org/eolang/dataized.phi | 18 + .../data/0.50.0/org/eolang/error.phi | 11 + .../data/0.50.0/org/eolang/false.phi | 21 + .../data/0.50.0/org/eolang/fs/dir.phi | 71 + .../data/0.50.0/org/eolang/fs/file.phi | 164 + .../data/0.50.0/org/eolang/fs/path.phi | 273 ++ .../data/0.50.0/org/eolang/fs/tmpdir.phi | 39 + .../data/0.50.0/org/eolang/go.phi | 34 + .../data/0.50.0/org/eolang/i16.phi | 67 + .../data/0.50.0/org/eolang/i32.phi | 79 + .../data/0.50.0/org/eolang/i64.phi | 59 + .../0.50.0/org/eolang/io/bytes-as-input.phi | 36 + .../data/0.50.0/org/eolang/io/console.phi | 122 + .../data/0.50.0/org/eolang/io/dead-input.phi | 22 + .../data/0.50.0/org/eolang/io/dead-output.phi | 22 + .../0.50.0/org/eolang/io/input-length.phi | 21 + .../0.50.0/org/eolang/io/malloc-as-output.phi | 30 + .../data/0.50.0/org/eolang/io/stdin.phi | 45 + .../data/0.50.0/org/eolang/io/stdout.phi | 18 + .../data/0.50.0/org/eolang/io/tee-input.phi | 34 + .../data/0.50.0/org/eolang/malloc.phi | 55 + .../data/0.50.0/org/eolang/math/angle.phi | 30 + .../data/0.50.0/org/eolang/math/e.phi | 12 + .../data/0.50.0/org/eolang/math/integral.phi | 66 + .../data/0.50.0/org/eolang/math/numbers.phi | 42 + .../data/0.50.0/org/eolang/math/pi.phi | 12 + .../data/0.50.0/org/eolang/math/random.phi | 53 + .../data/0.50.0/org/eolang/math/real.phi | 49 + .../data/0.50.0/org/eolang/nan.phi | 44 + .../0.50.0/org/eolang/negative-infinity.phi | 61 + .../data/0.50.0/org/eolang/net/socket.phi | 535 +++ .../data/0.50.0/org/eolang/number.phi | 74 + .../0.50.0/org/eolang/positive-infinity.phi | 61 + .../data/0.50.0/org/eolang/seq.phi | 17 + .../data/0.50.0/org/eolang/string.phi | 155 + .../org/eolang/structs/bytes-as-array.phi | 23 + .../org/eolang/structs/hash-code-of.phi | 30 + .../data/0.50.0/org/eolang/structs/list.phi | 194 + .../data/0.50.0/org/eolang/structs/map.phi | 122 + .../org/eolang/structs/range-of-ints.phi | 26 + .../data/0.50.0/org/eolang/structs/range.phi | 23 + .../data/0.50.0/org/eolang/structs/set.phi | 37 + .../data/0.50.0/org/eolang/switch.phi | 18 + .../data/0.50.0/org/eolang/sys/getenv.phi | 19 + .../0.50.0/org/eolang/sys/line-separator.phi | 14 + .../data/0.50.0/org/eolang/sys/os.phi | 23 + .../data/0.50.0/org/eolang/sys/posix.phi | 35 + .../data/0.50.0/org/eolang/sys/win32.phi | 38 + .../data/0.50.0/org/eolang/true.phi | 21 + .../data/0.50.0/org/eolang/try.phi | 11 + .../data/0.50.0/org/eolang/tuple.phi | 39 + .../data/0.50.0/org/eolang/txt/regex.phi | 56 + .../data/0.50.0/org/eolang/txt/sprintf.phi | 14 + .../data/0.50.0/org/eolang/txt/sscanf.phi | 14 + .../data/0.50.0/org/eolang/txt/text.phi | 275 ++ .../data/0.50.0/org/eolang/while.phi | 22 + 59 files changed, 7518 insertions(+) create mode 100644 eo-phi-normalizer/data/0.50.0/dependencies.md create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/bytes.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/dataized.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/error.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/false.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/go.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/i16.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/i32.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/i64.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-input.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-output.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/nan.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/negative-infinity.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/number.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/positive-infinity.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/seq.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/string.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/true.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/try.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/tuple.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/sprintf.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi create mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/while.phi diff --git a/eo-phi-normalizer/data/0.50.0/dependencies.md b/eo-phi-normalizer/data/0.50.0/dependencies.md new file mode 100644 index 000000000..4a363fb43 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/dependencies.md @@ -0,0 +1,3905 @@ +# Dependencies + +## [org/eolang/bytes.phi](./org/eolang/bytes.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number() ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/cti.phi](./org/eolang/cti.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/dataized.phi](./org/eolang/dataized.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/error.phi](./org/eolang/error.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/false.phi](./org/eolang/false.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + false() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/dir.phi](./org/eolang/fs/dir.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted() ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/file.phi](./org/eolang/fs/file.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path() ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-211-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-211-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-252-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-252-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/path.phi](./org/eolang/fs/path.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute() ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/fs/tmpdir.phi](./org/eolang/fs/tmpdir.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + tmpdir() ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1() ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/go.phi](./org/eolang/go.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + go() ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + m ↦ ∅, + φ ↦ ξ.m.put(ξ.m.id) + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token() ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i16.phi](./org/eolang/i16.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32() ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i32.phi](./org/eolang/i32.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/i64.phi](./org/eolang/i64.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number() ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/bytes-as-input.phi](./org/eolang/io/bytes-as-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/console.phi](./org/eolang/io/console.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + console() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-input() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-output() ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block() ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/input-length.phi](./org/eolang/io/input-length.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/malloc-as-output.phi](./org/eolang/io/malloc-as-output.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdin.phi](./org/eolang/io/stdin.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdin() ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines() ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line() ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/stdout.phi](./org/eolang/io/stdout.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/io/tee-input.phi](./org/eolang/io/tee-input.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/malloc.phi](./org/eolang/malloc.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + malloc() ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/angle.phi](./org/eolang/math/angle.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan() ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan() ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/e.phi](./org/eolang/math/e.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/integral.phi](./org/eolang/math/integral.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-58-19, + ⟦ + i ↦ ∅, + φ ↦ Φ̇.true + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-58-19(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/numbers.phi](./org/eolang/math/numbers.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/pi.phi](./org/eolang/math/pi.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/random.phi](./org/eolang/math/random.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo() ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/math/real.phi](./org/eolang/math/real.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod() ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs() ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/nan.phi](./org/eolang/nan.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + nan() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + negative-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/net/socket.phi](./org/eolang/net/socket.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + net() ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror() ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-274-10), + auto-named-attr-at-274-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-298-10), + auto-named-attr-at-298-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-323-22)).as-bytes + ) + ), + auto-named-attr-at-323-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error() ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-483-10), + auto-named-attr-at-483-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-507-10), + auto-named-attr-at-507-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-532-22)).as-bytes + ) + ), + auto-named-attr-at-532-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/number.phi](./org/eolang/number.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor() ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer() ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite() ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + positive-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/seq.phi](./org/eolang/seq.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/string.phi](./org/eolang/string.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length() ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/bytes-as-array.phi](./org/eolang/structs/bytes-as-array.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/hash-code-of.phi](./org/eolang/structs/hash-code-of.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/list.phi](./org/eolang/structs/list.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-123-32), + auto-named-attr-at-123-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-130-24) + ), + auto-named-attr-at-130-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-141-20) + ), + auto-named-attr-at-141-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-156-24) + ), + auto-named-attr-at-156-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + accum ↦ ∅, + item ↦ ∅, + φ ↦ ξ.accum.with(ξ.item) + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-176-24), + auto-named-attr-at-176-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-189-24), + auto-named-attr-at-189-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted() ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-238-32), + auto-named-attr-at-238-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-259-32) + ) + ) + ) + ), + auto-named-attr-at-259-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-275-26) + ) + ), + auto-named-attr-at-275-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/map.phi](./org/eolang/structs/map.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + entry ↦ ∅, + φ ↦ ξ.entry.key + ⟧ + ) + ⟧, + values() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + entry ↦ ∅, + φ ↦ ξ.entry.value + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-125-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-125-54() ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found() ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-145-50 + ).origin.with(ξ.auto-named-attr-at-146-12) + ), + auto-named-attr-at-145-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-146-12() ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-159-48 + ).origin + ), + auto-named-attr-at-159-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6() ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18() ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range-of-ints.phi](./org/eolang/structs/range-of-ints.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8() ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/range.phi](./org/eolang/structs/range.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/structs/set.phi](./org/eolang/structs/set.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + item ↦ ∅, + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true) + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/switch.phi](./org/eolang/switch.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/getenv.phi](./org/eolang/sys/getenv.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/line-separator.phi](./org/eolang/sys/line-separator.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + line-separator() ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/os.phi](./org/eolang/sys/os.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + os() ↦ ⟦ + φ ↦ ξ.name, + is-windows() ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/posix.phi](./org/eolang/sys/posix.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/sys/win32.phi](./org/eolang/sys/win32.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/true.phi](./org/eolang/true.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + true() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/try.phi](./org/eolang/try.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/tuple.phi](./org/eolang/tuple.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty() ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/regex.phi](./org/eolang/txt/regex.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled() ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sprintf.phi](./org/eolang/txt/sprintf.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/sscanf.phi](./org/eolang/txt/sscanf.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/txt/text.phi](./org/eolang/txt/text.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased() ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased() ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number() ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + accum ↦ ∅, + str ↦ ∅, + φ ↦ ξ.accum.concat(ξ.str.as-bytes) + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + +## [org/eolang/while.phi](./org/eolang/while.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} +``` + diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/bytes.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/bytes.phi new file mode 100644 index 000000000..aa456b521 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/bytes.phi @@ -0,0 +1,96 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + bytes(data) ↦ ⟦ + φ ↦ ξ.data, + as-bytes ↦ ξ, + as-bool ↦ ξ.eq(Φ̇.bytes(⟦ Δ ⤍ 01- ⟧)), + as-number() ↦ ⟦ + φ ↦ ξ.ρ.eq(Φ̇.nan.as-bytes).if( + Φ̇.nan, + ξ.ρ.eq(Φ̇.positive-infinity.as-bytes).if( + Φ̇.positive-infinity, + ξ.ρ.eq(Φ̇.negative-infinity.as-bytes).if( + Φ̇.negative-infinity, + ξ.ρ.size.eq(8).if( + Φ̇.number(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to a number, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ) + ) + ) + ⟧, + eq(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_eq + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_size + ⟧, + slice(start, len) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_slice + ⟧, + as-i64() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(8).if( + Φ̇.i64(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 8 length bytes to i64, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i32() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(4).if( + Φ̇.i32(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 4 length bytes to i32, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + as-i16() ↦ ⟦ + φ ↦ ξ.ρ.size.eq(2).if( + Φ̇.i16(ξ.ρ), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert non 2 length bytes to i16, bytes are %x", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ) + ) + ) + ) + ⟧, + and(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_and + ⟧, + or(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_or + ⟧, + xor(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_xor + ⟧, + not() ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_not + ⟧, + left(x) ↦ ⟦ + φ ↦ ξ.ρ.right(ξ.x.neg) + ⟧, + right(x) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_right + ⟧, + concat(b) ↦ ⟦ + λ ⤍ Lorg_eolang_bytes_concat + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi new file mode 100644 index 000000000..f5f437e2b --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + cti(delegate, level, message) ↦ ⟦ + φ ↦ ξ.delegate + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/dataized.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/dataized.phi new file mode 100644 index 000000000..7c17b5025 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/dataized.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + dataized(target) ↦ ⟦ + φ ↦ Φ̇.try( + ξ.target, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + Φ̇.bytes(⟦ Δ ⤍ 01- ⟧) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/error.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/error.phi new file mode 100644 index 000000000..ab9f2ef00 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/error.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + error(message) ↦ ⟦ + λ ⤍ Lorg_eolang_error + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/false.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/false.phi new file mode 100644 index 000000000..f0859bbab --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/false.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + false() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + not ↦ Φ̇.true, + if(left, right) ↦ ⟦ + φ ↦ ξ.right + ⟧, + and(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + or(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi new file mode 100644 index 000000000..b361844f5 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi @@ -0,0 +1,71 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + dir(file) ↦ ⟦ + φ ↦ ξ.file, + is-directory ↦ Φ̇.true, + made() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) + ), + mkdir() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_made_mkdir + ⟧ + ⟧, + walk(glob) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_walk + ⟧, + deleted() ↦ ⟦ + walked ↦ ξ.ρ.walk("**").at.ρ, + len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, + φ ↦ ξ.ρ.exists.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ + ) + ), + ξ.ρ + ), + rec-delete(tup, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + Φ̇.true, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), + ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) + ) + ) + ) + ⟧ + ⟧, + tmpfile() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), + Φ̇.error( + Φ̇.txt.sprintf( + "Directory %s does not exist, can't create temporary file", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch + ⟧ + ⟧, + open(mode, scope) ↦ ⟦ + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "The file %s is a directory, can't open for I/O operations", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi new file mode 100644 index 000000000..790880f87 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi @@ -0,0 +1,164 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + file(path) ↦ ⟦ + φ ↦ ξ.path, + is-directory() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_is_directory + ⟧, + exists() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_exists + ⟧, + touched() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) + ), + touch() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_touched_touch + ⟧ + ⟧, + deleted() ↦ ⟦ + φ ↦ ξ.ρ.exists.if( + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ + ), + delete() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_deleted_delete + ⟧ + ⟧, + size() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_size + ⟧, + moved(target) ↦ ⟦ + φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), + move() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_moved_move + ⟧ + ⟧, + as-path() ↦ ⟦ + φ ↦ Φ̇.fs.path(ξ.ρ.path).determined + ⟧, + open(mode, scope) ↦ ⟦ + access ↦ Φ̇.dataized(ξ.mode).as-bytes, + read ↦ ξ.access.eq("r"), + write ↦ ξ.access.eq("w"), + append ↦ ξ.access.eq("a"), + read-write ↦ ξ.access.eq("r+"), + write-read ↦ ξ.access.eq("w+"), + read-append ↦ ξ.access.eq("a+"), + can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, + can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( + ξ.append + ).as-bool, + must-exists ↦ ξ.read.or(ξ.read-write).as-bool, + truncate ↦ ξ.write.or(ξ.write-read).as-bool, + φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( + Φ̇.error( + "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + ), + ξ.ρ.exists.not.if( + ξ.must-exists.if( + Φ̇.error( + Φ̇.txt.sprintf( + "File must exist for given access mod: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.access) + ) + ), + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file + ), + ξ.ρ + ) + ) + ), + ξ.truncate.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch + ), + ξ.process-file + ), + ξ.ρ + ) + ), + Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) + ) + ) + ), + process-file() ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_process_file + ⟧, + file-stream() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( + ξ.auto-named-attr-at-211-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ) + ).self, + auto-named-attr-at-211-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't read from file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + read-bytes(size) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( + ξ.auto-named-attr-at-252-18, + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ) + ).self, + auto-named-attr-at-252-18() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Can't write to file with provided access mode '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) + ) + ) + ⟧ + ⟧ + ⟧, + written-bytes(buffer) ↦ ⟦ + λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi new file mode 100644 index 000000000..ed033be99 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi @@ -0,0 +1,273 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + path(uri) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) + ).determined, + joined(paths) ↦ ⟦ + joined-path ↦ Φ̇.string( + Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes + ), + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) + ).normalized + ⟧, + separator() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) + ⟧, + posix(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ "/", + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-absolute() ↦ ⟦ + φ ↦ ξ.ρ.uri.length.gt(0).and( + ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ ξ.ρ.uri.as-bytes, + is-absolute ↦ ξ.ρ.is-absolute.as-bool, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( + Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 + ) + ), + normalized ↦ ξ.ρ.uri.length.eq(0).if( + ".", + ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.posix( + ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) + ).determined, + auto-named-attr-at-102-25(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + other-as-bytes ↦ ξ.other.as-bytes, + φ ↦ ξ.ρ.ρ.posix( + Φ̇.string( + ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧, + win32(uri) ↦ ⟦ + separator ↦ "\\", + φ ↦ ξ.validated( + Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) + ).determined, + validated(uri) ↦ ⟦ + determined ↦ ξ, + separator ↦ ξ.ρ.separator, + as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, + as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, + φ ↦ ξ.uri, + is-drive-relative(uri) ↦ ⟦ + φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool + ⟧, + is-root-relative(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) + ) + ⟧, + separated-correctly(uri) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, + pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), + replaced ↦ Φ̇.dataized( + ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) + ).as-bytes, + φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( + Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) + ) + ⟧, + is-absolute() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + φ ↦ ξ.uri-as-bytes.size.eq(0).if( + Φ̇.false, + ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( + ξ.uri-as-bytes.size.gt(1).and( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes) + ) + ) + ) + ⟧, + normalized() ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, + is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, + driveless ↦ Φ̇.dataized( + ξ.is-drive-relative.if( + ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes + ) + ).as-bytes, + has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( + ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( + ξ.ρ.separator + ) + ), + path ↦ Φ̇.dataized( + Φ̇.txt.text(ξ.ρ.separator).joined( + Φ̇.structs.list( + Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) + ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) + ) + ).as-bytes, + normalized ↦ ξ.driveless.size.eq(0).if( + ".", + ξ.is-drive-relative.if( + ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( + ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) + ), + ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ).concat(ξ.path).concat( + ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.validated( + ξ.normalized.eq("\\\\").if( + ξ.ρ.separator, Φ̇.string(ξ.normalized) + ) + ).determined, + auto-named-attr-at-357-27(accum, segment) ↦ ⟦ + φ ↦ ξ.segment.eq("..").if( + ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( + ξ.accum.head, + ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( + ξ.accum.with(ξ.segment), ξ.accum + ) + ), + ξ.segment.eq(".").or(ξ.segment.eq("")).if( + ξ.accum, ξ.accum.with(ξ.segment) + ) + ) + ⟧ + ⟧, + resolved(other) ↦ ⟦ + uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, + other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, + other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, + φ ↦ ξ.ρ.ρ.validated( + Φ̇.string( + ξ.other-is-drive-relative.if( + ξ.valid-other, + ξ.other-is-root-relative.if( + ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( + ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other + ), + ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( + ξ.valid-other + ) + ) + ) + ) + ).normalized + ⟧, + basename() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + slice-start-idx ↦ Φ̇.dataized( + ξ.txt.last-index-of(ξ.ρ.separator).plus(1) + ).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( + ξ.pth, + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + extname() ↦ ⟦ + base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), + slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, + φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( + "", + Φ̇.string( + ξ.txt.slice( + ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) + ).as-bytes + ) + ) + ⟧, + dirname() ↦ ⟦ + pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, + txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), + len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, + φ ↦ Φ̇.string( + ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( + ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi new file mode 100644 index 000000000..13fb1e7a9 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi @@ -0,0 +1,39 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + fs() ↦ ⟦ + tmpdir() ↦ ⟦ + φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), + os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, + os-tmp-dir-1() ↦ ⟦ + tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, + tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, + temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, + tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, + userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir.eq("").if( + ξ.tmp.eq("").if( + ξ.temp.eq("").if( + ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp + ), + ξ.tmp + ), + ξ.tmpdir + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi new file mode 100644 index 000000000..8c451a69f --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi @@ -0,0 +1,34 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + go() ↦ ⟦ + id ↦ Φ̇.dataized( + Φ̇.malloc.of( + 8, + ⟦ + m ↦ ∅, + φ ↦ ξ.m.put(ξ.m.id) + ⟧ + ) + ).as-bytes, + to(body) ↦ ⟦ + φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), + token() ↦ ⟦ + backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), + jump(value) ↦ ⟦ + id ↦ ξ.ρ.ρ.ρ.id + ⟧, + forward(res) ↦ ⟦ + φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) + ⟧ + ⟧, + auto-named-attr-at-63-9(e) ↦ ⟦ + φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/i16.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/i16.phi new file mode 100644 index 000000000..74c23c0a3 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/i16.phi @@ -0,0 +1,67 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i16(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i16 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32.as-i16), + as-i64 ↦ ξ.as-i32.as-i64, + as-number ↦ ξ.as-i64.as-number, + as-i32() ↦ ⟦ + λ ⤍ Lorg_eolang_i16_as_i32 + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lt(ξ.x.as-i16.as-i32) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.lte(ξ.x.as-i16.as-i32) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gt(ξ.x.as-i16.as-i32) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i32.gte(ξ.x.as-i16.as-i32) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.times(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i32.plus(ξ.x.as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if(ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i16.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i16 ↦ ξ.x.as-i16, + bts ↦ ξ.ρ.as-i32.div(ξ.x-as-i16.as-i32).as-bytes, + left ↦ ξ.bts.slice(0, 2), + right ↦ ξ.bts.slice(2, 2), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧), + φ ↦ ξ.x-as-i16.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i16 zero", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i32.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧))).if( + ξ.ρ.ρ.i16(ξ.right), ξ.ρ.ρ.i16(ξ.left).plus(ξ.ρ.ρ.i16(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/i32.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/i32.phi new file mode 100644 index 000000000..6ae94a781 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/i32.phi @@ -0,0 +1,79 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i32(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i32 ↦ ξ, + neg ↦ ξ.times(-1.as-i64.as-i32), + as-number ↦ ξ.as-i64.as-number, + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_i32_as_i64 + ⟧, + as-i16() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 2).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF ⟧)) + ).if( + Φ̇.i16(ξ.ρ.as-bytes.slice(2, 2)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i32 number %d to i16 because it's out of i16 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ) + ) + ⟧, + lt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lt(ξ.x.as-i32.as-i64) + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.lte(ξ.x.as-i32.as-i64) + ⟧, + gt(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gt(ξ.x.as-i32.as-i64) + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.as-i64.gte(ξ.x.as-i32.as-i64) + ⟧, + times(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.times(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + plus(x) ↦ ⟦ + bts ↦ ξ.ρ.as-i64.plus(ξ.x.as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if(ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right))) + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ.plus(ξ.x.as-i32.neg) + ⟧, + div(x) ↦ ⟦ + x-as-i32 ↦ ξ.x.as-i32, + bts ↦ ξ.ρ.as-i64.div(ξ.x-as-i32.as-i64).as-bytes, + left ↦ ξ.bts.slice(0, 4), + right ↦ ξ.bts.slice(4, 4), + zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧), + φ ↦ ξ.x-as-i32.eq(ξ.zero).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't divide %d by i32 zero", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-i64.as-number) + ) + ), + ξ.left.eq(ξ.zero).or(ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧))).if( + ξ.ρ.ρ.i32(ξ.right), ξ.ρ.ρ.i32(ξ.left).plus(ξ.ρ.ρ.i32(ξ.right)) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/i64.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/i64.phi new file mode 100644 index 000000000..058f2a5d1 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/i64.phi @@ -0,0 +1,59 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + i64(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-i64 ↦ ξ, + neg ↦ ξ.times(-1.as-i64), + as-i16 ↦ ξ.as-i32.as-i16, + as-i32() ↦ ⟦ + left ↦ ξ.ρ.as-bytes.slice(0, 4).as-bytes, + φ ↦ ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00 ⟧)).or( + ξ.left.eq(Φ̇.bytes(⟦ Δ ⤍ FF-FF-FF-FF ⟧)) + ).if( + Φ̇.i32(ξ.ρ.as-bytes.slice(4, 4)), + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert i64 number %d to i32 because it's out of i32 bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.as-number) + ) + ) + ) + ⟧, + as-number() ↦ ⟦ + λ ⤍ Lorg_eolang_i64_as_number + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.as-i64.gt(ξ.ρ.minus(ξ.ρ.ρ.i64(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(ξ.ρ.ρ.i64(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_i64_div + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi new file mode 100644 index 000000000..9cca7961f --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi @@ -0,0 +1,36 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + bytes-as-input(bts) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(data, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + to-read ↦ Φ̇.dataized(ξ.size).as-bytes, + available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, + next ↦ Φ̇.dataized( + Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) + ).as-bytes, + φ ↦ ξ.available.eq(0).if( + ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), + ξ.ρ.ρ.input-block( + ξ.ρ.data.slice( + ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) + ).as-bytes, + ξ.ρ.data.slice(0, ξ.next).as-bytes + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi new file mode 100644 index 000000000..f3927bdbc --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi @@ -0,0 +1,122 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + console() ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, + posix-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.posix( + "read", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.posix( + "write", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + windows-console() ↦ ⟦ + platform ↦ ξ, + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ Φ̇.dataized( + Φ̇.sys.win32( + "ReadFile", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size + ) + ).output + ).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧, + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.sys.win32( + "WriteFile", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle + ), + ξ.buffer + ), + ξ.buffer.size + ) + ).code + ), + ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-input.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-input.phi new file mode 100644 index 000000000..85207b6ab --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-input.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-input() ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block, + input-block() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), + read(size) ↦ ⟦ + φ ↦ ξ.ρ.ρ.input-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-output.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-output.phi new file mode 100644 index 000000000..d42577e42 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/dead-output.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + dead-output() ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block() ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi new file mode 100644 index 000000000..88fa9373e --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + input-length(input) ↦ ⟦ + chunk ↦ 4096, + φ ↦ ξ.rec-read(ξ.input, 0), + rec-read(input, length) ↦ ⟦ + read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, + φ ↦ ξ.read-bytes.size.eq(0).if( + ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi new file mode 100644 index 000000000..411aff509 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + malloc-as-output(allocated) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block(0).write(ξ.buffer).self, + output-block(offset) ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) + ), + ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi new file mode 100644 index 000000000..cf3083bdc --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi @@ -0,0 +1,45 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdin() ↦ ⟦ + φ ↦ ξ.all-lines, + all-lines() ↦ ⟦ + φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), + separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, + rec-read(line, buffer, first) ↦ ⟦ + φ ↦ ξ.line.length.eq(0).if( + Φ̇.string(ξ.buffer), + ξ.ρ.rec-read( + ξ.ρ.ρ.next-line, + ξ.first.if( + ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) + ), + Φ̇.false + ) + ) + ⟧ + ⟧, + next-line() ↦ ⟦ + first ↦ Φ̇.io.console.read(1).self, + φ ↦ ξ.first.as-bytes.size.eq(0).if( + "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) + ), + rec-read(input, buffer) ↦ ⟦ + char ↦ ξ.input.as-bytes, + next ↦ ξ.input.read(1).self, + φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( + ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) + ).if( + Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi new file mode 100644 index 000000000..0f0ffc3d7 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + stdout(text) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true + ) + ) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi new file mode 100644 index 000000000..877892a2c --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi @@ -0,0 +1,34 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + io() ↦ ⟦ + tee-input(input, output) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( + ξ.size + ).self, + input-block(input, output, buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, + written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), + ξ.ρ.ρ.input-block( + ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes + ) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi new file mode 100644 index 000000000..36907019c --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi @@ -0,0 +1,55 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + malloc() ↦ ⟦ + empty(scope) ↦ ⟦ + φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) + ⟧, + for(object, scope) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.object).as-bytes, + φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), + auto-named-attr-at-96-9(m) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) + ) + ) + ⟧ + ⟧, + of(size, scope) ↦ ⟦ + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_φ + ⟧, + allocated(id) ↦ ⟦ + φ ↦ ξ.get, + get ↦ ξ.read(0, ξ.size), + size() ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_size + ⟧, + resized(new-size) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_resized + ⟧, + copy(source, target, length) ↦ ⟦ + φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) + ⟧, + read(offset, length) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_read + ⟧, + write(offset, data) ↦ ⟦ + λ ⤍ Lorg_eolang_malloc_of_allocated_write + ⟧, + put(object) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get + ) + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi new file mode 100644 index 000000000..36e3a037d --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + angle(value) ↦ ⟦ + φ ↦ ξ.value, + in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), + in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), + sin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_sin + ⟧, + cos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_angle_cos + ⟧, + tan() ↦ ⟦ + cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, + φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) + ⟧, + ctan() ↦ ⟦ + sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, + φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi new file mode 100644 index 000000000..d317affda --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi @@ -0,0 +1,12 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + e ↦ 2.718281828459045, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi new file mode 100644 index 000000000..8d91be218 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi @@ -0,0 +1,66 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + integral(fun, a, b, n) ↦ ⟦ + subsection(a, b) ↦ ⟦ + φ ↦ ξ.b.minus(ξ.a).div(6).times( + ξ.ρ.fun(ξ.a).plus( + 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) + ) + ) + ⟧, + φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, + auto-named-attr-at-50-11(sum) ↦ ⟦ + φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), + auto-named-attr-at-53-16(left) ↦ ⟦ + right ↦ ξ.ρ.ρ.b, + step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.while( + ξ.auto-named-attr-at-58-19, + ⟦ + i ↦ ∅, + φ ↦ Φ̇.true + ⟧ + ) + ), + ξ.ρ.sum + ) + ), + auto-named-attr-at-58-19(i) ↦ ⟦ + φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + ξ.ρ.ρ.sum.put( + ξ.ρ.ρ.sum.as-number.plus( + ξ.ρ.ρ.ρ.subsection( + ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) + ) + ) + ) + ), + ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) + ), + Φ̇.true + ) + ), + Φ̇.false + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi new file mode 100644 index 000000000..0d8b00b73 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi @@ -0,0 +1,42 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + numbers(sequence) ↦ ⟦ + φ ↦ ξ.sequence, + max() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get max number from empty sequence"), + ξ.lst.reduced( + Φ̇.negative-infinity, + ⟦ + max ↦ ∅, + item ↦ ∅, + φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) + ⟧ + ) + ) + ⟧, + min() ↦ ⟦ + lst ↦ Φ̇.structs.list(ξ.ρ.sequence), + φ ↦ ξ.lst.is-empty.if( + Φ̇.error("Can't get min number from empty sequence"), + ξ.lst.reduced( + Φ̇.positive-infinity, + ⟦ + min ↦ ∅, + item ↦ ∅, + φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) + ⟧ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi new file mode 100644 index 000000000..30ce1a6b3 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi @@ -0,0 +1,12 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + pi ↦ 3.141592653589793, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi new file mode 100644 index 000000000..fbd838b98 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi @@ -0,0 +1,53 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + random(seed) ↦ ⟦ + fixed ↦ ξ, + φ ↦ ξ.seed.as-number.div( + Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number + ), + next ↦ ξ.ρ.random( + ξ.seed.times(25214903917).plus(11).as-i64.and( + Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) + ).as-i64.as-number + ).fixed, + pseudo() ↦ ⟦ + const-1 ↦ 35, + const-2 ↦ 53, + const-3 ↦ 17, + one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), + φ ↦ ξ.ρ.ρ.random(ξ.time-seed), + time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( + ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.left(ξ.const-3).and( + ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes + ).as-i64.plus( + ξ.time-bytes.and( + ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes + ).as-i64 + ) + ).as-number, + time-bytes ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) + ).milliseconds, + ⟦ + timeval ↦ Φ̇.sys.posix( + "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) + ).output, + φ ↦ ξ.timeval.tv-sec.times(1000).plus( + ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number + ) + ⟧ + ).as-i64.as-bytes + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi new file mode 100644 index 000000000..ca17c2711 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi @@ -0,0 +1,49 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + math() ↦ ⟦ + real(num) ↦ ⟦ + φ ↦ ξ.num, + exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), + mod(x) ↦ ⟦ + dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), + divisor ↦ Φ̇.number(ξ.x.as-bytes), + φ ↦ ξ.divisor.eq(0).if( + Φ̇.error("Can't calculate mod by zero"), + ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) + ), + abs-mod() ↦ ⟦ + dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, + divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, + φ ↦ ξ.dividend-abs.minus( + ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) + ) + ⟧ + ⟧, + abs() ↦ ⟦ + value ↦ Φ̇.number(ξ.ρ.num.as-bytes), + φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) + ⟧, + pow(x) ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_pow + ⟧, + sqrt() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_sqrt + ⟧, + ln() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_ln + ⟧, + acos() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_acos + ⟧, + asin() ↦ ⟦ + λ ⤍ Lorg_eolang_math_real_asin + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/nan.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/nan.phi new file mode 100644 index 000000000..623d64a32 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/nan.phi @@ -0,0 +1,44 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + nan() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/negative-infinity.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/negative-infinity.phi new file mode 100644 index 000000000..66a584d23 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/negative-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + negative-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi new file mode 100644 index 000000000..b7d2d7595 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi @@ -0,0 +1,535 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + net() ↦ ⟦ + socket(address, port) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) + ), + htons(port) ↦ ⟦ + bts ↦ ξ.port.as-i16.as-bytes, + φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( + ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) + ).as-i16 + ⟧, + as-input(recv) ↦ ⟦ + read(size) ↦ ⟦ + φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, + input-block(buffer) ↦ ⟦ + self ↦ ξ, + φ ↦ ξ.buffer, + read(size) ↦ ⟦ + read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + as-output(send) ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block.write(ξ.buffer).self, + output-block() ↦ ⟦ + self ↦ ξ, + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block + ) + ).self + ⟧ + ⟧ + ⟧ + ⟧, + posix-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.posix( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream + ), + Φ̇.sys.posix.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.posix( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.posix.sockaddr-in( + Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.posix( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.posix( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + strerror() ↦ ⟦ + φ ↦ Φ̇.sys.posix( + "strerror", + Φ̇.tuple( + Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code + ) + ) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, + φ ↦ ξ.closed.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + φ ↦ ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a posix socket, reason: '%s'", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-274-10), + auto-named-attr-at-274-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.posix( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-298-10), + auto-named-attr-at-298-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.posix( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.posix( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.strerror.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-323-22)).as-bytes + ) + ), + auto-named-attr-at-323-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.posix( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on posix socket '%d', reason: %s", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + win-socket(address, port) ↦ ⟦ + sd ↦ Φ̇.sys.win32( + "socket", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream + ), + Φ̇.sys.win32.ipproto-tcp + ) + ).code, + inet-addr ↦ Φ̇.sys.win32( + "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) + ).code, + inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code + ) + ) + ), + ξ.inet-addr.as-i32 + ), + sockaddr ↦ Φ̇.sys.win32.sockaddr-in( + Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int + ), + scoped-socket(sockfd) ↦ ⟦ + as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), + as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), + send(buffer) ↦ ⟦ + buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, + sent ↦ Φ̇.sys.win32( + "send", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size + ), + 0 + ) + ).code, + φ ↦ ξ.sent.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to send message through the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.sent + ) + ⟧, + recv(size) ↦ ⟦ + received ↦ Φ̇.sys.win32( + "recv", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 + ) + ).called, + φ ↦ ξ.received.code.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to receive data from the socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code + ) + ) + ), + ξ.received.output + ) + ⟧ + ⟧, + last-error() ↦ ⟦ + φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) + ⟧, + closed-socket(sockfd) ↦ ⟦ + closed ↦ Φ̇.sys.win32( + "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) + ).code, + φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't close a win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code + ) + ) + ), + Φ̇.true + ) + ⟧, + safe-socket(scope) ↦ ⟦ + started-up ↦ Φ̇.sys.win32( + "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) + ).code, + cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, + φ ↦ ξ.started-up.eq(0).not.if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) + ) + ), + Φ̇.try( + ξ.ρ.sd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't create a win32 socket, WSA error code: %d", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) + ) + ), + Φ̇.try( + ξ.scope, + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.ρ.closed-socket(ξ.ρ.sd) + ) + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( + Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true + ) + ) + ) + ⟧, + connect(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-483-10), + auto-named-attr-at-483-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + connected ↦ Φ̇.sys.win32( + "connect", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ ξ.connected.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes + ) + ⟧ + ⟧, + listen(scope) ↦ ⟦ + φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-507-10), + auto-named-attr-at-507-10() ↦ ⟦ + sock ↦ ξ.ρ.ρ, + bound ↦ Φ̇.sys.win32( + "bind", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + listened ↦ Φ̇.sys.win32( + "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) + ).code, + φ ↦ ξ.bound.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address + ), + ξ.sock.port + ), + ξ.sock.last-error.code + ) + ) + ), + ξ.listened.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port + ), + ξ.sock.sd + ), + ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-532-22)).as-bytes + ) + ), + auto-named-attr-at-532-22() ↦ ⟦ + φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), + accept(scope) ↦ ⟦ + sock ↦ ξ.ρ.ρ.sock, + client-sockfd ↦ Φ̇.sys.win32( + "accept", + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr + ), + ξ.sock.sockaddr.size + ) + ).code, + φ ↦ Φ̇.try( + ξ.client-sockfd.eq(-1).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Failed to accept a connection on win32 socket '%d', WSA error code: %d", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code + ) + ) + ), + Φ̇.dataized( + ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) + ).as-bytes + ), + ⟦ + ex ↦ ∅, + φ ↦ Φ̇.error(ξ.ex) + ⟧, + ξ.sock.closed-socket(ξ.client-sockfd) + ) + ⟧ + ⟧ + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/number.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/number.phi new file mode 100644 index 000000000..5408a0ed7 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/number.phi @@ -0,0 +1,74 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 + ⟧, + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor() ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer() ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite() ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/positive-infinity.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/positive-infinity.phi new file mode 100644 index 000000000..22f1d8c15 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/positive-infinity.phi @@ -0,0 +1,61 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + positive-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/seq.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/seq.phi new file mode 100644 index 000000000..6eb23c23b --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/seq.phi @@ -0,0 +1,17 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/string.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/string.phi new file mode 100644 index 000000000..a7101ec39 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/string.phi @@ -0,0 +1,155 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length() ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) + ⟧, + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧, + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) + ⟧, + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) + ) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi new file mode 100644 index 000000000..3693ebf06 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + bytes-as-array(bts) ↦ ⟦ + bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, + φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), + slice-byte(tup, index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( + ξ.ρ.slice-byte( + ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) + ), + ξ.tup + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi new file mode 100644 index 000000000..66d91abdf --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi @@ -0,0 +1,30 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + hash-code-of(input) ↦ ⟦ + input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, + size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, + magic-number ↦ 31.as-i64, + φ ↦ ξ.rec-hash-code(0, 0), + rec-hash-code(acc, index) ↦ ⟦ + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.acc.as-number, + ξ.ρ.rec-hash-code( + ξ.ρ.magic-number.times(ξ.acc).plus( + Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( + ξ.ρ.input-as-bytes.slice(ξ.index, 1) + ).as-i64 + ), + ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi new file mode 100644 index 000000000..6630ed3c6 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi @@ -0,0 +1,194 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + list(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-empty() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.origin.length) + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) + ⟧, + withi(index, item) ↦ ⟦ + φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( + ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) + ) + ⟧, + reducedi(start, func) ↦ ⟦ + origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), + rec-reduced(accum, index) ↦ ⟦ + idx-as-number ↦ ξ.index.as-number, + next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, + φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( + ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) + ), + accumulated ↦ ξ.ρ.func( + ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number + ) + ⟧ + ⟧, + reduced(start, func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), + auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.accum, ξ.item) + ⟧ + ⟧, + mappedi(func) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) + ), + auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) + ⟧ + ⟧, + mapped(func) ↦ ⟦ + φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), + auto-named-attr-at-103-30(item, idx) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + eachi(func) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), + auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ + φ ↦ Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) + ) + ) + ⟧ + ⟧, + each(func) ↦ ⟦ + φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-123-32), + auto-named-attr-at-123-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + withouti(i) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-130-24) + ), + auto-named-attr-at-130-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + without(element) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list( + ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-141-20) + ), + auto-named-attr-at-141-20(accum, item) ↦ ⟦ + φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + eq(other) ↦ ⟦ + φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( + ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-156-24) + ), + auto-named-attr-at-156-24(accum, item, idx) ↦ ⟦ + φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) + ⟧ + ⟧, + concat(passed) ↦ ⟦ + φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( + ξ.ρ, + ⟦ + accum ↦ ∅, + item ↦ ∅, + φ ↦ ξ.accum.with(ξ.item) + ⟧ + ) + ⟧, + index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-176-24), + auto-named-attr-at-176-24(accum, item, index) ↦ ⟦ + φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) + ⟧ + ⟧, + last-index-of(wanted) ↦ ⟦ + φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-189-24), + auto-named-attr-at-189-24(accum, item, index) ↦ ⟦ + φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) + ⟧ + ⟧, + contains(element) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not + ⟧, + sorted() ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + filteredi(func) ↦ ⟦ + origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), + rec-filtered(idx-as-bytes, accum) ↦ ⟦ + original ↦ ξ.ρ.ρ.origin, + index ↦ ξ.idx-as-bytes.as-number, + item ↦ ξ.ρ.ρ.origin.at(ξ.index), + φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( + ξ.accum, + ξ.ρ.rec-filtered( + 1.plus(ξ.index).as-bytes, + ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) + ) + ) + ⟧ + ⟧, + filtered(func) ↦ ⟦ + φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-238-32), + auto-named-attr-at-238-32(item, index) ↦ ⟦ + φ ↦ ξ.ρ.func(ξ.item) + ⟧ + ⟧, + head(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + φ ↦ Φ̇.switch( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple( + Φ̇.tuple.empty, + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ + ) + ), + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-259-32) + ) + ) + ) + ), + auto-named-attr-at-259-32(accum, item, index) ↦ ⟦ + φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) + ⟧ + ⟧, + tail(index) ↦ ⟦ + idx ↦ Φ̇.dataized(ξ.index).as-bytes, + start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, + φ ↦ 0.gt(ξ.start).if( + ξ.ρ, + ξ.ρ.ρ.list( + ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-275-26) + ) + ), + auto-named-attr-at-275-26(accum, item, idx) ↦ ⟦ + φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi new file mode 100644 index 000000000..02ae19c86 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi @@ -0,0 +1,122 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + map(pairs) ↦ ⟦ + φ ↦ ξ.auto-named-attr-at-37-6.initialized, + entry(key, value) ↦ ⟦⟧, + initialized(entries) ↦ ⟦ + initialized ↦ ξ, + size ↦ ξ.entries.length, + keys() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + entry ↦ ∅, + φ ↦ ξ.entry.key + ⟧ + ) + ⟧, + values() ↦ ⟦ + φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( + ⟦ + entry ↦ ∅, + φ ↦ ξ.entry.value + ⟧ + ) + ⟧, + has(key) ↦ ⟦ + φ ↦ ξ.ρ.found(ξ.key).exists + ⟧, + found(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), + rec-key-search(found, index) ↦ ⟦ + entry ↦ ξ.ρ.ρ.entries.at(ξ.index), + φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( + ξ.found, + ξ.ρ.rec-key-search( + ξ.ρ.hash.eq(ξ.entry.hash).if( + ξ.auto-named-attr-at-125-54, ξ.found + ), + ξ.index.plus(1) + ) + ), + auto-named-attr-at-125-54() ↦ ⟦ + exists ↦ Φ̇.true, + get ↦ ξ.ρ.entry.value + ⟧ + ⟧, + not-found() ↦ ⟦ + exists ↦ Φ̇.false, + get ↦ Φ̇.error( + Φ̇.txt.sprintf( + "Object by hash code %d from given key does not exists", + Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) + ) + ) + ⟧ + ⟧, + with(key, value) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-145-50 + ).origin.with(ξ.auto-named-attr-at-146-12) + ), + auto-named-attr-at-145-50(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧, + auto-named-attr-at-146-12() ↦ ⟦ + key ↦ ξ.ρ.key, + value ↦ ξ.ρ.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧, + without(key) ↦ ⟦ + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, + φ ↦ ξ.ρ.ρ.ρ.map.initialized( + Φ̇.structs.list(ξ.ρ.entries).filtered( + ξ.auto-named-attr-at-159-48 + ).origin + ), + auto-named-attr-at-159-48(entry) ↦ ⟦ + φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not + ⟧ + ⟧ + ⟧, + auto-named-attr-at-37-6() ↦ ⟦ + pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, + φ ↦ ξ.ρ.initialized( + ξ.pairs-size.eq(0).if( + Φ̇.tuple.empty, + ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) + ) + ), + rec-rebuild(accum, index, hashes) ↦ ⟦ + entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), + hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, + φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( + ξ.accum, + ξ.ρ.rec-rebuild( + ξ.hashes.contains(ξ.hash).if( + ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) + ), + ξ.index.plus(1), + ξ.hashes.with(ξ.hash) + ) + ), + auto-named-attr-at-59-18() ↦ ⟦ + key ↦ ξ.ρ.entry.key, + value ↦ ξ.ρ.entry.value, + hash ↦ ξ.ρ.hash + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi new file mode 100644 index 000000000..f477d2a18 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi @@ -0,0 +1,26 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range-of-ints(start, end) ↦ ⟦ + φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( + 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) + ).if( + Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), + Φ̇.error("Some of the arguments are not integers") + ), + auto-named-attr-at-42-8() ↦ ⟦ + build(num) ↦ ⟦ + φ ↦ ξ.num, + next ↦ ξ.ρ.build(1.plus(ξ.φ)) + ⟧, + φ ↦ ξ.build(ξ.ρ.start) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi new file mode 100644 index 000000000..338bb09dd --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + range(start, end) ↦ ⟦ + φ ↦ Φ̇.structs.list( + ξ.start.lt(ξ.end).if( + ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty + ) + ), + appended(acc, current) ↦ ⟦ + φ ↦ ξ.current.lt(ξ.ρ.end).if( + ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi new file mode 100644 index 000000000..72f9f44e3 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi @@ -0,0 +1,37 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + structs() ↦ ⟦ + set(lst) ↦ ⟦ + φ ↦ ξ.initialized( + Φ̇.structs.map( + Φ̇.structs.list(ξ.lst).mapped( + ⟦ + item ↦ ∅, + φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true) + ⟧ + ).origin + ) + ).initialized, + initialized(map) ↦ ⟦ + initialized ↦ ξ, + φ ↦ ξ.map.keys, + size ↦ ξ.map.size, + with(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) + ⟧, + without(item) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) + ⟧, + has(item) ↦ ⟦ + φ ↦ ξ.ρ.map.has(ξ.item) + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi new file mode 100644 index 000000000..07c5340cd --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi @@ -0,0 +1,18 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + switch(cases) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), + case-at(index) ↦ ⟦ + case ↦ ξ.ρ.cases.at(ξ.index), + φ ↦ ξ.index.eq(ξ.ρ.len).if( + Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi new file mode 100644 index 000000000..4697eba5d --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi @@ -0,0 +1,19 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + getenv(name) ↦ ⟦ + φ ↦ Φ̇.sys.os.is-windows.if( + Φ̇.sys.win32( + "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) + ), + Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) + ).output + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi new file mode 100644 index 000000000..34a457b2e --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + line-separator() ↦ ⟦ + φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi new file mode 100644 index 000000000..e545be378 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi @@ -0,0 +1,23 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + os() ↦ ⟦ + φ ↦ ξ.name, + is-windows() ↦ ⟦ + os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, + φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) + ⟧, + is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, + is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, + name() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_os_name + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi new file mode 100644 index 000000000..5dcb9673b --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi @@ -0,0 +1,35 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + posix(name, args) ↦ ⟦ + stdin-fileno ↦ 0, + stdout-fileno ↦ 1, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + inaddr-none ↦ -1, + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_posix_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + timeval(tv-sec, tv-usec) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi new file mode 100644 index 000000000..25465a93e --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi @@ -0,0 +1,38 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + sys() ↦ ⟦ + win32(name, args) ↦ ⟦ + std-input-handle ↦ -10, + std-output-handle ↦ -11, + af-inet ↦ 2, + sock-stream ↦ 1, + ipproto-tcp ↦ 6, + invalid-socket ↦ -1, + socket-error ↦ -1, + inaddr-none ↦ -1, + winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), + φ() ↦ ⟦ + λ ⤍ Lorg_eolang_sys_win32_φ + ⟧, + return(code, output) ↦ ⟦ + called ↦ ξ, + φ ↦ ξ.output + ⟧, + system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ + self ↦ ξ + ⟧, + sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ + sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), + size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( + ξ.sin-zero.size + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/true.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/true.phi new file mode 100644 index 000000000..095bf119c --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/true.phi @@ -0,0 +1,21 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + true() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧), + not ↦ Φ̇.false, + if(left, right) ↦ ⟦ + φ ↦ ξ.left + ⟧, + and(x) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 01- ⟧).eq(ξ.x) + ⟧, + or(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/try.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/try.phi new file mode 100644 index 000000000..0117c82f8 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/try.phi @@ -0,0 +1,11 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + try(main, catch, finally) ↦ ⟦ + λ ⤍ Lorg_eolang_try + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/tuple.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/tuple.phi new file mode 100644 index 000000000..a71f13342 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/tuple.phi @@ -0,0 +1,39 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + tuple(head, tail) ↦ ⟦ + empty() ↦ ⟦ + length ↦ 0, + at(i) ↦ ⟦ + φ ↦ Φ̇.error("Can't get an object from the empty tuple") + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + length() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.head.length.plus(1)).as-bytes, + φ ↦ Φ̇.number(ξ.len) + ⟧, + at(i) ↦ ⟦ + len ↦ ξ.ρ.length, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized(0.gt(ξ.idx).if(ξ.len.plus(ξ.idx), ξ.idx)).as-bytes, + φ ↦ 0.gt(ξ.index).or(ξ.len.lte(ξ.index)).if( + Φ̇.error("Given index is out of tuple bounds"), ξ.at-fast(ξ.ρ, ξ.len) + ), + at-fast(tup, len) ↦ ⟦ + φ ↦ ξ.len.plus(-1).gt(ξ.ρ.index).if( + ξ.ρ.at-fast(ξ.tup.head, ξ.len.plus(-1)), ξ.tup.tail + ) + ⟧ + ⟧, + with(x) ↦ ⟦ + φ ↦ ξ.ρ.ρ.tuple(ξ.ρ, ξ.x) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi new file mode 100644 index 000000000..f4c9ca8d2 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi @@ -0,0 +1,56 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + regex(expression) ↦ ⟦ + φ ↦ ξ.compiled, + compiled() ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_compiled + ⟧, + pattern(serialized) ↦ ⟦ + matches(txt) ↦ ⟦ + φ ↦ ξ.ρ.match(ξ.txt).next.exists + ⟧, + match(txt) ↦ ⟦ + next ↦ ξ.matched-from-index(1, 0).matched, + matched-from-index(position, start) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index + ⟧, + matched(position, start, from, to, groups) ↦ ⟦ + matched ↦ ξ, + groups-count ↦ ξ.groups.length, + exists ↦ ξ.start.gte(0), + next ↦ ξ.exists.if( + ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, + Φ̇.error("Matched block does not exist, can't get next") + ), + text ↦ ξ.exists.if( + ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") + ), + group(index) ↦ ⟦ + φ ↦ ξ.ρ.groups.at(ξ.index) + ⟧ + ⟧, + not-matched(position) ↦ ⟦ + φ ↦ ξ.ρ.matched( + ξ.position, + -1, + Φ̇.error( + "Matched block does not exist, can't get 'from' position" + ), + Φ̇.error( + "Matched block does not exist, can't get 'to' position" + ), + Φ̇.error("Matched block does not exist, can't get groups") + ) + ⟧ + ⟧ + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sprintf.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sprintf.phi new file mode 100644 index 000000000..e17f08b1f --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sprintf.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi new file mode 100644 index 000000000..b8353c056 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi @@ -0,0 +1,14 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sscanf(format, read) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sscanf + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi new file mode 100644 index 000000000..28cb8d7d8 --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi @@ -0,0 +1,275 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + text(origin) ↦ ⟦ + φ ↦ ξ.origin, + is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), + is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), + is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), + slice(start, len) ↦ ⟦ + φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) + ⟧, + trimmed-left() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.index, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index + ) + ) + ⟧ + ⟧, + trimmed-right() ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, + φ ↦ 0.eq(ξ.len).if( + ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) + ), + first-non-space-index(index) ↦ ⟦ + char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, + φ ↦ -1.eq(ξ.index).if( + 0, + " ".eq(ξ.char).if( + ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + trimmed() ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) + ⟧, + joined(items) ↦ ⟦ + delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + first ↦ ξ.items.at(0), + len ↦ Φ̇.dataized(ξ.items.length).as-bytes, + not-empty ↦ Φ̇.dataized( + 1.eq(ξ.len).if( + ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) + ) + ).as-bytes, + φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), + with-delimiter(acc, index) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.index).if( + ξ.acc, + ξ.ρ.with-delimiter( + ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) + ) + ) + ⟧ + ⟧, + repeated(times) ↦ ⟦ + bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, + amount ↦ Φ̇.dataized(ξ.times).as-bytes, + φ ↦ 0.gt(ξ.amount).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) + ) + ), + ξ.ρ.ρ.text( + 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) + ) + ), + rec-repeated(accum, index) ↦ ⟦ + φ ↦ ξ.ρ.amount.eq(ξ.index).if( + ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) + ) + ⟧ + ⟧, + contains(substring) ↦ ⟦ + φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not + ⟧, + ends-with(substring) ↦ ⟦ + substr ↦ Φ̇.dataized(ξ.substring).as-bytes, + φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) + ⟧, + starts-with(substring) ↦ ⟦ + φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) + ⟧, + index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if(-1, ξ.rec-index-of-substr(0)), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ ξ.ρ.end.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + last-index-of(substring) ↦ ⟦ + self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, + substr ↦ Φ̇.string(ξ.substr-as-bytes), + sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, + φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( + ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) + ).if( + -1, + ξ.rec-index-of-substr( + Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) + ) + ), + rec-index-of-substr(idx) ↦ ⟦ + φ ↦ 0.eq(ξ.idx).if( + ξ.contains.if(ξ.idx, -1), + ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) + ), + contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) + ⟧, + substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes + ⟧, + up-cased() ↦ ⟦ + ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, + ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, + distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 + ) + ) + ), + ascii(char) ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number + ⟧, + auto-named-attr-at-258-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte + ) + ) + ⟧ + ⟧, + low-cased() ↦ ⟦ + ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), + ascii-a ↦ ξ.ρ.up-cased.ascii("A"), + φ ↦ ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( + Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 + ) + ) + ), + auto-named-attr-at-291-22(accum, byte) ↦ ⟦ + ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), + φ ↦ ξ.accum.concat( + ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( + ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( + 7, 1 + ), + ξ.byte + ) + ) + ⟧ + ⟧, + at(i) ↦ ⟦ + len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, + idx ↦ Φ̇.dataized(ξ.i).as-bytes, + index ↦ Φ̇.dataized( + 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) + ).as-bytes, + φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) + ) + ), + ξ.ρ.slice(ξ.index, 1) + ) + ⟧, + replaced(target, replacement) ↦ ⟦ + self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, + reinit ↦ Φ̇.string(ξ.self-as-bytes), + matched ↦ ξ.target.match(ξ.reinit).next, + φ ↦ ξ.matched.exists.not.if( + Φ̇.txt.text(ξ.reinit), + Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) + ), + rec-replaced(block, accum, start) ↦ ⟦ + φ ↦ ξ.block.exists.if( + ξ.ρ.rec-replaced( + ξ.block.next, + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) + ).concat(ξ.ρ.replacement), + ξ.block.to + ), + Φ̇.string( + ξ.accum.concat( + ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) + ) + ) + ) + ⟧ + ⟧, + as-number() ↦ ⟦ + scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), + φ ↦ ξ.scanned.length.eq(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) + ) + ), + ξ.scanned.tail + ) + ⟧, + split(delimiter) ↦ ⟦ + delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, + self-as-bytes ↦ ξ.ρ.origin.as-bytes, + len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, + φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), + rec-split(accum, start, current) ↦ ⟦ + φ ↦ ξ.ρ.len.eq(ξ.current).if( + ξ.with-substr, + ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( + ξ.ρ.rec-split( + ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) + ), + ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) + ) + ), + with-substr ↦ ξ.accum.with( + Φ̇.string( + ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) + ) + ) + ⟧ + ⟧, + chained(others) ↦ ⟦ + φ ↦ 0.eq(ξ.others.length).if( + ξ.ρ, + ξ.ρ.ρ.text( + Φ̇.string( + Φ̇.structs.list(ξ.others).reduced( + ξ.ρ.origin.as-bytes, + ⟦ + accum ↦ ∅, + str ↦ ∅, + φ ↦ ξ.accum.concat(ξ.str.as-bytes) + ⟧ + ) + ) + ) + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/while.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/while.phi new file mode 100644 index 000000000..79cb84cea --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/org/eolang/while.phi @@ -0,0 +1,22 @@ +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + while(condition, body) ↦ ⟦ + φ ↦ ξ.condition(0).as-bool.if(ξ.loop(0), Φ̇.false), + loop(index) ↦ ⟦ + current ↦ ξ.ρ.body(ξ.index), + φ ↦ ξ.ρ.condition(ξ.index.plus(1)).as-bool.if( + Φ̇.seq( + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple.empty, ξ.current), ξ.ρ.loop(ξ.index.plus(1)) + ) + ), + ξ.current + ) + ⟧ + ⟧, + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ +⟧} \ No newline at end of file From b3f40e0fd2ce55c74fe788a2dbaa9fd4f5302d2f Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 18:56:37 +0300 Subject: [PATCH 64/69] feat(eo-phi-normalizer): - support attribute sugar for phi - improve error reporting - remove some old code --- eo-phi-normalizer/grammar/EO/Phi/Syntax.cf | 1 + .../src/Language/EO/Phi/Pretty.hs | 6 +---- .../src/Language/EO/Phi/Rules/Yaml.hs | 13 +++------- .../src/Language/EO/Phi/Syntax.hs | 26 ++++++++++++------- .../src/Language/EO/Phi/Syntax/Abs.hs | 1 + .../src/Language/EO/Phi/Syntax/Doc.txt | 1 + .../src/Language/EO/Phi/Syntax/Par.y | 1 + .../src/Language/EO/Phi/ToLaTeX.hs | 17 +++++++----- 8 files changed, 35 insertions(+), 31 deletions(-) diff --git a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf index b30fe1c95..29c847fb3 100644 --- a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf +++ b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf @@ -82,6 +82,7 @@ MetaDeltaBinding. Binding ::= "Δ" "⤍" BytesMetaId ; separator Binding "," ; Phi. Attribute ::= "φ" ; -- decoratee object +PhiSugar. Attribute ::= "~" "φ" "(" [LabelId] ")"; Rho. Attribute ::= "ρ" ; -- parent object Label. Attribute ::= LabelId ; Alpha. Attribute ::= AlphaIndex ; diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs index 82101379a..68223e9b1 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -137,11 +137,7 @@ instance Pretty Abs.Attribute where Abs.Alpha alphaindex -> pretty alphaindex Abs.MetaAttr labelmetaid -> pretty labelmetaid Abs.AttrSugar labelid labelids -> pretty labelid <> lparen <> pretty labelids <> rparen - --- instance {-# OVERLAPPING #-} Pretty AttributeSugar where --- pretty = \case --- (Abs.AttrSugar labelid labelids) -> pretty labelid <> lparen <> pretty labelids <> rparen --- (Abs.AttrNormal labelid) -> pretty labelid + Abs.PhiSugar labelids -> pretty Abs.Phi <> lparen <> pretty labelids <> rparen instance {-# OVERLAPPING #-} Pretty [Abs.LabelId] where pretty = hsep . punctuate comma . fmap pretty diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs index 75ac44454..2e5a376ef 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Rules/Yaml.hs @@ -314,7 +314,8 @@ attrMetaIds Rho = mempty attrMetaIds (Label _) = mempty attrMetaIds (Alpha _) = mempty attrMetaIds (MetaAttr x) = Set.singleton (MetaIdLabel x) -attrMetaIds a@(AttrSugar{}) = error ("impossible: expected desugared attribute, but got: " <> printTree a) +attrMetaIds a@(AttrSugar{}) = errorExpectedDesugaredAttribute a +attrMetaIds a@(PhiSugar{}) = errorExpectedDesugaredAttribute a objectHasMetavars :: Object -> Bool objectHasMetavars (Formation bindings) = any bindingHasMetavars bindings @@ -352,7 +353,8 @@ attrHasMetavars Rho = False attrHasMetavars (Label _) = False attrHasMetavars (Alpha _) = False attrHasMetavars (MetaAttr _) = True -attrHasMetavars b@AttrSugar{} = error ("impossible: expected desugared attribute, but got: " <> printTree b) +attrHasMetavars a@AttrSugar{} = errorExpectedDesugaredAttribute a +attrHasMetavars a@PhiSugar{} = errorExpectedDesugaredAttribute a -- | Given a condition, and a substition from object matching -- tells whether the condition matches the object @@ -669,13 +671,6 @@ substThis thisObj = go obj@ConstFloat{} -> obj obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj --- {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b ⟧.a ⟧.c ⟧.φ, λ ⤍ Package ⟧} - --- {⟦ λ ⤍ Package, x ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧} - --- >>> "{⟦ λ ⤍ Package, x(t) ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧}" :: Program --- Program [LambdaBinding (Function "Package"),AlphaBinding (AttrSugar (LabelId "x") [LabelId "t"]) (Formation [AlphaBinding (Label (LabelId "b")) (Formation [])])] - substThisBinding :: Object -> Binding -> Binding substThisBinding obj = \case AlphaBinding a obj' -> AlphaBinding a (substThis obj obj') diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs index f57457ae9..91dd74441 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -80,6 +80,7 @@ module Language.EO.Phi.Syntax ( parseWith, errorExpectedDesugaredObject, errorExpectedDesugaredBinding, + errorExpectedDesugaredAttribute, ) where import Data.ByteString (ByteString) @@ -108,11 +109,17 @@ import Text.Printf (printf) -- >>> :set -XOverloadedStrings -- >>> :set -XOverloadedLists +errorExpectedButGot :: (Pretty a, SugarableFinally a) => String -> a -> b +errorExpectedButGot type' x = error ([fmt|impossible: expected desugared {type'}, but got:\n|] <> printTree x) + errorExpectedDesugaredObject :: Object -> a -errorExpectedDesugaredObject x = error ("impossible: expected desugared Object, but got: " <> printTree x) +errorExpectedDesugaredObject = errorExpectedButGot "Object" errorExpectedDesugaredBinding :: Binding -> a -errorExpectedDesugaredBinding x = error ("impossible: expected desugared Binding, but got: " <> printTree x) +errorExpectedDesugaredBinding = errorExpectedButGot "Binding" + +errorExpectedDesugaredAttribute :: Attribute -> a +errorExpectedDesugaredAttribute = errorExpectedButGot "Attribute" class DesugarableInitially a where desugarInitially :: a -> a @@ -149,6 +156,9 @@ instance DesugarableInitially [Binding] where AlphaBinding (AttrSugar l ls) (Formation bindings) -> let bindingsDesugared = desugarInitially bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) + AlphaBinding (PhiSugar ls) (Formation bindings) -> + let bindingsDesugared = desugarInitially bindings + in AlphaBinding Phi (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) AlphaBindingSugar obj -> AlphaBinding (Alpha (AlphaIndex [fmt|α{idx}|])) (desugarInitially obj) binding -> binding @@ -211,6 +221,7 @@ instance SugarableFinally [Binding] where go idx = \case obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj obj@(AlphaBinding (AttrSugar _ _) _) -> errorExpectedDesugaredBinding obj + obj@(AlphaBinding (PhiSugar _) _) -> errorExpectedDesugaredBinding obj AlphaBinding (Alpha (AlphaIndex ('α' : idx'))) _ -> idx == read idx' _ -> False @@ -256,6 +267,9 @@ desugarBinding = \case AlphaBinding (AttrSugar l ls) (Formation bindings) -> let bindingsDesugared = desugarBinding <$> bindings in AlphaBinding (Label l) (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) + AlphaBinding (PhiSugar ls) (Formation bindings) -> + let bindingsDesugared = desugarBinding <$> bindings + in AlphaBinding Phi (Formation ((EmptyBinding . Label <$> ls) <> bindingsDesugared)) AlphaBinding a obj -> AlphaBinding a (desugar obj) obj@(AlphaBindingSugar{}) -> errorExpectedDesugaredBinding obj binding -> binding @@ -634,14 +648,6 @@ bytesToFloat (Bytes bytes) = dashToSpace '-' = ' ' dashToSpace c = c --- >>> "{⟦ org ↦ ⟦ eolang ↦ ⟦ number(as-bytes) ↦ ⟦ φ ↦ ξ.as-bytes, neg ↦ ξ.times(-1), ⟧, λ ⤍ Package ⟧, λ ⤍ Package ⟧ ⟧}" :: Program --- syntax error at line 1, column 76 due to lexer error --- on the input: --- {⟦ org ↦ ⟦ eolang ↦ ⟦ ~number(as-bytes) ↦ ⟦ φ ↦ ξ.as-bytes, neg ↦ ξ.times(-1), ⟧, λ ⤍ Package ⟧, λ ⤍ Package ⟧ ⟧} - --- >>> "-1.0" :: Object --- ConstFloatRaw (DoubleSigned "-1.0") - instance IsString Program where fromString = unsafeParseWith pProgram instance IsString Object where fromString = unsafeParseWith pObject instance IsString Binding where fromString = unsafeParseWith pBinding diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index 004441766..fb120850e 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs @@ -93,6 +93,7 @@ data Binding data Attribute = Phi + | PhiSugar [LabelId] | Rho | Label LabelId | Alpha AlphaIndex diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt index 719cf9d9f..321b1d3ee 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt @@ -143,6 +143,7 @@ All other symbols are terminals. | | **|** | //Binding// | | **|** | //Binding// ``,`` //[Binding]// | //Attribute// | -> | ``φ`` + | | **|** | ``~`` ``φ`` ``(`` //[LabelId]// ``)`` | | **|** | ``ρ`` | | **|** | //LabelId// | | **|** | //AlphaIndex// diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index 1f8726e8d..349549b5f 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y @@ -187,6 +187,7 @@ ListBinding Attribute :: { Language.EO.Phi.Syntax.Abs.Attribute } Attribute : 'φ' { Language.EO.Phi.Syntax.Abs.Phi } + | '~' 'φ' '(' ListLabelId ')' { Language.EO.Phi.Syntax.Abs.PhiSugar $4 } | 'ρ' { Language.EO.Phi.Syntax.Abs.Rho } | LabelId { Language.EO.Phi.Syntax.Abs.Label $1 } | AlphaIndex { Language.EO.Phi.Syntax.Abs.Alpha $1 } diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index a56655863..e614db4cc 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -24,6 +24,7 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} @@ -55,14 +56,16 @@ instance ToLatex Program where "\\Big\\{ " <> toLatex (Formation bindings) <> " \\Big\\}" instance ToLatex Attribute where - toLatex Phi = "@" - toLatex Rho = "^" - toLatex (Alpha (AlphaIndex a)) = LaTeX ("\\alpha_" ++ tail a) - toLatex (Label (LabelId l)) = LaTeX l - toLatex (MetaAttr (LabelMetaId l)) = LaTeX l - toLatex (AttrSugar (LabelId l) ls) = LaTeX [fmt|{l}({ls'})|] + toLatex = \case + Phi -> "@" + Rho -> "^" + (Alpha (AlphaIndex a)) -> LaTeX ("\\alpha_" ++ tail a) + (Label (LabelId l)) -> LaTeX l + (MetaAttr (LabelMetaId l)) -> LaTeX l + (AttrSugar (LabelId l) ls) -> LaTeX [fmt|{l}({mkLabels ls})|] + (PhiSugar ls) -> LaTeX [fmt|@({mkLabels ls})|] where - ls' = intercalate ", " ((\(LabelId l') -> l') <$> ls) + mkLabels ls = intercalate ", " ((\(LabelId l') -> l') <$> ls) instance ToLatex Binding where toLatex (AlphaBinding attr obj) = toLatex attr <> " -> " <> toLatex obj From 17ff682cd020d277c80e83857cf8ff87ff90a969 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 19:01:06 +0300 Subject: [PATCH 65/69] fix(pipeline): disable some too slow tests --- pipeline/config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pipeline/config.yaml b/pipeline/config.yaml index 7aaa03533..514f001db 100644 --- a/pipeline/config.yaml +++ b/pipeline/config.yaml @@ -423,6 +423,7 @@ test-sets: normalized: pipeline/phi-normalized/negative-infinity-tests.phi bindings-path-initial: org.eolang bindings-path-normalized: org.eolang + enable: false - eo: original: eo/eo-runtime/src/test/eo/org/eolang/number-tests.eo yaml: pipeline/eo-yaml/number-tests.yaml @@ -495,6 +496,7 @@ test-sets: normalized: pipeline/phi-normalized/positive-infinity-tests.phi bindings-path-initial: org.eolang bindings-path-normalized: org.eolang + enable: false - eo: original: eo/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo yaml: pipeline/eo-yaml/runtime-tests.yaml From 0e5788bba146e9243cb08691ee3b87eaf528fa83 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 27 Dec 2024 19:28:50 +0300 Subject: [PATCH 66/69] fix(pipeline): disable some failing tests --- pipeline/config.yaml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pipeline/config.yaml b/pipeline/config.yaml index 514f001db..14a17f7cc 100644 --- a/pipeline/config.yaml +++ b/pipeline/config.yaml @@ -46,6 +46,9 @@ test-sets: yaml: pipeline/eo-yaml/bool-tests.yaml filtered: pipeline/eo-filtered/bool-tests.eo exclude: + # broken + - compares-bool-to-string + # not broken - forks-on-false-condition - forks-on-true-condition @@ -67,9 +70,9 @@ test-sets: - size-of-part-is-correct - written-in-several-lines - left-with-even-neg + - takes-part-of-bytes # not broken - # - takes-part-of-bytes - and-neg-bytes-as-number-with-leading-zeroes - and-neg-bytes-as-number-without-leading-zeroes - bitwise-works @@ -194,6 +197,7 @@ test-sets: exclude: # broken - negative-i64-to-i32-and-back + - i64-as-bytes-is-not-equal-to-number-bytes # not broken # - i64-div-less-than-i64-one @@ -537,6 +541,19 @@ test-sets: - slice-escape-sequences-line-break - slice-escape-sequences-unicode - throws-on-slicing-start-below-zero + - bytes-equal-to-string + - no-slice-string + - reads-the-length-with-2-byte-characters + - reads-the-length-with-3-byte-characters + - reads-the-length-with-4-byte-characters + - slice-empty-string + - string-equals-to-bytes + - text-block-tree-lines + - text-block-with-margin + - turns-string-into-bytes + - slice-with-2-byte-characters + - slice-with-3-byte-characters + - slice-with-4-byte-characters # not broken - slice-foreign-literals @@ -727,8 +744,10 @@ test-sets: yaml: pipeline/eo-yaml/while-tests.yaml filtered: pipeline/eo-filtered/while-tests.eo exclude: + # broken + - iterating-tuple-with-while-using-external-iterator + # not broken - # - iterating-tuple-with-while-using-external-iterator - iterating-tuple-with-while-using-internal-iterator - iterating-tuple-with-while-without-body-multiple - iterating-tuple-with-while-without-body-single From 4dc584c5fa30a28773e259bf44a7d18559f34c9e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Dec 2024 16:35:23 +0000 Subject: [PATCH 67/69] chore(ci): Update pipeline/pipeline.lock --- pipeline/pipeline.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index b6f06f929..7f3fefff0 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ EO_HEAD_HASH="27abe8befa33f8b1e64a89ffb90a015f150f4ec7" -PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" +PIPELINE_CONFIG_HASH="14a17f7ccb009770050834eb2f56d12e7052e296" From 83b4acf9d528886961cfce88e58185ea2a9d6e77 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Dec 2024 16:35:24 +0000 Subject: [PATCH 68/69] chore(ci): Update eo-phi-normalizer data files --- eo-phi-normalizer/data/0.50.0/dependencies.md | 3613 ++--------------- .../data/0.50.0/org/eolang/cti.phi | 11 - .../data/0.50.0/org/eolang/fs/dir.phi | 71 - .../data/0.50.0/org/eolang/fs/file.phi | 164 - .../data/0.50.0/org/eolang/fs/path.phi | 273 -- .../data/0.50.0/org/eolang/fs/tmpdir.phi | 39 - .../data/0.50.0/org/eolang/go.phi | 34 - .../0.50.0/org/eolang/io/bytes-as-input.phi | 36 - .../data/0.50.0/org/eolang/io/console.phi | 122 - .../0.50.0/org/eolang/io/input-length.phi | 21 - .../0.50.0/org/eolang/io/malloc-as-output.phi | 30 - .../data/0.50.0/org/eolang/io/stdin.phi | 45 - .../data/0.50.0/org/eolang/io/stdout.phi | 18 - .../data/0.50.0/org/eolang/io/tee-input.phi | 34 - .../data/0.50.0/org/eolang/malloc.phi | 55 - .../data/0.50.0/org/eolang/math/angle.phi | 30 - .../data/0.50.0/org/eolang/math/e.phi | 12 - .../data/0.50.0/org/eolang/math/integral.phi | 66 - .../data/0.50.0/org/eolang/math/numbers.phi | 42 - .../data/0.50.0/org/eolang/math/pi.phi | 12 - .../data/0.50.0/org/eolang/math/random.phi | 53 - .../data/0.50.0/org/eolang/math/real.phi | 49 - .../data/0.50.0/org/eolang/net/socket.phi | 535 --- .../org/eolang/structs/bytes-as-array.phi | 23 - .../org/eolang/structs/hash-code-of.phi | 30 - .../data/0.50.0/org/eolang/structs/list.phi | 194 - .../data/0.50.0/org/eolang/structs/map.phi | 122 - .../org/eolang/structs/range-of-ints.phi | 26 - .../data/0.50.0/org/eolang/structs/range.phi | 23 - .../data/0.50.0/org/eolang/structs/set.phi | 37 - .../data/0.50.0/org/eolang/switch.phi | 18 - .../data/0.50.0/org/eolang/sys/getenv.phi | 19 - .../0.50.0/org/eolang/sys/line-separator.phi | 14 - .../data/0.50.0/org/eolang/sys/os.phi | 23 - .../data/0.50.0/org/eolang/sys/posix.phi | 35 - .../data/0.50.0/org/eolang/sys/win32.phi | 38 - .../data/0.50.0/org/eolang/txt/regex.phi | 56 - .../data/0.50.0/org/eolang/txt/sscanf.phi | 14 - .../data/0.50.0/org/eolang/txt/text.phi | 275 -- 39 files changed, 362 insertions(+), 5950 deletions(-) delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/go.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi delete mode 100644 eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi diff --git a/eo-phi-normalizer/data/0.50.0/dependencies.md b/eo-phi-normalizer/data/0.50.0/dependencies.md index 4a363fb43..d1f82494c 100644 --- a/eo-phi-normalizer/data/0.50.0/dependencies.md +++ b/eo-phi-normalizer/data/0.50.0/dependencies.md @@ -101,22 +101,6 @@ ⟧} ``` -## [org/eolang/cti.phi](./org/eolang/cti.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - cti(delegate, level, message) ↦ ⟦ - φ ↦ ξ.delegate - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - ## [org/eolang/dataized.phi](./org/eolang/dataized.phi) ```console @@ -182,612 +166,6 @@ ⟧} ``` -## [org/eolang/fs/dir.phi](./org/eolang/fs/dir.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - dir(file) ↦ ⟦ - φ ↦ ξ.file, - is-directory ↦ Φ̇.true, - made() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) - ), - mkdir() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_made_mkdir - ⟧ - ⟧, - walk(glob) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_walk - ⟧, - deleted() ↦ ⟦ - walked ↦ ξ.ρ.walk("**").at.ρ, - len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, - φ ↦ ξ.ρ.exists.if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ - ) - ), - ξ.ρ - ), - rec-delete(tup, index) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.index).if( - Φ̇.true, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), - ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) - ) - ) - ) - ⟧ - ⟧, - tmpfile() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), - Φ̇.error( - Φ̇.txt.sprintf( - "Directory %s does not exist, can't create temporary file", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) - ) - ) - ), - touch() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch - ⟧ - ⟧, - open(mode, scope) ↦ ⟦ - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "The file %s is a directory, can't open for I/O operations", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/fs/file.phi](./org/eolang/fs/file.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - file(path) ↦ ⟦ - φ ↦ ξ.path, - is-directory() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_is_directory - ⟧, - exists() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_exists - ⟧, - touched() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) - ), - touch() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_touched_touch - ⟧ - ⟧, - deleted() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ - ), - delete() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_deleted_delete - ⟧ - ⟧, - size() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_size - ⟧, - moved(target) ↦ ⟦ - φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), - move() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_moved_move - ⟧ - ⟧, - as-path() ↦ ⟦ - φ ↦ Φ̇.fs.path(ξ.ρ.path).determined - ⟧, - open(mode, scope) ↦ ⟦ - access ↦ Φ̇.dataized(ξ.mode).as-bytes, - read ↦ ξ.access.eq("r"), - write ↦ ξ.access.eq("w"), - append ↦ ξ.access.eq("a"), - read-write ↦ ξ.access.eq("r+"), - write-read ↦ ξ.access.eq("w+"), - read-append ↦ ξ.access.eq("a+"), - can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, - can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( - ξ.append - ).as-bool, - must-exists ↦ ξ.read.or(ξ.read-write).as-bool, - truncate ↦ ξ.write.or(ξ.write-read).as-bool, - φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( - Φ̇.error( - "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" - ), - ξ.ρ.exists.not.if( - ξ.must-exists.if( - Φ̇.error( - Φ̇.txt.sprintf( - "File must exist for given access mod: '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.access) - ) - ), - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file - ), - ξ.ρ - ) - ) - ), - ξ.truncate.if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch - ), - ξ.process-file - ), - ξ.ρ - ) - ), - Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) - ) - ) - ), - process-file() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_process_file - ⟧, - file-stream() ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( - ξ.auto-named-attr-at-211-18, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ) - ).self, - auto-named-attr-at-211-18() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Can't read from file with provided access mode '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) - ) - ) - ⟧ - ⟧ - ⟧, - read-bytes(size) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( - ξ.auto-named-attr-at-252-18, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block - ) - ) - ).self, - auto-named-attr-at-252-18() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Can't write to file with provided access mode '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) - ) - ) - ⟧ - ⟧ - ⟧, - written-bytes(buffer) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/fs/path.phi](./org/eolang/fs/path.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - path(uri) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) - ).determined, - joined(paths) ↦ ⟦ - joined-path ↦ Φ̇.string( - Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes - ), - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) - ).normalized - ⟧, - separator() ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) - ⟧, - posix(uri) ↦ ⟦ - determined ↦ ξ, - separator ↦ "/", - as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, - as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, - φ ↦ ξ.uri, - is-absolute() ↦ ⟦ - φ ↦ ξ.ρ.uri.length.gt(0).and( - ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) - ) - ⟧, - normalized() ↦ ⟦ - uri-as-bytes ↦ ξ.ρ.uri.as-bytes, - is-absolute ↦ ξ.ρ.is-absolute.as-bool, - has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( - ξ.ρ.separator - ) - ), - path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( - Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( - Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 - ) - ), - normalized ↦ ξ.ρ.uri.length.eq(0).if( - ".", - ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( - ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.posix( - ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) - ).determined, - auto-named-attr-at-102-25(accum, segment) ↦ ⟦ - φ ↦ ξ.segment.eq("..").if( - ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( - ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) - ), - ξ.segment.eq(".").or(ξ.segment.eq("")).if( - ξ.accum, ξ.accum.with(ξ.segment) - ) - ) - ⟧ - ⟧, - resolved(other) ↦ ⟦ - other-as-bytes ↦ ξ.other.as-bytes, - φ ↦ ξ.ρ.ρ.posix( - Φ̇.string( - ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( - ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) - ) - ) - ).normalized - ⟧, - basename() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - slice-start-idx ↦ Φ̇.dataized( - ξ.txt.last-index-of(ξ.ρ.separator).plus(1) - ).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( - ξ.pth, - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - extname() ↦ ⟦ - base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), - slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, - φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( - "", - Φ̇.string( - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - dirname() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( - ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes - ) - ) - ⟧ - ⟧, - win32(uri) ↦ ⟦ - separator ↦ "\\", - φ ↦ ξ.validated( - Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) - ).determined, - validated(uri) ↦ ⟦ - determined ↦ ξ, - separator ↦ ξ.ρ.separator, - as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, - as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, - φ ↦ ξ.uri, - is-drive-relative(uri) ↦ ⟦ - φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool - ⟧, - is-root-relative(uri) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, - φ ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) - ) - ⟧, - separated-correctly(uri) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, - pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), - replaced ↦ Φ̇.dataized( - ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) - ).as-bytes, - φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( - Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) - ) - ⟧, - is-absolute() ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - φ ↦ ξ.uri-as-bytes.size.eq(0).if( - Φ̇.false, - ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( - ξ.uri-as-bytes.size.gt(1).and( - ξ.ρ.is-drive-relative(ξ.uri-as-bytes) - ) - ) - ) - ⟧, - normalized() ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, - is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, - driveless ↦ Φ̇.dataized( - ξ.is-drive-relative.if( - ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes - ) - ).as-bytes, - has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( - ξ.ρ.separator - ) - ), - path ↦ Φ̇.dataized( - Φ̇.txt.text(ξ.ρ.separator).joined( - Φ̇.structs.list( - Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) - ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) - ) - ).as-bytes, - normalized ↦ ξ.driveless.size.eq(0).if( - ".", - ξ.is-drive-relative.if( - ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( - ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) - ), - ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ).concat(ξ.path).concat( - ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.validated( - ξ.normalized.eq("\\\\").if( - ξ.ρ.separator, Φ̇.string(ξ.normalized) - ) - ).determined, - auto-named-attr-at-357-27(accum, segment) ↦ ⟦ - φ ↦ ξ.segment.eq("..").if( - ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( - ξ.accum.head, - ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( - ξ.accum.with(ξ.segment), ξ.accum - ) - ), - ξ.segment.eq(".").or(ξ.segment.eq("")).if( - ξ.accum, ξ.accum.with(ξ.segment) - ) - ) - ⟧ - ⟧, - resolved(other) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, - other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, - other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, - φ ↦ ξ.ρ.ρ.validated( - Φ̇.string( - ξ.other-is-drive-relative.if( - ξ.valid-other, - ξ.other-is-root-relative.if( - ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( - ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other - ), - ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( - ξ.valid-other - ) - ) - ) - ) - ).normalized - ⟧, - basename() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - slice-start-idx ↦ Φ̇.dataized( - ξ.txt.last-index-of(ξ.ρ.separator).plus(1) - ).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( - ξ.pth, - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - extname() ↦ ⟦ - base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), - slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, - φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( - "", - Φ̇.string( - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - dirname() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( - ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes - ) - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/fs/tmpdir.phi](./org/eolang/fs/tmpdir.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - tmpdir() ↦ ⟦ - φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), - os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, - os-tmp-dir-1() ↦ ⟦ - tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, - tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, - temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, - tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, - userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.tmp.eq("").if( - ξ.temp.eq("").if( - ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp - ), - ξ.tmp - ), - ξ.tmpdir.eq("").if( - ξ.tmp.eq("").if( - ξ.temp.eq("").if( - ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp - ), - ξ.tmp - ), - ξ.tmpdir - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/go.phi](./org/eolang/go.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - go() ↦ ⟦ - id ↦ Φ̇.dataized( - Φ̇.malloc.of( - 8, - ⟦ - m ↦ ∅, - φ ↦ ξ.m.put(ξ.m.id) - ⟧ - ) - ).as-bytes, - to(body) ↦ ⟦ - φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), - token() ↦ ⟦ - backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), - jump(value) ↦ ⟦ - id ↦ ξ.ρ.ρ.ρ.id - ⟧, - forward(res) ↦ ⟦ - φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) - ⟧ - ⟧, - auto-named-attr-at-63-9(e) ↦ ⟦ - φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - ## [org/eolang/i16.phi](./org/eolang/i16.phi) ```console @@ -1008,34 +386,20 @@ ⟧} ``` -## [org/eolang/io/bytes-as-input.phi](./org/eolang/io/bytes-as-input.phi) +## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ io() ↦ ⟦ - bytes-as-input(bts) ↦ ⟦ + dead-input() ↦ ⟦ read(size) ↦ ⟦ - φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(data, buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, + φ ↦ ξ.input-block, + input-block() ↦ ⟦ + φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), read(size) ↦ ⟦ - to-read ↦ Φ̇.dataized(ξ.size).as-bytes, - available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, - next ↦ Φ̇.dataized( - Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) - ).as-bytes, - φ ↦ ξ.available.eq(0).if( - ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), - ξ.ρ.ρ.input-block( - ξ.ρ.data.slice( - ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) - ).as-bytes, - ξ.ρ.data.slice(0, ξ.next).as-bytes - ) - ).self + φ ↦ ξ.ρ.ρ.input-block ⟧ ⟧ ⟧ @@ -1049,120 +413,20 @@ ⟧} ``` -## [org/eolang/io/console.phi](./org/eolang/io/console.phi) +## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ io() ↦ ⟦ - console() ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, - posix-console() ↦ ⟦ - platform ↦ ξ, - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized( - Φ̇.sys.posix( - "read", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size - ) - ).output - ).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.sys.posix( - "write", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno - ), - ξ.buffer - ), - ξ.buffer.size - ) - ).code - ), - ξ.ρ.ρ.output-block - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - windows-console() ↦ ⟦ - platform ↦ ξ, - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized( - Φ̇.sys.win32( - "ReadFile", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size - ) - ).output - ).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.sys.win32( - "WriteFile", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle - ), - ξ.buffer - ), - ξ.buffer.size - ) - ).code - ), - ξ.ρ.ρ.output-block - ) - ).self - ⟧ + dead-output() ↦ ⟦ + write(buffer) ↦ ⟦ + φ ↦ ξ.output-block, + output-block() ↦ ⟦ + φ ↦ Φ̇.true, + write(buffer) ↦ ⟦ + φ ↦ ξ.ρ.ρ.output-block ⟧ ⟧ ⟧ @@ -1176,2056 +440,47 @@ ⟧} ``` -## [org/eolang/io/dead-input.phi](./org/eolang/io/dead-input.phi) +## [org/eolang/nan.phi](./org/eolang/nan.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - io() ↦ ⟦ - dead-input() ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block, - input-block() ↦ ⟦ - φ ↦ Φ̇.bytes(⟦ Δ ⤍ -- ⟧), - read(size) ↦ ⟦ - φ ↦ ξ.ρ.ρ.input-block - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/dead-output.phi](./org/eolang/io/dead-output.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - dead-output() ↦ ⟦ - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block, - output-block() ↦ ⟦ - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ ξ.ρ.ρ.output-block - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/input-length.phi](./org/eolang/io/input-length.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - input-length(input) ↦ ⟦ - chunk ↦ 4096, - φ ↦ ξ.rec-read(ξ.input, 0), - rec-read(input, length) ↦ ⟦ - read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, - φ ↦ ξ.read-bytes.size.eq(0).if( - ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/malloc-as-output.phi](./org/eolang/io/malloc-as-output.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - malloc-as-output(allocated) ↦ ⟦ - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block(0).write(ξ.buffer).self, - output-block(offset) ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) - ), - ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/stdin.phi](./org/eolang/io/stdin.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - stdin() ↦ ⟦ - φ ↦ ξ.all-lines, - all-lines() ↦ ⟦ - φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), - separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, - rec-read(line, buffer, first) ↦ ⟦ - φ ↦ ξ.line.length.eq(0).if( - Φ̇.string(ξ.buffer), - ξ.ρ.rec-read( - ξ.ρ.ρ.next-line, - ξ.first.if( - ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) - ), - Φ̇.false - ) - ) - ⟧ - ⟧, - next-line() ↦ ⟦ - first ↦ Φ̇.io.console.read(1).self, - φ ↦ ξ.first.as-bytes.size.eq(0).if( - "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ), - rec-read(input, buffer) ↦ ⟦ - char ↦ ξ.input.as-bytes, - next ↦ ξ.input.read(1).self, - φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( - ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) - ).if( - Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) - ) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/stdout.phi](./org/eolang/io/stdout.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - stdout(text) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true - ) - ) - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/io/tee-input.phi](./org/eolang/io/tee-input.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - tee-input(input, output) ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( - ξ.size - ).self, - input-block(input, output, buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, - written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), - ξ.ρ.ρ.input-block( - ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes - ) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/malloc.phi](./org/eolang/malloc.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - malloc() ↦ ⟦ - empty(scope) ↦ ⟦ - φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) - ⟧, - for(object, scope) ↦ ⟦ - bts ↦ Φ̇.dataized(ξ.object).as-bytes, - φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), - auto-named-attr-at-96-9(m) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) - ) - ) - ⟧ - ⟧, - of(size, scope) ↦ ⟦ - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_φ - ⟧, - allocated(id) ↦ ⟦ - φ ↦ ξ.get, - get ↦ ξ.read(0, ξ.size), - size() ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_size - ⟧, - resized(new-size) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_resized - ⟧, - copy(source, target, length) ↦ ⟦ - φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) - ⟧, - read(offset, length) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_read - ⟧, - write(offset, data) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_write - ⟧, - put(object) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get - ) - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/angle.phi](./org/eolang/math/angle.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - angle(value) ↦ ⟦ - φ ↦ ξ.value, - in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), - in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), - sin() ↦ ⟦ - λ ⤍ Lorg_eolang_math_angle_sin - ⟧, - cos() ↦ ⟦ - λ ⤍ Lorg_eolang_math_angle_cos - ⟧, - tan() ↦ ⟦ - cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, - φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) - ⟧, - ctan() ↦ ⟦ - sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, - φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/e.phi](./org/eolang/math/e.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - e ↦ 2.718281828459045, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/integral.phi](./org/eolang/math/integral.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - integral(fun, a, b, n) ↦ ⟦ - subsection(a, b) ↦ ⟦ - φ ↦ ξ.b.minus(ξ.a).div(6).times( - ξ.ρ.fun(ξ.a).plus( - 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) - ) - ) - ⟧, - φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, - auto-named-attr-at-50-11(sum) ↦ ⟦ - φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), - auto-named-attr-at-53-16(left) ↦ ⟦ - right ↦ ξ.ρ.ρ.b, - step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.while( - ξ.auto-named-attr-at-58-19, - ⟦ - i ↦ ∅, - φ ↦ Φ̇.true - ⟧ - ) - ), - ξ.ρ.sum - ) - ), - auto-named-attr-at-58-19(i) ↦ ⟦ - φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - ξ.ρ.ρ.sum.put( - ξ.ρ.ρ.sum.as-number.plus( - ξ.ρ.ρ.ρ.subsection( - ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) - ) - ) - ) - ), - ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) - ), - Φ̇.true - ) - ), - Φ̇.false - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/numbers.phi](./org/eolang/math/numbers.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - numbers(sequence) ↦ ⟦ - φ ↦ ξ.sequence, - max() ↦ ⟦ - lst ↦ Φ̇.structs.list(ξ.ρ.sequence), - φ ↦ ξ.lst.is-empty.if( - Φ̇.error("Can't get max number from empty sequence"), - ξ.lst.reduced( - Φ̇.negative-infinity, - ⟦ - max ↦ ∅, - item ↦ ∅, - φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) - ⟧ - ) - ) - ⟧, - min() ↦ ⟦ - lst ↦ Φ̇.structs.list(ξ.ρ.sequence), - φ ↦ ξ.lst.is-empty.if( - Φ̇.error("Can't get min number from empty sequence"), - ξ.lst.reduced( - Φ̇.positive-infinity, - ⟦ - min ↦ ∅, - item ↦ ∅, - φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) - ⟧ - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/pi.phi](./org/eolang/math/pi.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - pi ↦ 3.141592653589793, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/random.phi](./org/eolang/math/random.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - random(seed) ↦ ⟦ - fixed ↦ ξ, - φ ↦ ξ.seed.as-number.div( - Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number - ), - next ↦ ξ.ρ.random( - ξ.seed.times(25214903917).plus(11).as-i64.and( - Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) - ).as-i64.as-number - ).fixed, - pseudo() ↦ ⟦ - const-1 ↦ 35, - const-2 ↦ 53, - const-3 ↦ 17, - one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), - φ ↦ ξ.ρ.ρ.random(ξ.time-seed), - time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( - ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes - ).as-i64.plus( - ξ.time-bytes.left(ξ.const-3).and( - ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes - ).as-i64.plus( - ξ.time-bytes.and( - ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes - ).as-i64 - ) - ).as-number, - time-bytes ↦ Φ̇.sys.os.is-windows.if( - Φ̇.sys.win32( - "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) - ).milliseconds, - ⟦ - timeval ↦ Φ̇.sys.posix( - "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) - ).output, - φ ↦ ξ.timeval.tv-sec.times(1000).plus( - ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number - ) - ⟧ - ).as-i64.as-bytes - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/math/real.phi](./org/eolang/math/real.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - real(num) ↦ ⟦ - φ ↦ ξ.num, - exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), - mod(x) ↦ ⟦ - dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), - divisor ↦ Φ̇.number(ξ.x.as-bytes), - φ ↦ ξ.divisor.eq(0).if( - Φ̇.error("Can't calculate mod by zero"), - ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) - ), - abs-mod() ↦ ⟦ - dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, - divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, - φ ↦ ξ.dividend-abs.minus( - ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) - ) - ⟧ - ⟧, - abs() ↦ ⟦ - value ↦ Φ̇.number(ξ.ρ.num.as-bytes), - φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) - ⟧, - pow(x) ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_pow - ⟧, - sqrt() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_sqrt - ⟧, - ln() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_ln - ⟧, - acos() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_acos - ⟧, - asin() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_asin - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/nan.phi](./org/eolang/nan.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - nan() ↦ ⟦ - φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), - floor ↦ ξ, - neg ↦ ξ, - is-nan ↦ Φ̇.true, - is-finite ↦ Φ̇.false, - is-integer ↦ Φ̇.false, - as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), - eq(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - lt(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - lte(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - gt(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - gte(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - times(x) ↦ ⟦ - φ ↦ ξ.ρ - ⟧, - plus(x) ↦ ⟦ - φ ↦ ξ.ρ - ⟧, - minus(x) ↦ ⟦ - φ ↦ ξ.ρ - ⟧, - div(x) ↦ ⟦ - φ ↦ ξ.ρ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - negative-infinity() ↦ ⟦ - φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), - floor ↦ ξ, - neg ↦ Φ̇.positive-infinity, - is-nan ↦ Φ̇.false, - is-finite ↦ Φ̇.false, - is-integer ↦ Φ̇.false, - as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), - eq(x) ↦ ⟦ - φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) - ⟧, - lt(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not - ⟧, - lte(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.not - ⟧, - gt(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - gte(x) ↦ ⟦ - φ ↦ ξ.ρ.eq(ξ.x) - ⟧, - times(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - num ↦ Φ̇.number(ξ.value), - φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( - Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) - ) - ⟧, - plus(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( - Φ̇.nan, ξ.ρ - ) - ⟧, - minus(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) - ⟧, - div(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - num ↦ Φ̇.number(ξ.value), - φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( - Φ̇.nan, - ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( - Φ̇.positive-infinity, ξ.ρ - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/net/socket.phi](./org/eolang/net/socket.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - net() ↦ ⟦ - socket(address, port) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) - ), - htons(port) ↦ ⟦ - bts ↦ ξ.port.as-i16.as-bytes, - φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( - ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) - ).as-i16 - ⟧, - as-input(recv) ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - as-output(send) ↦ ⟦ - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - posix-socket(address, port) ↦ ⟦ - sd ↦ Φ̇.sys.posix( - "socket", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream - ), - Φ̇.sys.posix.ipproto-tcp - ) - ).code, - inet-addr ↦ Φ̇.sys.posix( - "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) - ).code, - inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) - ) - ), - ξ.inet-addr.as-i32 - ), - sockaddr ↦ Φ̇.sys.posix.sockaddr-in( - Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int - ), - scoped-socket(sockfd) ↦ ⟦ - as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), - as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), - send(buffer) ↦ ⟦ - buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, - sent ↦ Φ̇.sys.posix( - "send", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size - ), - 0 - ) - ).code, - φ ↦ ξ.sent.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to send message through the socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code - ) - ) - ), - ξ.sent - ) - ⟧, - recv(size) ↦ ⟦ - received ↦ Φ̇.sys.posix( - "recv", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 - ) - ).called, - φ ↦ ξ.received.code.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to receive data from the socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code - ) - ) - ), - ξ.received.output - ) - ⟧ - ⟧, - strerror() ↦ ⟦ - φ ↦ Φ̇.sys.posix( - "strerror", - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code - ) - ) - ⟧, - closed-socket(sockfd) ↦ ⟦ - closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, - φ ↦ ξ.closed.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't close a posix socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code - ) - ) - ), - Φ̇.true - ) - ⟧, - safe-socket(scope) ↦ ⟦ - φ ↦ ξ.ρ.sd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't create a posix socket, reason: '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) - ) - ), - Φ̇.try( - ξ.scope, - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.ρ.closed-socket(ξ.ρ.sd) - ) - ) - ⟧, - connect(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-274-10), - auto-named-attr-at-274-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - connected ↦ Φ̇.sys.posix( - "connect", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ ξ.connected.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes - ) - ⟧ - ⟧, - listen(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-298-10), - auto-named-attr-at-298-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - bound ↦ Φ̇.sys.posix( - "bind", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - listened ↦ Φ̇.sys.posix( - "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) - ).code, - φ ↦ ξ.bound.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address - ), - ξ.sock.port - ), - ξ.sock.strerror.code - ) - ) - ), - ξ.listened.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-323-22)).as-bytes - ) - ), - auto-named-attr-at-323-22() ↦ ⟦ - φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), - accept(scope) ↦ ⟦ - sock ↦ ξ.ρ.ρ.sock, - client-sockfd ↦ Φ̇.sys.posix( - "accept", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ Φ̇.try( - ξ.client-sockfd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to accept a connection on posix socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized( - ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) - ).as-bytes - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.sock.closed-socket(ξ.client-sockfd) - ) - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - win-socket(address, port) ↦ ⟦ - sd ↦ Φ̇.sys.win32( - "socket", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream - ), - Φ̇.sys.win32.ipproto-tcp - ) - ).code, - inet-addr ↦ Φ̇.sys.win32( - "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) - ).code, - inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code - ) - ) - ), - ξ.inet-addr.as-i32 - ), - sockaddr ↦ Φ̇.sys.win32.sockaddr-in( - Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int - ), - scoped-socket(sockfd) ↦ ⟦ - as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), - as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), - send(buffer) ↦ ⟦ - buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, - sent ↦ Φ̇.sys.win32( - "send", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size - ), - 0 - ) - ).code, - φ ↦ ξ.sent.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to send message through the socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code - ) - ) - ), - ξ.sent - ) - ⟧, - recv(size) ↦ ⟦ - received ↦ Φ̇.sys.win32( - "recv", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 - ) - ).called, - φ ↦ ξ.received.code.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to receive data from the socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code - ) - ) - ), - ξ.received.output - ) - ⟧ - ⟧, - last-error() ↦ ⟦ - φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) - ⟧, - closed-socket(sockfd) ↦ ⟦ - closed ↦ Φ̇.sys.win32( - "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) - ).code, - φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't close a win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code - ) - ) - ), - Φ̇.true - ) - ⟧, - safe-socket(scope) ↦ ⟦ - started-up ↦ Φ̇.sys.win32( - "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) - ).code, - cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, - φ ↦ ξ.started-up.eq(0).not.if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", - Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) - ) - ), - Φ̇.try( - ξ.ρ.sd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't create a win32 socket, WSA error code: %d", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) - ) - ), - Φ̇.try( - ξ.scope, - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.ρ.closed-socket(ξ.ρ.sd) - ) - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( - Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true - ) - ) - ) - ⟧, - connect(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-483-10), - auto-named-attr-at-483-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - connected ↦ Φ̇.sys.win32( - "connect", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ ξ.connected.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes - ) - ⟧ - ⟧, - listen(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-507-10), - auto-named-attr-at-507-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - bound ↦ Φ̇.sys.win32( - "bind", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - listened ↦ Φ̇.sys.win32( - "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) - ).code, - φ ↦ ξ.bound.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address - ), - ξ.sock.port - ), - ξ.sock.last-error.code - ) - ) - ), - ξ.listened.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-532-22)).as-bytes - ) - ), - auto-named-attr-at-532-22() ↦ ⟦ - φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), - accept(scope) ↦ ⟦ - sock ↦ ξ.ρ.ρ.sock, - client-sockfd ↦ Φ̇.sys.win32( - "accept", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ Φ̇.try( - ξ.client-sockfd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to accept a connection on win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized( - ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) - ).as-bytes - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.sock.closed-socket(ξ.client-sockfd) - ) - ⟧ - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/number.phi](./org/eolang/number.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - number(as-bytes) ↦ ⟦ - φ ↦ ξ.as-bytes, - as-number ↦ ξ, - neg ↦ ξ.times(-1), - as-i32 ↦ ξ.as-i64.as-i32, - as-i16 ↦ ξ.as-i32.as-i16, - is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), - as-i64() ↦ ⟦ - λ ⤍ Lorg_eolang_number_as_i64 - ⟧, - eq(x) ↦ ⟦ - x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, - self-as-bytes ↦ ξ.ρ.as-bytes, - pos-zero-as-bytes ↦ 0.as-bytes, - neg-zero-as-bytes ↦ -0.as-bytes, - φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( - Φ̇.false, - ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( - ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) - ).and( - ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( - ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) - ) - ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) - ) - ⟧, - lt(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) - ⟧, - lte(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) - ⟧, - gt(x) ↦ ⟦ - λ ⤍ Lorg_eolang_number_gt - ⟧, - gte(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) - ⟧, - times(x) ↦ ⟦ - λ ⤍ Lorg_eolang_number_times - ⟧, - plus(x) ↦ ⟦ - λ ⤍ Lorg_eolang_number_plus - ⟧, - minus(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) - ⟧, - div(x) ↦ ⟦ - λ ⤍ Lorg_eolang_number_div - ⟧, - floor() ↦ ⟦ - λ ⤍ Lorg_eolang_number_floor - ⟧, - is-integer() ↦ ⟦ - φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) - ⟧, - is-finite() ↦ ⟦ - φ ↦ ξ.ρ.is-nan.not.and( - ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - positive-infinity() ↦ ⟦ - φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), - floor ↦ ξ, - neg ↦ Φ̇.negative-infinity, - is-nan ↦ Φ̇.false, - is-finite ↦ Φ̇.false, - is-integer ↦ Φ̇.false, - as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), - eq(x) ↦ ⟦ - φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) - ⟧, - lt(x) ↦ ⟦ - φ ↦ Φ̇.false - ⟧, - lte(x) ↦ ⟦ - φ ↦ ξ.ρ.eq(ξ.x) - ⟧, - gt(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not - ⟧, - gte(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.not - ⟧, - times(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - num ↦ Φ̇.number(ξ.value), - φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( - Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) - ) - ⟧, - plus(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( - Φ̇.nan, ξ.ρ - ) - ⟧, - minus(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) - ⟧, - div(x) ↦ ⟦ - value ↦ Φ̇.dataized(ξ.x).as-bytes, - num ↦ Φ̇.number(ξ.value), - φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( - Φ̇.nan, - ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( - Φ̇.negative-infinity, ξ.ρ - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/seq.phi](./org/eolang/seq.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - seq(steps) ↦ ⟦ - φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), - max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, - loop(index) ↦ ⟦ - φ ↦ ξ.index.lt(ξ.ρ.max-len).and( - Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) - ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/string.phi](./org/eolang/string.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - string(as-bytes) ↦ ⟦ - φ ↦ ξ.as-bytes, - length() ↦ ⟦ - size ↦ ξ.ρ.as-bytes.size, - pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), - pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), - pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), - pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), - result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), - result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), - result-three ↦ ξ.pattern-two, - result-four ↦ ξ.pattern-three, - φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), - increase-length(index, char-size, len) ↦ ⟦ - φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Expected %d byte character at %d index, but there are not enough bytes for it: %x", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes - ) - ) - ), - ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) - ) - ⟧, - rec-length(index, accum) ↦ ⟦ - byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), - φ ↦ ξ.index.eq(ξ.ρ.size).if( - ξ.accum, - ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( - ξ.ρ.increase-length(ξ.index, 1, ξ.accum), - ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( - ξ.ρ.increase-length(ξ.index, 2, ξ.accum), - ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( - ξ.ρ.increase-length(ξ.index, 3, ξ.accum), - ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( - ξ.ρ.increase-length(ξ.index, 4, ξ.accum), - Φ̇.error( - Φ̇.txt.sprintf( - "Unknown byte format (%x), can't recognize character", - Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) - ) - ) - ) - ) - ) - ) - ) - ⟧ - ⟧, - slice(start, len) ↦ ⟦ - start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, - len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, - num-start ↦ Φ̇.number(ξ.start-bytes), - num-len ↦ Φ̇.number(ξ.len-bytes), - size ↦ ξ.ρ.as-bytes.size, - end ↦ ξ.num-start.plus(ξ.num-len), - pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), - pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), - pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), - pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), - result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), - result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), - result-three ↦ ξ.pattern-two, - result-four ↦ ξ.pattern-three, - bts-start ↦ Φ̇.dataized( - ξ.rec-index( - 0, - 0, - ξ.num-start, - Φ̇.txt.sprintf( - "Start index (%d) is out of string bounds", - Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) - ) - ) - ).as-bytes, - bts-length ↦ ξ.rec-index( - Φ̇.number(ξ.bts-start), - 0, - ξ.num-len, - Φ̇.txt.sprintf( - "Start index + length to slice (%d) is out of string bounds", - Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) - ) - ).minus(ξ.bts-start), - φ ↦ ξ.num-start.lt(0).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) - ) - ), - ξ.num-len.lt(0).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) - ) - ), - ξ.num-len.eq(0).if( - "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) - ) - ) - ), - increase(index, char-size, accum, result, cause) ↦ ⟦ - φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Expected %d byte character at %d index, but there are not enough bytes for it: %x", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes - ) - ) - ), - ξ.ρ.rec-index( - ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause - ) - ) - ⟧, - rec-index(index, accum, result, cause) ↦ ⟦ - byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), - φ ↦ ξ.accum.eq(ξ.result).if( - ξ.index, - ξ.index.eq(ξ.ρ.size).if( - Φ̇.error(ξ.cause), - ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( - ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), - ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( - ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), - ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( - ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), - ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( - ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), - Φ̇.error( - Φ̇.txt.sprintf( - "Unknown byte format (%x), can't recognize character", - Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) - ) - ) - ) - ) - ) - ) - ) - ) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/bytes-as-array.phi](./org/eolang/structs/bytes-as-array.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - bytes-as-array(bts) ↦ ⟦ - bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, - φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), - slice-byte(tup, index) ↦ ⟦ - φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( - ξ.ρ.slice-byte( - ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) - ), - ξ.tup - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/hash-code-of.phi](./org/eolang/structs/hash-code-of.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - hash-code-of(input) ↦ ⟦ - input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, - size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, - magic-number ↦ 31.as-i64, - φ ↦ ξ.rec-hash-code(0, 0), - rec-hash-code(acc, index) ↦ ⟦ - φ ↦ ξ.index.eq(ξ.ρ.size).if( - ξ.acc.as-number, - ξ.ρ.rec-hash-code( - ξ.ρ.magic-number.times(ξ.acc).plus( - Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( - ξ.ρ.input-as-bytes.slice(ξ.index, 1) - ).as-i64 - ), - ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/list.phi](./org/eolang/structs/list.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - list(origin) ↦ ⟦ - φ ↦ ξ.origin, - is-empty() ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.origin.length) - ⟧, - with(x) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) - ⟧, - withi(index, item) ↦ ⟦ - φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( - ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) - ) - ⟧, - reducedi(start, func) ↦ ⟦ - origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), - rec-reduced(accum, index) ↦ ⟦ - idx-as-number ↦ ξ.index.as-number, - next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, - φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( - ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) - ), - accumulated ↦ ξ.ρ.func( - ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number - ) - ⟧ - ⟧, - reduced(start, func) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), - auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.accum, ξ.item) - ⟧ - ⟧, - mappedi(func) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) - ), - auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) - ⟧ - ⟧, - mapped(func) ↦ ⟦ - φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), - auto-named-attr-at-103-30(item, idx) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - eachi(func) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), - auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) - ) - ) - ⟧ - ⟧, - each(func) ↦ ⟦ - φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-123-32), - auto-named-attr-at-123-32(item, index) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - withouti(i) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-130-24) - ), - auto-named-attr-at-130-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - without(element) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-141-20) - ), - auto-named-attr-at-141-20(accum, item) ↦ ⟦ - φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - eq(other) ↦ ⟦ - φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( - ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-156-24) - ), - auto-named-attr-at-156-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) - ⟧ - ⟧, - concat(passed) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( - ξ.ρ, - ⟦ - accum ↦ ∅, - item ↦ ∅, - φ ↦ ξ.accum.with(ξ.item) - ⟧ - ) - ⟧, - index-of(wanted) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-176-24), - auto-named-attr-at-176-24(accum, item, index) ↦ ⟦ - φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) - ⟧ - ⟧, - last-index-of(wanted) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-189-24), - auto-named-attr-at-189-24(accum, item, index) ↦ ⟦ - φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) - ⟧ - ⟧, - contains(element) ↦ ⟦ - φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not - ⟧, - sorted() ↦ ⟦ - φ ↦ ξ.ρ - ⟧, - filteredi(func) ↦ ⟦ - origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), - rec-filtered(idx-as-bytes, accum) ↦ ⟦ - original ↦ ξ.ρ.ρ.origin, - index ↦ ξ.idx-as-bytes.as-number, - item ↦ ξ.ρ.ρ.origin.at(ξ.index), - φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( - ξ.accum, - ξ.ρ.rec-filtered( - 1.plus(ξ.index).as-bytes, - ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) - ) - ) - ⟧ - ⟧, - filtered(func) ↦ ⟦ - φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-238-32), - auto-named-attr-at-238-32(item, index) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - head(index) ↦ ⟦ - idx ↦ Φ̇.dataized(ξ.index).as-bytes, - φ ↦ Φ̇.switch( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), - ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-259-32) - ) - ) - ) - ), - auto-named-attr-at-259-32(accum, item, index) ↦ ⟦ - φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - tail(index) ↦ ⟦ - idx ↦ Φ̇.dataized(ξ.index).as-bytes, - start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, - φ ↦ 0.gt(ξ.start).if( - ξ.ρ, - ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-275-26) - ) - ), - auto-named-attr-at-275-26(accum, item, idx) ↦ ⟦ - φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) - ⟧ - ⟧ + nan() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F8-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ ξ, + is-nan ↦ Φ̇.true, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert NaN to i64"), + eq(x) ↦ ⟦ + φ ↦ Φ̇.false ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/map.phi](./org/eolang/structs/map.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - map(pairs) ↦ ⟦ - φ ↦ ξ.auto-named-attr-at-37-6.initialized, - entry(key, value) ↦ ⟦⟧, - initialized(entries) ↦ ⟦ - initialized ↦ ξ, - size ↦ ξ.entries.length, - keys() ↦ ⟦ - φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( - ⟦ - entry ↦ ∅, - φ ↦ ξ.entry.key - ⟧ - ) - ⟧, - values() ↦ ⟦ - φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( - ⟦ - entry ↦ ∅, - φ ↦ ξ.entry.value - ⟧ - ) - ⟧, - has(key) ↦ ⟦ - φ ↦ ξ.ρ.found(ξ.key).exists - ⟧, - found(key) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), - rec-key-search(found, index) ↦ ⟦ - entry ↦ ξ.ρ.ρ.entries.at(ξ.index), - φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( - ξ.found, - ξ.ρ.rec-key-search( - ξ.ρ.hash.eq(ξ.entry.hash).if( - ξ.auto-named-attr-at-125-54, ξ.found - ), - ξ.index.plus(1) - ) - ), - auto-named-attr-at-125-54() ↦ ⟦ - exists ↦ Φ̇.true, - get ↦ ξ.ρ.entry.value - ⟧ - ⟧, - not-found() ↦ ⟦ - exists ↦ Φ̇.false, - get ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Object by hash code %d from given key does not exists", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) - ) - ) - ⟧ - ⟧, - with(key, value) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.map.initialized( - Φ̇.structs.list(ξ.ρ.entries).filtered( - ξ.auto-named-attr-at-145-50 - ).origin.with(ξ.auto-named-attr-at-146-12) - ), - auto-named-attr-at-145-50(entry) ↦ ⟦ - φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not - ⟧, - auto-named-attr-at-146-12() ↦ ⟦ - key ↦ ξ.ρ.key, - value ↦ ξ.ρ.value, - hash ↦ ξ.ρ.hash - ⟧ - ⟧, - without(key) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.map.initialized( - Φ̇.structs.list(ξ.ρ.entries).filtered( - ξ.auto-named-attr-at-159-48 - ).origin - ), - auto-named-attr-at-159-48(entry) ↦ ⟦ - φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not - ⟧ - ⟧ - ⟧, - auto-named-attr-at-37-6() ↦ ⟦ - pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, - φ ↦ ξ.ρ.initialized( - ξ.pairs-size.eq(0).if( - Φ̇.tuple.empty, - ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) - ) - ), - rec-rebuild(accum, index, hashes) ↦ ⟦ - entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, - φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( - ξ.accum, - ξ.ρ.rec-rebuild( - ξ.hashes.contains(ξ.hash).if( - ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) - ), - ξ.index.plus(1), - ξ.hashes.with(ξ.hash) - ) - ), - auto-named-attr-at-59-18() ↦ ⟦ - key ↦ ξ.ρ.entry.key, - value ↦ ξ.ρ.entry.value, - hash ↦ ξ.ρ.hash - ⟧ - ⟧ - ⟧ + lt(x) ↦ ⟦ + φ ↦ Φ̇.false ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/range-of-ints.phi](./org/eolang/structs/range-of-ints.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - range-of-ints(start, end) ↦ ⟦ - φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( - 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) - ).if( - Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), - Φ̇.error("Some of the arguments are not integers") - ), - auto-named-attr-at-42-8() ↦ ⟦ - build(num) ↦ ⟦ - φ ↦ ξ.num, - next ↦ ξ.ρ.build(1.plus(ξ.φ)) - ⟧, - φ ↦ ξ.build(ξ.ρ.start) - ⟧ + lte(x) ↦ ⟦ + φ ↦ Φ̇.false ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/range.phi](./org/eolang/structs/range.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - range(start, end) ↦ ⟦ - φ ↦ Φ̇.structs.list( - ξ.start.lt(ξ.end).if( - ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty - ) - ), - appended(acc, current) ↦ ⟦ - φ ↦ ξ.current.lt(ξ.ρ.end).if( - ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc - ) - ⟧ + gt(x) ↦ ⟦ + φ ↦ Φ̇.false ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/structs/set.phi](./org/eolang/structs/set.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - set(lst) ↦ ⟦ - φ ↦ ξ.initialized( - Φ̇.structs.map( - Φ̇.structs.list(ξ.lst).mapped( - ⟦ - item ↦ ∅, - φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true) - ⟧ - ).origin - ) - ).initialized, - initialized(map) ↦ ⟦ - initialized ↦ ξ, - φ ↦ ξ.map.keys, - size ↦ ξ.map.size, - with(item) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) - ⟧, - without(item) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) - ⟧, - has(item) ↦ ⟦ - φ ↦ ξ.ρ.map.has(ξ.item) - ⟧ - ⟧ + gte(x) ↦ ⟦ + φ ↦ Φ̇.false ⟧, - λ ⤍ Package + times(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + plus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + minus(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧, + div(x) ↦ ⟦ + φ ↦ ξ.ρ + ⟧ ⟧, λ ⤍ Package ⟧, @@ -3234,19 +489,62 @@ ⟧} ``` -## [org/eolang/switch.phi](./org/eolang/switch.phi) +## [org/eolang/negative-infinity.phi](./org/eolang/negative-infinity.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - switch(cases) ↦ ⟦ - len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, - φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), - case-at(index) ↦ ⟦ - case ↦ ξ.ρ.cases.at(ξ.index), - φ ↦ ξ.index.eq(ξ.ρ.len).if( - Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) + negative-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ FF-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.positive-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert negative infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + gt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + gte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.positive-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.positive-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.positive-infinity, ξ.ρ + ) ) ⟧ ⟧, @@ -3257,22 +555,77 @@ ⟧} ``` -## [org/eolang/sys/getenv.phi](./org/eolang/sys/getenv.phi) +## [org/eolang/number.phi](./org/eolang/number.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - sys() ↦ ⟦ - getenv(name) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - Φ̇.sys.win32( - "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) - ), - Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) - ).output + number(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + as-number ↦ ξ, + neg ↦ ξ.times(-1), + as-i32 ↦ ξ.as-i64.as-i32, + as-i16 ↦ ξ.as-i32.as-i16, + is-nan ↦ ξ.as-bytes.eq(Φ̇.nan.as-bytes), + as-i64() ↦ ⟦ + λ ⤍ Lorg_eolang_number_as_i64 ⟧, - λ ⤍ Package + eq(x) ↦ ⟦ + x-as-bytes ↦ Φ̇.dataized(ξ.x).as-bytes, + self-as-bytes ↦ ξ.ρ.as-bytes, + pos-zero-as-bytes ↦ 0.as-bytes, + neg-zero-as-bytes ↦ -0.as-bytes, + φ ↦ ξ.ρ.is-nan.or(Φ̇.number(ξ.x-as-bytes).is-nan).if( + Φ̇.false, + ξ.x-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.x-as-bytes.eq(ξ.neg-zero-as-bytes) + ).and( + ξ.self-as-bytes.eq(ξ.pos-zero-as-bytes).or( + ξ.self-as-bytes.eq(ξ.neg-zero-as-bytes) + ) + ).or(ξ.self-as-bytes.eq(ξ.x-as-bytes)) + ) + ⟧, + lt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ 0.gt(ξ.ρ.minus(Φ̇.number(ξ.value))) + ⟧, + lte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.lt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + gt(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_gt + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.gt(ξ.value).or(ξ.ρ.eq(ξ.value)) + ⟧, + times(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_times + ⟧, + plus(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_plus + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ ξ.ρ.plus(Φ̇.number(ξ.value).neg) + ⟧, + div(x) ↦ ⟦ + λ ⤍ Lorg_eolang_number_div + ⟧, + floor() ↦ ⟦ + λ ⤍ Lorg_eolang_number_floor + ⟧, + is-integer() ↦ ⟦ + φ ↦ ξ.ρ.is-finite.and(ξ.ρ.eq(ξ.ρ.floor)) + ⟧, + is-finite() ↦ ⟦ + φ ↦ ξ.ρ.is-nan.not.and( + ξ.ρ.eq(Φ̇.positive-infinity).or(ξ.ρ.eq(Φ̇.negative-infinity)).not + ) + ⟧ ⟧, λ ⤍ Package ⟧, @@ -3281,17 +634,64 @@ ⟧} ``` -## [org/eolang/sys/line-separator.phi](./org/eolang/sys/line-separator.phi) +## [org/eolang/positive-infinity.phi](./org/eolang/positive-infinity.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - sys() ↦ ⟦ - line-separator() ↦ ⟦ - φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) + positive-infinity() ↦ ⟦ + φ ↦ Φ̇.number(Φ̇.bytes(⟦ Δ ⤍ 7F-F0-00-00-00-00-00-00 ⟧)), + floor ↦ ξ, + neg ↦ Φ̇.negative-infinity, + is-nan ↦ Φ̇.false, + is-finite ↦ Φ̇.false, + is-integer ↦ Φ̇.false, + as-i64 ↦ Φ̇.error("Can't convert positive infinity to i64"), + eq(x) ↦ ⟦ + φ ↦ ξ.ρ.as-bytes.eq(ξ.x.as-bytes) ⟧, - λ ⤍ Package + lt(x) ↦ ⟦ + φ ↦ Φ̇.false + ⟧, + lte(x) ↦ ⟦ + φ ↦ ξ.ρ.eq(ξ.x) + ⟧, + gt(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.ρ.eq(ξ.value)).not + ⟧, + gte(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.not + ⟧, + times(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.eq(0)).if( + Φ̇.nan, ξ.num.gt(0).if(ξ.ρ, Φ̇.negative-infinity) + ) + ⟧, + plus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(Φ̇.negative-infinity)).if( + Φ̇.nan, ξ.ρ + ) + ⟧, + minus(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + φ ↦ Φ̇.number(ξ.value).is-nan.or(ξ.value.eq(ξ.ρ)).if(Φ̇.nan, ξ.ρ) + ⟧, + div(x) ↦ ⟦ + value ↦ Φ̇.dataized(ξ.x).as-bytes, + num ↦ Φ̇.number(ξ.value), + φ ↦ ξ.num.is-nan.or(ξ.num.is-finite.not).if( + Φ̇.nan, + ξ.value.eq(-0.as-bytes).or(0.gt(ξ.value)).if( + Φ̇.negative-infinity, ξ.ρ + ) + ) + ⟧ ⟧, λ ⤍ Package ⟧, @@ -3300,26 +700,20 @@ ⟧} ``` -## [org/eolang/sys/os.phi](./org/eolang/sys/os.phi) +## [org/eolang/seq.phi](./org/eolang/seq.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - sys() ↦ ⟦ - os() ↦ ⟦ - φ ↦ ξ.name, - is-windows() ↦ ⟦ - os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, - φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) - ⟧, - is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, - is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, - name() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_os_name - ⟧ - ⟧, - λ ⤍ Package + seq(steps) ↦ ⟦ + φ ↦ ξ.steps.length.eq(0).if(Φ̇.true, ξ.loop(0)), + max-len ↦ Φ̇.dataized(ξ.steps.length.minus(1)).as-bytes, + loop(index) ↦ ⟦ + φ ↦ ξ.index.lt(ξ.ρ.max-len).and( + Φ̇.dataized(ξ.ρ.steps.at(ξ.index)).as-bool.or(Φ̇.true) + ).if(ξ.ρ.loop(ξ.index.plus(1)), ξ.ρ.steps.at(ξ.index)) + ⟧ ⟧, λ ⤍ Package ⟧, @@ -3328,81 +722,158 @@ ⟧} ``` -## [org/eolang/sys/posix.phi](./org/eolang/sys/posix.phi) +## [org/eolang/string.phi](./org/eolang/string.phi) ```console {⟦ org() ↦ ⟦ eolang() ↦ ⟦ - sys() ↦ ⟦ - posix(name, args) ↦ ⟦ - stdin-fileno ↦ 0, - stdout-fileno ↦ 1, - af-inet ↦ 2, - sock-stream ↦ 1, - ipproto-tcp ↦ 6, - inaddr-none ↦ -1, - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_posix_φ - ⟧, - return(code, output) ↦ ⟦ - called ↦ ξ, - φ ↦ ξ.output - ⟧, - timeval(tv-sec, tv-usec) ↦ ⟦ - self ↦ ξ + string(as-bytes) ↦ ⟦ + φ ↦ ξ.as-bytes, + length() ↦ ⟦ + size ↦ ξ.ρ.as-bytes.size, + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + φ ↦ ξ.size.eq(0).if(0, ξ.rec-length(0, 0)), + increase-length(index, char-size, len) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-length(ξ.index.plus(ξ.char-size), ξ.len.plus(1)) + ) ⟧, - sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ - sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), - size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( - ξ.sin-zero.size + rec-length(index, accum) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.index.eq(ξ.ρ.size).if( + ξ.accum, + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase-length(ξ.index, 1, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase-length(ξ.index, 2, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase-length(ξ.index, 3, ξ.accum), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase-length(ξ.index, 4, ξ.accum), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) ) ⟧ ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/sys/win32.phi](./org/eolang/sys/win32.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - win32(name, args) ↦ ⟦ - std-input-handle ↦ -10, - std-output-handle ↦ -11, - af-inet ↦ 2, - sock-stream ↦ 1, - ipproto-tcp ↦ 6, - invalid-socket ↦ -1, - socket-error ↦ -1, - inaddr-none ↦ -1, - winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_win32_φ - ⟧, - return(code, output) ↦ ⟦ - called ↦ ξ, - φ ↦ ξ.output - ⟧, - system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ - self ↦ ξ + slice(start, len) ↦ ⟦ + start-bytes ↦ Φ̇.dataized(ξ.start).as-bytes, + len-bytes ↦ Φ̇.dataized(ξ.len).as-bytes, + num-start ↦ Φ̇.number(ξ.start-bytes), + num-len ↦ Φ̇.number(ξ.len-bytes), + size ↦ ξ.ρ.as-bytes.size, + end ↦ ξ.num-start.plus(ξ.num-len), + pattern-one ↦ Φ̇.bytes(⟦ Δ ⤍ 80- ⟧), + pattern-two ↦ Φ̇.bytes(⟦ Δ ⤍ E0- ⟧), + pattern-three ↦ Φ̇.bytes(⟦ Δ ⤍ F0- ⟧), + pattern-four ↦ Φ̇.bytes(⟦ Δ ⤍ F8- ⟧), + result-one ↦ Φ̇.bytes(⟦ Δ ⤍ 00- ⟧), + result-two ↦ Φ̇.bytes(⟦ Δ ⤍ C0- ⟧), + result-three ↦ ξ.pattern-two, + result-four ↦ ξ.pattern-three, + bts-start ↦ Φ̇.dataized( + ξ.rec-index( + 0, + 0, + ξ.num-start, + Φ̇.txt.sprintf( + "Start index (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ) + ).as-bytes, + bts-length ↦ ξ.rec-index( + Φ̇.number(ξ.bts-start), + 0, + ξ.num-len, + Φ̇.txt.sprintf( + "Start index + length to slice (%d) is out of string bounds", + Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start.plus(ξ.num-len)) + ) + ).minus(ξ.bts-start), + φ ↦ ξ.num-start.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Start index must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-start) + ) + ), + ξ.num-len.lt(0).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Length to slice must be >= 0, but was %d", Φ̇.tuple(Φ̇.tuple.empty, ξ.num-len) + ) + ), + ξ.num-len.eq(0).if( + "", Φ̇.string(ξ.ρ.as-bytes.slice(ξ.bts-start, ξ.bts-length)) + ) + ) + ), + increase(index, char-size, accum, result, cause) ↦ ⟦ + φ ↦ ξ.index.plus(ξ.char-size).gt(ξ.ρ.size).if( + Φ̇.error( + Φ̇.txt.sprintf( + "Expected %d byte character at %d index, but there are not enough bytes for it: %x", + Φ̇.tuple( + Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + ) + ) + ), + ξ.ρ.rec-index( + ξ.index.plus(ξ.char-size), ξ.accum.plus(1), ξ.result, ξ.cause + ) + ) ⟧, - sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ - sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), - size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( - ξ.sin-zero.size + rec-index(index, accum, result, cause) ↦ ⟦ + byte ↦ ξ.ρ.ρ.as-bytes.slice(ξ.index, 1), + φ ↦ ξ.accum.eq(ξ.result).if( + ξ.index, + ξ.index.eq(ξ.ρ.size).if( + Φ̇.error(ξ.cause), + ξ.byte.and(ξ.ρ.pattern-one).eq(ξ.ρ.result-one).if( + ξ.ρ.increase(ξ.index, 1, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-two).eq(ξ.ρ.result-two).if( + ξ.ρ.increase(ξ.index, 2, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-three).eq(ξ.ρ.result-three).if( + ξ.ρ.increase(ξ.index, 3, ξ.accum, ξ.result, ξ.cause), + ξ.byte.and(ξ.ρ.pattern-four).eq(ξ.ρ.result-four).if( + ξ.ρ.increase(ξ.index, 4, ξ.accum, ξ.result, ξ.cause), + Φ̇.error( + Φ̇.txt.sprintf( + "Unknown byte format (%x), can't recognize character", + Φ̇.tuple(Φ̇.tuple.empty, ξ.byte) + ) + ) + ) + ) + ) + ) + ) ) ⟧ - ⟧, - λ ⤍ Package + ⟧ ⟧, λ ⤍ Package ⟧, @@ -3497,67 +968,6 @@ ⟧} ``` -## [org/eolang/txt/regex.phi](./org/eolang/txt/regex.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - regex(expression) ↦ ⟦ - φ ↦ ξ.compiled, - compiled() ↦ ⟦ - λ ⤍ Lorg_eolang_txt_regex_compiled - ⟧, - pattern(serialized) ↦ ⟦ - matches(txt) ↦ ⟦ - φ ↦ ξ.ρ.match(ξ.txt).next.exists - ⟧, - match(txt) ↦ ⟦ - next ↦ ξ.matched-from-index(1, 0).matched, - matched-from-index(position, start) ↦ ⟦ - λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index - ⟧, - matched(position, start, from, to, groups) ↦ ⟦ - matched ↦ ξ, - groups-count ↦ ξ.groups.length, - exists ↦ ξ.start.gte(0), - next ↦ ξ.exists.if( - ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, - Φ̇.error("Matched block does not exist, can't get next") - ), - text ↦ ξ.exists.if( - ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") - ), - group(index) ↦ ⟦ - φ ↦ ξ.ρ.groups.at(ξ.index) - ⟧ - ⟧, - not-matched(position) ↦ ⟦ - φ ↦ ξ.ρ.matched( - ξ.position, - -1, - Φ̇.error( - "Matched block does not exist, can't get 'from' position" - ), - Φ̇.error( - "Matched block does not exist, can't get 'to' position" - ), - Φ̇.error("Matched block does not exist, can't get groups") - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - ## [org/eolang/txt/sprintf.phi](./org/eolang/txt/sprintf.phi) ```console @@ -3577,305 +987,6 @@ ⟧} ``` -## [org/eolang/txt/sscanf.phi](./org/eolang/txt/sscanf.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - sscanf(format, read) ↦ ⟦ - λ ⤍ Lorg_eolang_txt_sscanf - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - -## [org/eolang/txt/text.phi](./org/eolang/txt/text.phi) - -```console -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - text(origin) ↦ ⟦ - φ ↦ ξ.origin, - is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), - is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), - is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), - slice(start, len) ↦ ⟦ - φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) - ⟧, - trimmed-left() ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, - φ ↦ 0.eq(ξ.len).if( - ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) - ), - first-non-space-index(index) ↦ ⟦ - char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, - φ ↦ ξ.ρ.len.eq(ξ.index).if( - ξ.index, - " ".eq(ξ.char).if( - ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index - ) - ) - ⟧ - ⟧, - trimmed-right() ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ 0.eq(ξ.len).if( - ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) - ), - first-non-space-index(index) ↦ ⟦ - char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, - φ ↦ -1.eq(ξ.index).if( - 0, - " ".eq(ξ.char).if( - ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - trimmed() ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) - ⟧, - joined(items) ↦ ⟦ - delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, - first ↦ ξ.items.at(0), - len ↦ Φ̇.dataized(ξ.items.length).as-bytes, - not-empty ↦ Φ̇.dataized( - 1.eq(ξ.len).if( - ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), - with-delimiter(acc, index) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.index).if( - ξ.acc, - ξ.ρ.with-delimiter( - ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - repeated(times) ↦ ⟦ - bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, - amount ↦ Φ̇.dataized(ξ.times).as-bytes, - φ ↦ 0.gt(ξ.amount).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) - ) - ), - ξ.ρ.ρ.text( - 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) - ) - ), - rec-repeated(accum, index) ↦ ⟦ - φ ↦ ξ.ρ.amount.eq(ξ.index).if( - ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) - ) - ⟧ - ⟧, - contains(substring) ↦ ⟦ - φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not - ⟧, - ends-with(substring) ↦ ⟦ - substr ↦ Φ̇.dataized(ξ.substring).as-bytes, - φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) - ⟧, - starts-with(substring) ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) - ⟧, - index-of(substring) ↦ ⟦ - self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, - substr ↦ Φ̇.string(ξ.substr-as-bytes), - sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, - end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, - φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( - ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) - ).if(-1, ξ.rec-index-of-substr(0)), - rec-index-of-substr(idx) ↦ ⟦ - φ ↦ ξ.ρ.end.eq(ξ.idx).if( - ξ.contains.if(ξ.idx, -1), - ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) - ), - contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) - ⟧, - substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes - ⟧, - last-index-of(substring) ↦ ⟦ - self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, - substr ↦ Φ̇.string(ξ.substr-as-bytes), - sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, - φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( - ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) - ).if( - -1, - ξ.rec-index-of-substr( - Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) - ) - ), - rec-index-of-substr(idx) ↦ ⟦ - φ ↦ 0.eq(ξ.idx).if( - ξ.contains.if(ξ.idx, -1), - ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) - ), - contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) - ⟧, - substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes - ⟧, - up-cased() ↦ ⟦ - ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, - ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, - distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), - φ ↦ ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( - Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 - ) - ) - ), - ascii(char) ↦ ⟦ - φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number - ⟧, - auto-named-attr-at-258-22(accum, byte) ↦ ⟦ - ascii-bte ↦ ξ.ρ.ascii(ξ.byte), - φ ↦ ξ.accum.concat( - ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( - ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte - ) - ) - ⟧ - ⟧, - low-cased() ↦ ⟦ - ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), - ascii-a ↦ ξ.ρ.up-cased.ascii("A"), - φ ↦ ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( - Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 - ) - ) - ), - auto-named-attr-at-291-22(accum, byte) ↦ ⟦ - ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), - φ ↦ ξ.accum.concat( - ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( - ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( - 7, 1 - ), - ξ.byte - ) - ) - ⟧ - ⟧, - at(i) ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, - idx ↦ Φ̇.dataized(ξ.i).as-bytes, - index ↦ Φ̇.dataized( - 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) - ).as-bytes, - φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) - ) - ), - ξ.ρ.slice(ξ.index, 1) - ) - ⟧, - replaced(target, replacement) ↦ ⟦ - self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, - reinit ↦ Φ̇.string(ξ.self-as-bytes), - matched ↦ ξ.target.match(ξ.reinit).next, - φ ↦ ξ.matched.exists.not.if( - Φ̇.txt.text(ξ.reinit), - Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) - ), - rec-replaced(block, accum, start) ↦ ⟦ - φ ↦ ξ.block.exists.if( - ξ.ρ.rec-replaced( - ξ.block.next, - ξ.accum.concat( - ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) - ).concat(ξ.ρ.replacement), - ξ.block.to - ), - Φ̇.string( - ξ.accum.concat( - ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) - ) - ) - ) - ⟧ - ⟧, - as-number() ↦ ⟦ - scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), - φ ↦ ξ.scanned.length.eq(0).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) - ) - ), - ξ.scanned.tail - ) - ⟧, - split(delimiter) ↦ ⟦ - delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, - self-as-bytes ↦ ξ.ρ.origin.as-bytes, - len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, - φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), - rec-split(accum, start, current) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.current).if( - ξ.with-substr, - ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( - ξ.ρ.rec-split( - ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) - ), - ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) - ) - ), - with-substr ↦ ξ.accum.with( - Φ̇.string( - ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) - ) - ) - ⟧ - ⟧, - chained(others) ↦ ⟦ - φ ↦ 0.eq(ξ.others.length).if( - ξ.ρ, - ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(ξ.others).reduced( - ξ.ρ.origin.as-bytes, - ⟦ - accum ↦ ∅, - str ↦ ∅, - φ ↦ ξ.accum.concat(ξ.str.as-bytes) - ⟧ - ) - ) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} -``` - ## [org/eolang/while.phi](./org/eolang/while.phi) ```console diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi deleted file mode 100644 index f5f437e2b..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/cti.phi +++ /dev/null @@ -1,11 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - cti(delegate, level, message) ↦ ⟦ - φ ↦ ξ.delegate - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi deleted file mode 100644 index b361844f5..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/dir.phi +++ /dev/null @@ -1,71 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - dir(file) ↦ ⟦ - φ ↦ ξ.file, - is-directory ↦ Φ̇.true, - made() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.mkdir), ξ.ρ)) - ), - mkdir() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_made_mkdir - ⟧ - ⟧, - walk(glob) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_walk - ⟧, - deleted() ↦ ⟦ - walked ↦ ξ.ρ.walk("**").at.ρ, - len ↦ Φ̇.dataized(ξ.walked.length).as-bytes, - φ ↦ ξ.ρ.exists.if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.rec-delete(ξ.walked, 0)), ξ.ρ - ) - ), - ξ.ρ - ), - rec-delete(tup, index) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.index).if( - Φ̇.true, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.tup.tail.deleted.exists), - ξ.ρ.rec-delete(ξ.tup.head, ξ.index.plus(1)) - ) - ) - ) - ⟧ - ⟧, - tmpfile() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - Φ̇.fs.file(Φ̇.string(ξ.touch.as-bytes)), - Φ̇.error( - Φ̇.txt.sprintf( - "Directory %s does not exist, can't create temporary file", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) - ) - ) - ), - touch() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_dir_tmpfile_touch - ⟧ - ⟧, - open(mode, scope) ↦ ⟦ - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "The file %s is a directory, can't open for I/O operations", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.path) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi deleted file mode 100644 index 790880f87..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/file.phi +++ /dev/null @@ -1,164 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - file(path) ↦ ⟦ - φ ↦ ξ.path, - is-directory() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_is_directory - ⟧, - exists() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_exists - ⟧, - touched() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - ξ.ρ, Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.touch), ξ.ρ)) - ), - touch() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_touched_touch - ⟧ - ⟧, - deleted() ↦ ⟦ - φ ↦ ξ.ρ.exists.if( - Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.delete), ξ.ρ)), ξ.ρ - ), - delete() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_deleted_delete - ⟧ - ⟧, - size() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_size - ⟧, - moved(target) ↦ ⟦ - φ ↦ Φ̇.fs.file(Φ̇.string(ξ.move.as-bytes)), - move() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_moved_move - ⟧ - ⟧, - as-path() ↦ ⟦ - φ ↦ Φ̇.fs.path(ξ.ρ.path).determined - ⟧, - open(mode, scope) ↦ ⟦ - access ↦ Φ̇.dataized(ξ.mode).as-bytes, - read ↦ ξ.access.eq("r"), - write ↦ ξ.access.eq("w"), - append ↦ ξ.access.eq("a"), - read-write ↦ ξ.access.eq("r+"), - write-read ↦ ξ.access.eq("w+"), - read-append ↦ ξ.access.eq("a+"), - can-read ↦ ξ.read.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).as-bool, - can-write ↦ ξ.write.or(ξ.read-write).or(ξ.write-read.or(ξ.read-append)).or( - ξ.append - ).as-bool, - must-exists ↦ ξ.read.or(ξ.read-write).as-bool, - truncate ↦ ξ.write.or(ξ.write-read).as-bool, - φ ↦ ξ.can-read.not.and(ξ.can-write.not).if( - Φ̇.error( - "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" - ), - ξ.ρ.exists.not.if( - ξ.must-exists.if( - Φ̇.error( - Φ̇.txt.sprintf( - "File must exist for given access mod: '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.access) - ) - ), - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.touched.touch), ξ.process-file - ), - ξ.ρ - ) - ) - ), - ξ.truncate.if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.deleted.delete), ξ.ρ.touched.touch - ), - ξ.process-file - ), - ξ.ρ - ) - ), - Φ̇.seq(Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.process-file), ξ.ρ)) - ) - ) - ), - process-file() ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_process_file - ⟧, - file-stream() ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized(ξ.ρ.ρ.read-bytes(ξ.size)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.ρ.can-read.not.if( - ξ.auto-named-attr-at-211-18, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ) - ).self, - auto-named-attr-at-211-18() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Can't read from file with provided access mode '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) - ) - ) - ⟧ - ⟧ - ⟧, - read-bytes(size) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_file_stream_read_read_bytes - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.ρ.can-write.not.if( - ξ.auto-named-attr-at-252-18, - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.written-bytes(ξ.buffer)), ξ.ρ.ρ.output-block - ) - ) - ).self, - auto-named-attr-at-252-18() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Can't write to file with provided access mode '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.ρ.ρ.access) - ) - ) - ⟧ - ⟧ - ⟧, - written-bytes(buffer) ↦ ⟦ - λ ⤍ Lorg_eolang_fs_file_open_file_stream_write_written_bytes - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi deleted file mode 100644 index ed033be99..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/path.phi +++ /dev/null @@ -1,273 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - path(uri) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.win32(Φ̇.string(ξ.uri.as-bytes)), ξ.posix(Φ̇.string(ξ.uri.as-bytes)) - ).determined, - joined(paths) ↦ ⟦ - joined-path ↦ Φ̇.string( - Φ̇.txt.text(ξ.ρ.separator).joined(ξ.paths).as-bytes - ), - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.ρ.win32(ξ.joined-path), ξ.ρ.posix(ξ.joined-path) - ).normalized - ⟧, - separator() ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if(ξ.ρ.win32.separator, ξ.ρ.posix.separator) - ⟧, - posix(uri) ↦ ⟦ - determined ↦ ξ, - separator ↦ "/", - as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, - as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, - φ ↦ ξ.uri, - is-absolute() ↦ ⟦ - φ ↦ ξ.ρ.uri.length.gt(0).and( - ξ.ρ.uri.as-bytes.slice(0, 1).eq(ξ.ρ.separator) - ) - ⟧, - normalized() ↦ ⟦ - uri-as-bytes ↦ ξ.ρ.uri.as-bytes, - is-absolute ↦ ξ.ρ.is-absolute.as-bool, - has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( - ξ.ρ.separator - ) - ), - path ↦ Φ̇.txt.text(ξ.ρ.separator).joined( - Φ̇.structs.list(Φ̇.txt.text(ξ.ρ.uri).split(ξ.ρ.separator)).reduced( - Φ̇.tuple.empty, ξ.auto-named-attr-at-102-25 - ) - ), - normalized ↦ ξ.ρ.uri.length.eq(0).if( - ".", - ξ.is-absolute.if(ξ.ρ.separator.concat(ξ.path), ξ.path).concat( - ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.posix( - ξ.normalized.eq("//").if("/", Φ̇.string(ξ.normalized)) - ).determined, - auto-named-attr-at-102-25(accum, segment) ↦ ⟦ - φ ↦ ξ.segment.eq("..").if( - ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( - ξ.accum.head, ξ.ρ.is-absolute.not.if(ξ.accum.with(ξ.segment), ξ.accum) - ), - ξ.segment.eq(".").or(ξ.segment.eq("")).if( - ξ.accum, ξ.accum.with(ξ.segment) - ) - ) - ⟧ - ⟧, - resolved(other) ↦ ⟦ - other-as-bytes ↦ ξ.other.as-bytes, - φ ↦ ξ.ρ.ρ.posix( - Φ̇.string( - ξ.other-as-bytes.slice(0, 1).eq(ξ.ρ.separator).if( - ξ.other-as-bytes, ξ.ρ.uri.concat(ξ.ρ.separator).concat(ξ.other-as-bytes) - ) - ) - ).normalized - ⟧, - basename() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - slice-start-idx ↦ Φ̇.dataized( - ξ.txt.last-index-of(ξ.ρ.separator).plus(1) - ).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( - ξ.pth, - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - extname() ↦ ⟦ - base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), - slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, - φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( - "", - Φ̇.string( - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - dirname() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( - ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes - ) - ) - ⟧ - ⟧, - win32(uri) ↦ ⟦ - separator ↦ "\\", - φ ↦ ξ.validated( - Φ̇.string(ξ.validated.separated-correctly(ξ.uri).as-bytes) - ).determined, - validated(uri) ↦ ⟦ - determined ↦ ξ, - separator ↦ ξ.ρ.separator, - as-file ↦ Φ̇.fs.file(ξ.uri).size.ρ, - as-dir ↦ Φ̇.fs.dir(Φ̇.fs.file(ξ.uri)).made.ρ, - φ ↦ ξ.uri, - is-drive-relative(uri) ↦ ⟦ - φ ↦ Φ̇.txt.regex("/^[a-zA-Z]:/").matches(ξ.uri).as-bool - ⟧, - is-root-relative(uri) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, - φ ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(0, 1).eq(ξ.ρ.separator) - ) - ⟧, - separated-correctly(uri) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.uri).as-bytes, - pth ↦ Φ̇.txt.text(Φ̇.string(ξ.uri-as-bytes)), - replaced ↦ Φ̇.dataized( - ξ.pth.replaced(Φ̇.txt.regex("/\\//"), ξ.ρ.separator) - ).as-bytes, - φ ↦ ξ.pth.index-of(ξ.ρ.ρ.ρ.ρ.path.posix.separator).eq(-1).if( - Φ̇.string(ξ.uri-as-bytes), Φ̇.string(ξ.replaced) - ) - ⟧, - is-absolute() ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - φ ↦ ξ.uri-as-bytes.size.eq(0).if( - Φ̇.false, - ξ.ρ.is-root-relative(ξ.uri-as-bytes).or( - ξ.uri-as-bytes.size.gt(1).and( - ξ.ρ.is-drive-relative(ξ.uri-as-bytes) - ) - ) - ) - ⟧, - normalized() ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.uri-as-bytes).as-bool, - is-root-relative ↦ ξ.ρ.is-root-relative(ξ.uri-as-bytes).as-bool, - driveless ↦ Φ̇.dataized( - ξ.is-drive-relative.if( - ξ.uri-as-bytes.slice(2, ξ.uri-as-bytes.size.plus(-2)), ξ.uri-as-bytes - ) - ).as-bytes, - has-trailing-slash ↦ ξ.uri-as-bytes.size.gt(0).and( - ξ.uri-as-bytes.slice(ξ.uri-as-bytes.size.plus(-1), 1).eq( - ξ.ρ.separator - ) - ), - path ↦ Φ̇.dataized( - Φ̇.txt.text(ξ.ρ.separator).joined( - Φ̇.structs.list( - Φ̇.txt.text(ξ.driveless).split(ξ.ρ.separator) - ).reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-357-27) - ) - ).as-bytes, - normalized ↦ ξ.driveless.size.eq(0).if( - ".", - ξ.is-drive-relative.if( - ξ.driveless.slice(0, 1).eq(ξ.ρ.separator).if( - ξ.ρ.uri.slice(0, 3), ξ.ρ.uri.slice(0, 2) - ), - ξ.is-root-relative.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ).concat(ξ.path).concat( - ξ.has-trailing-slash.if(ξ.ρ.separator, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.validated( - ξ.normalized.eq("\\\\").if( - ξ.ρ.separator, Φ̇.string(ξ.normalized) - ) - ).determined, - auto-named-attr-at-357-27(accum, segment) ↦ ⟦ - φ ↦ ξ.segment.eq("..").if( - ξ.accum.length.gt(0).and(ξ.accum.tail.eq("..").not).if( - ξ.accum.head, - ξ.ρ.is-root-relative.not.and(ξ.ρ.is-drive-relative.not).if( - ξ.accum.with(ξ.segment), ξ.accum - ) - ), - ξ.segment.eq(".").or(ξ.segment.eq("")).if( - ξ.accum, ξ.accum.with(ξ.segment) - ) - ) - ⟧ - ⟧, - resolved(other) ↦ ⟦ - uri-as-bytes ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - valid-other ↦ Φ̇.dataized(ξ.ρ.separated-correctly(ξ.other)).as-bytes, - other-is-drive-relative ↦ ξ.ρ.is-drive-relative(ξ.valid-other).as-bool, - other-is-root-relative ↦ ξ.ρ.is-root-relative(ξ.valid-other).as-bool, - φ ↦ ξ.ρ.ρ.validated( - Φ̇.string( - ξ.other-is-drive-relative.if( - ξ.valid-other, - ξ.other-is-root-relative.if( - ξ.ρ.is-drive-relative(ξ.uri-as-bytes).if( - ξ.uri-as-bytes.slice(0, 2).concat(ξ.valid-other), ξ.valid-other - ), - ξ.uri-as-bytes.concat(ξ.ρ.separator).concat( - ξ.valid-other - ) - ) - ) - ) - ).normalized - ⟧, - basename() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - slice-start-idx ↦ Φ̇.dataized( - ξ.txt.last-index-of(ξ.ρ.separator).plus(1) - ).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.slice-start-idx.eq(0)).if( - ξ.pth, - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - extname() ↦ ⟦ - base ↦ Φ̇.dataized(ξ.ρ.basename).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.base)), - slice-start-idx ↦ Φ̇.dataized(ξ.txt.last-index-of(".")).as-bytes, - φ ↦ ξ.base.size.eq(0).or(ξ.slice-start-idx.eq(-1)).if( - "", - Φ̇.string( - ξ.txt.slice( - ξ.slice-start-idx, ξ.txt.length.minus(Φ̇.number(ξ.slice-start-idx)) - ).as-bytes - ) - ) - ⟧, - dirname() ↦ ⟦ - pth ↦ Φ̇.dataized(ξ.ρ.uri).as-bytes, - txt ↦ Φ̇.txt.text(Φ̇.string(ξ.pth)), - len ↦ Φ̇.dataized(ξ.txt.last-index-of(ξ.ρ.separator)).as-bytes, - φ ↦ Φ̇.string( - ξ.pth.size.eq(0).or(ξ.len.eq(-1)).if( - ξ.pth, ξ.txt.slice(0, ξ.len).as-bytes - ) - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi deleted file mode 100644 index 13fb1e7a9..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/fs/tmpdir.phi +++ /dev/null @@ -1,39 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - fs() ↦ ⟦ - tmpdir() ↦ ⟦ - φ ↦ Φ̇.fs.dir(Φ̇.fs.file(Φ̇.string(ξ.os-tmp-dir))), - os-tmp-dir ↦ Φ̇.dataized(ξ.os-tmp-dir-1).as-bytes, - os-tmp-dir-1() ↦ ⟦ - tmpdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TMPDIR")).as-bytes, - tmp ↦ Φ̇.dataized(Φ̇.sys.getenv("TMP")).as-bytes, - temp ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMP")).as-bytes, - tempdir ↦ Φ̇.dataized(Φ̇.sys.getenv("TEMPDIR")).as-bytes, - userprofile ↦ Φ̇.dataized(Φ̇.sys.getenv("USERPROFILE")).as-bytes, - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.tmp.eq("").if( - ξ.temp.eq("").if( - ξ.userprofile.eq("").if("C:\\Windows", ξ.userprofile), ξ.temp - ), - ξ.tmp - ), - ξ.tmpdir.eq("").if( - ξ.tmp.eq("").if( - ξ.temp.eq("").if( - ξ.tempdir.eq("").if("/tmp", ξ.tempdir), ξ.temp - ), - ξ.tmp - ), - ξ.tmpdir - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi deleted file mode 100644 index 8c451a69f..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/go.phi +++ /dev/null @@ -1,34 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - go() ↦ ⟦ - id ↦ Φ̇.dataized( - Φ̇.malloc.of( - 8, - ⟦ - m ↦ ∅, - φ ↦ ξ.m.put(ξ.m.id) - ⟧ - ) - ).as-bytes, - to(body) ↦ ⟦ - φ ↦ Φ̇.try(ξ.body(ξ.token), ξ.auto-named-attr-at-63-9, Φ̇.true), - token() ↦ ⟦ - backward ↦ Φ̇.error(ξ.jump(ξ.ρ.ρ.to(ξ.ρ.body))), - jump(value) ↦ ⟦ - id ↦ ξ.ρ.ρ.ρ.id - ⟧, - forward(res) ↦ ⟦ - φ ↦ Φ̇.error(ξ.ρ.jump(ξ.res)) - ⟧ - ⟧, - auto-named-attr-at-63-9(e) ↦ ⟦ - φ ↦ ξ.ρ.ρ.id.eq(ξ.e.id).if(ξ.e.value, Φ̇.error(ξ.e)) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi deleted file mode 100644 index 9cca7961f..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/bytes-as-input.phi +++ /dev/null @@ -1,36 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - bytes-as-input(bts) ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(ξ.ρ.bts, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(data, buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - to-read ↦ Φ̇.dataized(ξ.size).as-bytes, - available ↦ Φ̇.dataized(ξ.ρ.data.size).as-bytes, - next ↦ Φ̇.dataized( - Φ̇.number(ξ.available).gt(ξ.to-read).if(ξ.to-read, ξ.available) - ).as-bytes, - φ ↦ ξ.available.eq(0).if( - ξ.ρ.ρ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.bytes(⟦ Δ ⤍ -- ⟧)), - ξ.ρ.ρ.input-block( - ξ.ρ.data.slice( - ξ.next, Φ̇.number(ξ.available).minus(Φ̇.number(ξ.next)) - ).as-bytes, - ξ.ρ.data.slice(0, ξ.next).as-bytes - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi deleted file mode 100644 index f3927bdbc..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/console.phi +++ /dev/null @@ -1,122 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - console() ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if(ξ.windows-console, ξ.posix-console).platform, - posix-console() ↦ ⟦ - platform ↦ ξ, - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized( - Φ̇.sys.posix( - "read", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.stdin-fileno), ξ.size - ) - ).output - ).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.sys.posix( - "write", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.posix.stdout-fileno - ), - ξ.buffer - ), - ξ.buffer.size - ) - ).code - ), - ξ.ρ.ρ.output-block - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - windows-console() ↦ ⟦ - platform ↦ ξ, - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ Φ̇.dataized( - Φ̇.sys.win32( - "ReadFile", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.std-input-handle), ξ.size - ) - ).output - ).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧, - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.sys.win32( - "WriteFile", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.win32.std-output-handle - ), - ξ.buffer - ), - ξ.buffer.size - ) - ).code - ), - ξ.ρ.ρ.output-block - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi deleted file mode 100644 index 88fa9373e..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/input-length.phi +++ /dev/null @@ -1,21 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - input-length(input) ↦ ⟦ - chunk ↦ 4096, - φ ↦ ξ.rec-read(ξ.input, 0), - rec-read(input, length) ↦ ⟦ - read-bytes ↦ ξ.input.read(ξ.ρ.chunk).read.ρ, - φ ↦ ξ.read-bytes.size.eq(0).if( - ξ.length, ξ.ρ.rec-read(ξ.read-bytes, ξ.length.plus(ξ.read-bytes.size)) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi deleted file mode 100644 index 411aff509..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/malloc-as-output.phi +++ /dev/null @@ -1,30 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - malloc-as-output(allocated) ↦ ⟦ - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block(0).write(ξ.buffer).self, - output-block(offset) ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, ξ.ρ.ρ.ρ.allocated.write(ξ.ρ.offset, ξ.buffer) - ), - ξ.ρ.ρ.output-block(ξ.ρ.offset.plus(ξ.buffer.size)) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi deleted file mode 100644 index cf3083bdc..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdin.phi +++ /dev/null @@ -1,45 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - stdin() ↦ ⟦ - φ ↦ ξ.all-lines, - all-lines() ↦ ⟦ - φ ↦ ξ.rec-read(ξ.ρ.next-line, Φ̇.bytes(⟦ Δ ⤍ -- ⟧), Φ̇.true), - separator ↦ Φ̇.dataized(Φ̇.sys.line-separator).as-bytes, - rec-read(line, buffer, first) ↦ ⟦ - φ ↦ ξ.line.length.eq(0).if( - Φ̇.string(ξ.buffer), - ξ.ρ.rec-read( - ξ.ρ.ρ.next-line, - ξ.first.if( - ξ.buffer.concat(ξ.line), ξ.buffer.concat(ξ.ρ.separator).concat(ξ.line) - ), - Φ̇.false - ) - ) - ⟧ - ⟧, - next-line() ↦ ⟦ - first ↦ Φ̇.io.console.read(1).self, - φ ↦ ξ.first.as-bytes.size.eq(0).if( - "", ξ.rec-read(ξ.first, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)) - ), - rec-read(input, buffer) ↦ ⟦ - char ↦ ξ.input.as-bytes, - next ↦ ξ.input.read(1).self, - φ ↦ ξ.char.eq(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).or( - ξ.char.eq("\r").and(ξ.next.as-bytes.eq("\n")).or(ξ.char.eq("\n")) - ).if( - Φ̇.string(ξ.buffer), ξ.ρ.rec-read(ξ.next, ξ.buffer.concat(ξ.char)) - ) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi deleted file mode 100644 index 0f0ffc3d7..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/stdout.phi +++ /dev/null @@ -1,18 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - stdout(text) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.io.console.write(ξ.text)), Φ̇.true - ) - ) - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi deleted file mode 100644 index 877892a2c..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/io/tee-input.phi +++ /dev/null @@ -1,34 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - io() ↦ ⟦ - tee-input(input, output) ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(ξ.ρ.input, ξ.ρ.output, Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read( - ξ.size - ).self, - input-block(input, output, buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ ξ.ρ.input.read(ξ.size).read.ρ, - written-bytes ↦ ξ.ρ.output.write(ξ.read-bytes).write.ρ, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.written-bytes), - ξ.ρ.ρ.input-block( - ξ.read-bytes, ξ.written-bytes, ξ.read-bytes.as-bytes - ) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi deleted file mode 100644 index 36907019c..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/malloc.phi +++ /dev/null @@ -1,55 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - malloc() ↦ ⟦ - empty(scope) ↦ ⟦ - φ ↦ ξ.ρ.ρ.malloc.of(0, ξ.scope) - ⟧, - for(object, scope) ↦ ⟦ - bts ↦ Φ̇.dataized(ξ.object).as-bytes, - φ ↦ ξ.ρ.ρ.malloc.of(ξ.bts.size, ξ.auto-named-attr-at-96-9), - auto-named-attr-at-96-9(m) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.m.write(0, ξ.ρ.bts)), ξ.ρ.scope(ξ.m) - ) - ) - ⟧ - ⟧, - of(size, scope) ↦ ⟦ - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_φ - ⟧, - allocated(id) ↦ ⟦ - φ ↦ ξ.get, - get ↦ ξ.read(0, ξ.size), - size() ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_size - ⟧, - resized(new-size) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_resized - ⟧, - copy(source, target, length) ↦ ⟦ - φ ↦ ξ.ρ.write(ξ.target, ξ.ρ.read(ξ.source, ξ.length)) - ⟧, - read(offset, length) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_read - ⟧, - write(offset, data) ↦ ⟦ - λ ⤍ Lorg_eolang_malloc_of_allocated_write - ⟧, - put(object) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.write(0, ξ.object)), ξ.ρ.get - ) - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi deleted file mode 100644 index 36e3a037d..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/angle.phi +++ /dev/null @@ -1,30 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - angle(value) ↦ ⟦ - φ ↦ ξ.value, - in-degrees ↦ ξ.ρ.angle(ξ.ρ.times(180).div(Φ̇.math.pi)), - in-radians ↦ ξ.ρ.angle(ξ.times(Φ̇.math.pi).div(180)), - sin() ↦ ⟦ - λ ⤍ Lorg_eolang_math_angle_sin - ⟧, - cos() ↦ ⟦ - λ ⤍ Lorg_eolang_math_angle_cos - ⟧, - tan() ↦ ⟦ - cosine ↦ Φ̇.dataized(ξ.ρ.cos).as-bytes, - φ ↦ ξ.cosine.eq(0).if(Φ̇.nan, ξ.ρ.sin.div(ξ.cosine)) - ⟧, - ctan() ↦ ⟦ - sine ↦ Φ̇.dataized(ξ.ρ.sin).as-bytes, - φ ↦ ξ.sine.eq(0).if(Φ̇.nan, ξ.ρ.cos.div(ξ.sine)) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi deleted file mode 100644 index d317affda..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/e.phi +++ /dev/null @@ -1,12 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - e ↦ 2.718281828459045, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi deleted file mode 100644 index 8d91be218..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/integral.phi +++ /dev/null @@ -1,66 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - integral(fun, a, b, n) ↦ ⟦ - subsection(a, b) ↦ ⟦ - φ ↦ ξ.b.minus(ξ.a).div(6).times( - ξ.ρ.fun(ξ.a).plus( - 4.times(ξ.ρ.fun(0.5.times(ξ.a.plus(ξ.b)))).plus(ξ.ρ.fun(ξ.b)) - ) - ) - ⟧, - φ ↦ Φ̇.malloc.of(8, ξ.auto-named-attr-at-50-11).as-number, - auto-named-attr-at-50-11(sum) ↦ ⟦ - φ ↦ Φ̇.malloc.for(ξ.ρ.a, ξ.auto-named-attr-at-53-16), - auto-named-attr-at-53-16(left) ↦ ⟦ - right ↦ ξ.ρ.ρ.b, - step ↦ ξ.right.minus(ξ.left).div(ξ.ρ.ρ.n).as-number, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.while( - ξ.auto-named-attr-at-58-19, - ⟦ - i ↦ ∅, - φ ↦ Φ̇.true - ⟧ - ) - ), - ξ.ρ.sum - ) - ), - auto-named-attr-at-58-19(i) ↦ ⟦ - φ ↦ ξ.ρ.left.as-number.plus(ξ.ρ.step).lt(ξ.ρ.right).if( - Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - ξ.ρ.ρ.sum.put( - ξ.ρ.ρ.sum.as-number.plus( - ξ.ρ.ρ.ρ.subsection( - ξ.ρ.left.as-number, ξ.ρ.left.as-number.plus(ξ.ρ.step) - ) - ) - ) - ), - ξ.ρ.left.put(ξ.ρ.left.as-number.plus(ξ.ρ.step)) - ), - Φ̇.true - ) - ), - Φ̇.false - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi deleted file mode 100644 index 0d8b00b73..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/numbers.phi +++ /dev/null @@ -1,42 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - numbers(sequence) ↦ ⟦ - φ ↦ ξ.sequence, - max() ↦ ⟦ - lst ↦ Φ̇.structs.list(ξ.ρ.sequence), - φ ↦ ξ.lst.is-empty.if( - Φ̇.error("Can't get max number from empty sequence"), - ξ.lst.reduced( - Φ̇.negative-infinity, - ⟦ - max ↦ ∅, - item ↦ ∅, - φ ↦ ξ.item.as-number.gt(ξ.max).if(ξ.item, ξ.max) - ⟧ - ) - ) - ⟧, - min() ↦ ⟦ - lst ↦ Φ̇.structs.list(ξ.ρ.sequence), - φ ↦ ξ.lst.is-empty.if( - Φ̇.error("Can't get min number from empty sequence"), - ξ.lst.reduced( - Φ̇.positive-infinity, - ⟦ - min ↦ ∅, - item ↦ ∅, - φ ↦ ξ.min.gt(ξ.item.as-number).if(ξ.item, ξ.min) - ⟧ - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi deleted file mode 100644 index 30ce1a6b3..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/pi.phi +++ /dev/null @@ -1,12 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - pi ↦ 3.141592653589793, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi deleted file mode 100644 index fbd838b98..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/random.phi +++ /dev/null @@ -1,53 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - random(seed) ↦ ⟦ - fixed ↦ ξ, - φ ↦ ξ.seed.as-number.div( - Φ̇.bytes(⟦ Δ ⤍ 00-20-00-00-00-00-00-00 ⟧).as-i64.as-number - ), - next ↦ ξ.ρ.random( - ξ.seed.times(25214903917).plus(11).as-i64.and( - Φ̇.bytes(⟦ Δ ⤍ 00-0F-FF-FF-FF-FF-FF-FF ⟧) - ).as-i64.as-number - ).fixed, - pseudo() ↦ ⟦ - const-1 ↦ 35, - const-2 ↦ 53, - const-3 ↦ 17, - one ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-01 ⟧), - φ ↦ ξ.ρ.ρ.random(ξ.time-seed), - time-seed ↦ ξ.time-bytes.left(ξ.const-1).and( - ξ.one.left(ξ.const-2).as-i64.minus(ξ.one).as-bytes - ).as-i64.plus( - ξ.time-bytes.left(ξ.const-3).and( - ξ.one.left(ξ.const-1).as-i64.minus(ξ.one).as-bytes - ).as-i64.plus( - ξ.time-bytes.and( - ξ.one.left(ξ.const-3).as-i64.minus(ξ.one).as-bytes - ).as-i64 - ) - ).as-number, - time-bytes ↦ Φ̇.sys.os.is-windows.if( - Φ̇.sys.win32( - "GetSystemTime", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.system-time) - ).milliseconds, - ⟦ - timeval ↦ Φ̇.sys.posix( - "gettimeofday", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.timeval) - ).output, - φ ↦ ξ.timeval.tv-sec.times(1000).plus( - ξ.timeval.tv-usec.as-i64.div(1000.as-i64).as-number - ) - ⟧ - ).as-i64.as-bytes - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi deleted file mode 100644 index ca17c2711..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/math/real.phi +++ /dev/null @@ -1,49 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - math() ↦ ⟦ - real(num) ↦ ⟦ - φ ↦ ξ.num, - exp ↦ Φ̇.math.real(Φ̇.math.e).pow(ξ.num), - mod(x) ↦ ⟦ - dividend ↦ Φ̇.number(ξ.ρ.num.as-bytes), - divisor ↦ Φ̇.number(ξ.x.as-bytes), - φ ↦ ξ.divisor.eq(0).if( - Φ̇.error("Can't calculate mod by zero"), - ξ.dividend.gt(0).if(ξ.abs-mod, ξ.abs-mod.neg) - ), - abs-mod() ↦ ⟦ - dividend-abs ↦ Φ̇.math.real(ξ.ρ.dividend).abs, - divisor-abs ↦ Φ̇.math.real(ξ.ρ.divisor).abs, - φ ↦ ξ.dividend-abs.minus( - ξ.divisor-abs.times(ξ.dividend-abs.div(ξ.divisor-abs).floor) - ) - ⟧ - ⟧, - abs() ↦ ⟦ - value ↦ Φ̇.number(ξ.ρ.num.as-bytes), - φ ↦ ξ.value.gte(0).if(ξ.value, ξ.value.neg) - ⟧, - pow(x) ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_pow - ⟧, - sqrt() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_sqrt - ⟧, - ln() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_ln - ⟧, - acos() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_acos - ⟧, - asin() ↦ ⟦ - λ ⤍ Lorg_eolang_math_real_asin - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi deleted file mode 100644 index b7d2d7595..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/net/socket.phi +++ /dev/null @@ -1,535 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - net() ↦ ⟦ - socket(address, port) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - ξ.win-socket(ξ.address, ξ.port), ξ.posix-socket(ξ.address, ξ.port) - ), - htons(port) ↦ ⟦ - bts ↦ ξ.port.as-i16.as-bytes, - φ ↦ ξ.bts.and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)).left(8).or( - ξ.bts.right(8).and(Φ̇.bytes(⟦ Δ ⤍ FF- ⟧)) - ).as-i16 - ⟧, - as-input(recv) ↦ ⟦ - read(size) ↦ ⟦ - φ ↦ ξ.input-block(Φ̇.bytes(⟦ Δ ⤍ -- ⟧)).read(ξ.size).self, - input-block(buffer) ↦ ⟦ - self ↦ ξ, - φ ↦ ξ.buffer, - read(size) ↦ ⟦ - read-bytes ↦ ξ.ρ.ρ.ρ.recv(ξ.size).as-bytes, - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.read-bytes), ξ.ρ.ρ.input-block(ξ.read-bytes) - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - as-output(send) ↦ ⟦ - write(buffer) ↦ ⟦ - φ ↦ ξ.output-block.write(ξ.buffer).self, - output-block() ↦ ⟦ - self ↦ ξ, - φ ↦ Φ̇.true, - write(buffer) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.ρ.ρ.send(ξ.buffer)), ξ.ρ.ρ.output-block - ) - ).self - ⟧ - ⟧ - ⟧ - ⟧, - posix-socket(address, port) ↦ ⟦ - sd ↦ Φ̇.sys.posix( - "socket", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.posix.af-inet), Φ̇.sys.posix.sock-stream - ), - Φ̇.sys.posix.ipproto-tcp - ) - ).code, - inet-addr ↦ Φ̇.sys.posix( - "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) - ).code, - inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.posix.inaddr-none).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' posix syscall, reason: '%s'", - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.strerror.code) - ) - ), - ξ.inet-addr.as-i32 - ), - sockaddr ↦ Φ̇.sys.posix.sockaddr-in( - Φ̇.sys.posix.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int - ), - scoped-socket(sockfd) ↦ ⟦ - as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), - as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), - send(buffer) ↦ ⟦ - buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, - sent ↦ Φ̇.sys.posix( - "send", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size - ), - 0 - ) - ).code, - φ ↦ ξ.sent.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to send message through the socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code - ) - ) - ), - ξ.sent - ) - ⟧, - recv(size) ↦ ⟦ - received ↦ Φ̇.sys.posix( - "recv", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 - ) - ).called, - φ ↦ ξ.received.code.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to receive data from the socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.strerror.code - ) - ) - ), - ξ.received.output - ) - ⟧ - ⟧, - strerror() ↦ ⟦ - φ ↦ Φ̇.sys.posix( - "strerror", - Φ̇.tuple( - Φ̇.tuple.empty, Φ̇.sys.posix("errno", Φ̇.tuple.empty).code - ) - ) - ⟧, - closed-socket(sockfd) ↦ ⟦ - closed ↦ Φ̇.sys.posix("close", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd)).code, - φ ↦ ξ.closed.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't close a posix socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.strerror.code - ) - ) - ), - Φ̇.true - ) - ⟧, - safe-socket(scope) ↦ ⟦ - φ ↦ ξ.ρ.sd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't create a posix socket, reason: '%s'", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.strerror.code) - ) - ), - Φ̇.try( - ξ.scope, - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.ρ.closed-socket(ξ.ρ.sd) - ) - ) - ⟧, - connect(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-274-10), - auto-named-attr-at-274-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - connected ↦ Φ̇.sys.posix( - "connect", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ ξ.connected.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't connect to '%s:%d' on posix socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes - ) - ⟧ - ⟧, - listen(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-298-10), - auto-named-attr-at-298-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - bound ↦ Φ̇.sys.posix( - "bind", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - listened ↦ Φ̇.sys.posix( - "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) - ).code, - φ ↦ ξ.bound.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't bind posix socket '%d' to '%s:%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address - ), - ξ.sock.port - ), - ξ.sock.strerror.code - ) - ) - ), - ξ.listened.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to listen for connections to '%s:%d' on socket '%d', reason: '%s'", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-323-22)).as-bytes - ) - ), - auto-named-attr-at-323-22() ↦ ⟦ - φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), - accept(scope) ↦ ⟦ - sock ↦ ξ.ρ.ρ.sock, - client-sockfd ↦ Φ̇.sys.posix( - "accept", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ Φ̇.try( - ξ.client-sockfd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to accept a connection on posix socket '%d', reason: %s", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.strerror.code - ) - ) - ), - Φ̇.dataized( - ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) - ).as-bytes - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.sock.closed-socket(ξ.client-sockfd) - ) - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - win-socket(address, port) ↦ ⟦ - sd ↦ Φ̇.sys.win32( - "socket", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.af-inet), Φ̇.sys.win32.sock-stream - ), - Φ̇.sys.win32.ipproto-tcp - ) - ).code, - inet-addr ↦ Φ̇.sys.win32( - "inet_addr", Φ̇.tuple(Φ̇.tuple.empty, ξ.address) - ).code, - inet-addr-as-int ↦ ξ.inet-addr.eq(Φ̇.sys.win32.inaddr-none).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't convert an IPv4 address '%s' into a 32-bit integer via 'inet_addr' win32 function call, WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.address), ξ.last-error.code - ) - ) - ), - ξ.inet-addr.as-i32 - ), - sockaddr ↦ Φ̇.sys.win32.sockaddr-in( - Φ̇.sys.win32.af-inet.as-i16, ξ.ρ.htons(ξ.port), ξ.inet-addr-as-int - ), - scoped-socket(sockfd) ↦ ⟦ - as-input ↦ ξ.ρ.ρ.ρ.as-input(ξ.recv), - as-output ↦ ξ.ρ.ρ.ρ.as-output(ξ.send), - send(buffer) ↦ ⟦ - buff ↦ Φ̇.dataized(ξ.buffer).as-bytes, - sent ↦ Φ̇.sys.win32( - "send", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.buff), ξ.buff.size - ), - 0 - ) - ).code, - φ ↦ ξ.sent.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to send message through the socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code - ) - ) - ), - ξ.sent - ) - ⟧, - recv(size) ↦ ⟦ - received ↦ Φ̇.sys.win32( - "recv", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.size), 0 - ) - ).called, - φ ↦ ξ.received.code.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to receive data from the socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.sockfd), ξ.ρ.ρ.last-error.code - ) - ) - ), - ξ.received.output - ) - ⟧ - ⟧, - last-error() ↦ ⟦ - φ ↦ Φ̇.sys.win32("WSAGetLastError", Φ̇.tuple.empty) - ⟧, - closed-socket(sockfd) ↦ ⟦ - closed ↦ Φ̇.sys.win32( - "closesocket", Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd) - ).code, - φ ↦ ξ.closed.eq(Φ̇.sys.win32.socket-error).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't close a win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sockfd), ξ.ρ.last-error.code - ) - ) - ), - Φ̇.true - ) - ⟧, - safe-socket(scope) ↦ ⟦ - started-up ↦ Φ̇.sys.win32( - "WSAStartup", Φ̇.tuple(Φ̇.tuple.empty, Φ̇.sys.win32.winsock-version-2-2) - ).code, - cleaned-up ↦ Φ̇.sys.win32("WSACleanup", Φ̇.tuple.empty).code, - φ ↦ ξ.started-up.eq(0).not.if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't initialize Winsock via 'WSAStartup' call, WSA error code: %d", - Φ̇.tuple(Φ̇.tuple.empty, ξ.started-up) - ) - ), - Φ̇.try( - ξ.ρ.sd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't create a win32 socket, WSA error code: %d", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.last-error.code) - ) - ), - Φ̇.try( - ξ.scope, - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.ρ.closed-socket(ξ.ρ.sd) - ) - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.cleaned-up.eq(Φ̇.sys.win32.socket-error).if( - Φ̇.error("Couldn't cleanup Winsock resources"), Φ̇.true - ) - ) - ) - ⟧, - connect(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-483-10), - auto-named-attr-at-483-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - connected ↦ Φ̇.sys.win32( - "connect", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ ξ.connected.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't connect to '%s:%d' on win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.sock.scoped-socket(ξ.sock.sd))).as-bytes - ) - ⟧ - ⟧, - listen(scope) ↦ ⟦ - φ ↦ ξ.ρ.safe-socket(ξ.auto-named-attr-at-507-10), - auto-named-attr-at-507-10() ↦ ⟦ - sock ↦ ξ.ρ.ρ, - bound ↦ Φ̇.sys.win32( - "bind", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - listened ↦ Φ̇.sys.win32( - "listen", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), 2048) - ).code, - φ ↦ ξ.bound.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Couldn't bind win32 socket '%d' to '%s:%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.address - ), - ξ.sock.port - ), - ξ.sock.last-error.code - ) - ) - ), - ξ.listened.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to listen for connections to '%s:%d' on socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.address), ξ.sock.port - ), - ξ.sock.sd - ), - ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized(ξ.ρ.scope(ξ.auto-named-attr-at-532-22)).as-bytes - ) - ), - auto-named-attr-at-532-22() ↦ ⟦ - φ ↦ ξ.ρ.sock.scoped-socket(ξ.ρ.sock.sd), - accept(scope) ↦ ⟦ - sock ↦ ξ.ρ.ρ.sock, - client-sockfd ↦ Φ̇.sys.win32( - "accept", - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.sockaddr - ), - ξ.sock.sockaddr.size - ) - ).code, - φ ↦ Φ̇.try( - ξ.client-sockfd.eq(-1).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Failed to accept a connection on win32 socket '%d', WSA error code: %d", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.sock.sd), ξ.sock.last-error.code - ) - ) - ), - Φ̇.dataized( - ξ.scope(ξ.sock.scoped-socket(ξ.client-sockfd)) - ).as-bytes - ), - ⟦ - ex ↦ ∅, - φ ↦ Φ̇.error(ξ.ex) - ⟧, - ξ.sock.closed-socket(ξ.client-sockfd) - ) - ⟧ - ⟧ - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi deleted file mode 100644 index 3693ebf06..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/bytes-as-array.phi +++ /dev/null @@ -1,23 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - bytes-as-array(bts) ↦ ⟦ - bytes-size ↦ Φ̇.dataized(ξ.bts.size).as-bytes, - φ ↦ ξ.slice-byte(Φ̇.tuple.empty, 0), - slice-byte(tup, index) ↦ ⟦ - φ ↦ ξ.index.lt(ξ.ρ.bytes-size).if( - ξ.ρ.slice-byte( - ξ.tup.with(ξ.ρ.bts.slice(ξ.index, 1)), ξ.index.plus(1) - ), - ξ.tup - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi deleted file mode 100644 index 66d91abdf..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/hash-code-of.phi +++ /dev/null @@ -1,30 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - hash-code-of(input) ↦ ⟦ - input-as-bytes ↦ Φ̇.dataized(ξ.input.as-bytes).as-bytes, - size ↦ Φ̇.dataized(ξ.input-as-bytes.size).as-bytes, - magic-number ↦ 31.as-i64, - φ ↦ ξ.rec-hash-code(0, 0), - rec-hash-code(acc, index) ↦ ⟦ - φ ↦ ξ.index.eq(ξ.ρ.size).if( - ξ.acc.as-number, - ξ.ρ.rec-hash-code( - ξ.ρ.magic-number.times(ξ.acc).plus( - Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat( - ξ.ρ.input-as-bytes.slice(ξ.index, 1) - ).as-i64 - ), - ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi deleted file mode 100644 index 6630ed3c6..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/list.phi +++ /dev/null @@ -1,194 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - list(origin) ↦ ⟦ - φ ↦ ξ.origin, - is-empty() ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.origin.length) - ⟧, - with(x) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list(ξ.ρ.origin.with(ξ.x)) - ⟧, - withi(index, item) ↦ ⟦ - φ ↦ ξ.ρ.head(ξ.index).with(ξ.item).concat( - ξ.ρ.tail(ξ.ρ.origin.length.minus(ξ.index)) - ) - ⟧, - reducedi(start, func) ↦ ⟦ - origin-len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ 0.eq(ξ.origin-len).if(ξ.start, ξ.rec-reduced(ξ.start, 0.as-bytes)), - rec-reduced(accum, index) ↦ ⟦ - idx-as-number ↦ ξ.index.as-number, - next-index ↦ Φ̇.dataized(1.plus(ξ.idx-as-number)).as-bytes, - φ ↦ ξ.next-index.eq(ξ.ρ.origin-len).if( - ξ.accumulated, ξ.ρ.rec-reduced(ξ.accumulated, ξ.next-index) - ), - accumulated ↦ ξ.ρ.func( - ξ.accum, ξ.ρ.ρ.origin.at(ξ.idx-as-number), ξ.idx-as-number - ) - ⟧ - ⟧, - reduced(start, func) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(ξ.start, ξ.auto-named-attr-at-83-42), - auto-named-attr-at-83-42(accum, item, idx) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.accum, ξ.item) - ⟧ - ⟧, - mappedi(func) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-93-24) - ), - auto-named-attr-at-93-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.accum.with(ξ.ρ.func(ξ.item, ξ.idx)) - ⟧ - ⟧, - mapped(func) ↦ ⟦ - φ ↦ ξ.ρ.mappedi(ξ.auto-named-attr-at-103-30), - auto-named-attr-at-103-30(item, idx) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - eachi(func) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-113-22), - auto-named-attr-at-113-22(acc, item, index) ↦ ⟦ - φ ↦ Φ̇.seq( - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.acc), ξ.ρ.func(ξ.item, ξ.index) - ) - ) - ⟧ - ⟧, - each(func) ↦ ⟦ - φ ↦ ξ.ρ.eachi(ξ.auto-named-attr-at-123-32), - auto-named-attr-at-123-32(item, index) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - withouti(i) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-130-24) - ), - auto-named-attr-at-130-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.ρ.i.eq(ξ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - without(element) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list( - ξ.ρ.reduced(Φ̇.tuple.empty, ξ.auto-named-attr-at-141-20) - ), - auto-named-attr-at-141-20(accum, item) ↦ ⟦ - φ ↦ ξ.ρ.element.eq(ξ.item).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - eq(other) ↦ ⟦ - φ ↦ ξ.ρ.origin.length.eq(ξ.other.length).and( - ξ.ρ.reducedi(Φ̇.true, ξ.auto-named-attr-at-156-24) - ), - auto-named-attr-at-156-24(accum, item, idx) ↦ ⟦ - φ ↦ ξ.accum.and(ξ.item.eq(ξ.ρ.other.at(ξ.idx))) - ⟧ - ⟧, - concat(passed) ↦ ⟦ - φ ↦ ξ.ρ.ρ.list(ξ.passed).reduced( - ξ.ρ, - ⟦ - accum ↦ ∅, - item ↦ ∅, - φ ↦ ξ.accum.with(ξ.item) - ⟧ - ) - ⟧, - index-of(wanted) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-176-24), - auto-named-attr-at-176-24(accum, item, index) ↦ ⟦ - φ ↦ -1.eq(ξ.accum).and(ξ.item.eq(ξ.ρ.wanted)).if(ξ.index, ξ.accum) - ⟧ - ⟧, - last-index-of(wanted) ↦ ⟦ - φ ↦ ξ.ρ.reducedi(-1, ξ.auto-named-attr-at-189-24), - auto-named-attr-at-189-24(accum, item, index) ↦ ⟦ - φ ↦ ξ.item.eq(ξ.ρ.wanted).if(ξ.index, ξ.accum) - ⟧ - ⟧, - contains(element) ↦ ⟦ - φ ↦ -1.eq(ξ.ρ.index-of(ξ.element)).not - ⟧, - sorted() ↦ ⟦ - φ ↦ ξ.ρ - ⟧, - filteredi(func) ↦ ⟦ - origin-length ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ ξ.ρ.ρ.list(ξ.rec-filtered(0.as-bytes, Φ̇.tuple.empty)), - rec-filtered(idx-as-bytes, accum) ↦ ⟦ - original ↦ ξ.ρ.ρ.origin, - index ↦ ξ.idx-as-bytes.as-number, - item ↦ ξ.ρ.ρ.origin.at(ξ.index), - φ ↦ ξ.idx-as-bytes.eq(ξ.ρ.origin-length).if( - ξ.accum, - ξ.ρ.rec-filtered( - 1.plus(ξ.index).as-bytes, - ξ.ρ.func(ξ.item, ξ.index).if(ξ.accum.with(ξ.item), ξ.accum) - ) - ) - ⟧ - ⟧, - filtered(func) ↦ ⟦ - φ ↦ ξ.ρ.filteredi(ξ.auto-named-attr-at-238-32), - auto-named-attr-at-238-32(item, index) ↦ ⟦ - φ ↦ ξ.ρ.func(ξ.item) - ⟧ - ⟧, - head(index) ↦ ⟦ - idx ↦ Φ̇.dataized(ξ.index).as-bytes, - φ ↦ Φ̇.switch( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple( - Φ̇.tuple.empty, - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, 0.eq(ξ.idx)), ξ.ρ.ρ.list(Φ̇.tuple.empty) - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, 0.gt(ξ.idx)), ξ.ρ.tail(ξ.index.as-number.neg) - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin.length.lte(ξ.idx)), ξ.ρ - ) - ), - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple.empty, Φ̇.true), - ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-259-32) - ) - ) - ) - ), - auto-named-attr-at-259-32(accum, item, index) ↦ ⟦ - φ ↦ ξ.index.gte(ξ.ρ.idx).if(ξ.accum, ξ.accum.with(ξ.item)) - ⟧ - ⟧, - tail(index) ↦ ⟦ - idx ↦ Φ̇.dataized(ξ.index).as-bytes, - start ↦ Φ̇.dataized(ξ.ρ.origin.length.minus(ξ.idx.as-number)).as-bytes, - φ ↦ 0.gt(ξ.start).if( - ξ.ρ, - ξ.ρ.ρ.list( - ξ.ρ.reducedi(Φ̇.tuple.empty, ξ.auto-named-attr-at-275-26) - ) - ), - auto-named-attr-at-275-26(accum, item, idx) ↦ ⟦ - φ ↦ ξ.idx.gte(ξ.ρ.start).if(ξ.accum.with(ξ.item), ξ.accum) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi deleted file mode 100644 index 02ae19c86..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/map.phi +++ /dev/null @@ -1,122 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - map(pairs) ↦ ⟦ - φ ↦ ξ.auto-named-attr-at-37-6.initialized, - entry(key, value) ↦ ⟦⟧, - initialized(entries) ↦ ⟦ - initialized ↦ ξ, - size ↦ ξ.entries.length, - keys() ↦ ⟦ - φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( - ⟦ - entry ↦ ∅, - φ ↦ ξ.entry.key - ⟧ - ) - ⟧, - values() ↦ ⟦ - φ ↦ Φ̇.structs.list(ξ.ρ.entries).mapped( - ⟦ - entry ↦ ∅, - φ ↦ ξ.entry.value - ⟧ - ) - ⟧, - has(key) ↦ ⟦ - φ ↦ ξ.ρ.found(ξ.key).exists - ⟧, - found(key) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.size.eq(0).if(ξ.not-found, ξ.rec-key-search(ξ.not-found, 0)), - rec-key-search(found, index) ↦ ⟦ - entry ↦ ξ.ρ.ρ.entries.at(ξ.index), - φ ↦ ξ.found.exists.or(ξ.ρ.ρ.size.eq(ξ.index)).if( - ξ.found, - ξ.ρ.rec-key-search( - ξ.ρ.hash.eq(ξ.entry.hash).if( - ξ.auto-named-attr-at-125-54, ξ.found - ), - ξ.index.plus(1) - ) - ), - auto-named-attr-at-125-54() ↦ ⟦ - exists ↦ Φ̇.true, - get ↦ ξ.ρ.entry.value - ⟧ - ⟧, - not-found() ↦ ⟦ - exists ↦ Φ̇.false, - get ↦ Φ̇.error( - Φ̇.txt.sprintf( - "Object by hash code %d from given key does not exists", - Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.hash) - ) - ) - ⟧ - ⟧, - with(key, value) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.map.initialized( - Φ̇.structs.list(ξ.ρ.entries).filtered( - ξ.auto-named-attr-at-145-50 - ).origin.with(ξ.auto-named-attr-at-146-12) - ), - auto-named-attr-at-145-50(entry) ↦ ⟦ - φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not - ⟧, - auto-named-attr-at-146-12() ↦ ⟦ - key ↦ ξ.ρ.key, - value ↦ ξ.ρ.value, - hash ↦ ξ.ρ.hash - ⟧ - ⟧, - without(key) ↦ ⟦ - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.key)).as-bytes, - φ ↦ ξ.ρ.ρ.ρ.map.initialized( - Φ̇.structs.list(ξ.ρ.entries).filtered( - ξ.auto-named-attr-at-159-48 - ).origin - ), - auto-named-attr-at-159-48(entry) ↦ ⟦ - φ ↦ ξ.ρ.hash.eq(ξ.entry.hash).not - ⟧ - ⟧ - ⟧, - auto-named-attr-at-37-6() ↦ ⟦ - pairs-size ↦ Φ̇.dataized(ξ.ρ.pairs.length).as-bytes, - φ ↦ ξ.ρ.initialized( - ξ.pairs-size.eq(0).if( - Φ̇.tuple.empty, - ξ.rec-rebuild(Φ̇.tuple.empty, 0, Φ̇.structs.list(Φ̇.tuple.empty)) - ) - ), - rec-rebuild(accum, index, hashes) ↦ ⟦ - entry ↦ ξ.ρ.ρ.pairs.at(ξ.index), - hash ↦ Φ̇.dataized(Φ̇.structs.hash-code-of(ξ.entry.key)).as-bytes, - φ ↦ ξ.ρ.pairs-size.eq(ξ.index).if( - ξ.accum, - ξ.ρ.rec-rebuild( - ξ.hashes.contains(ξ.hash).if( - ξ.accum, ξ.accum.with(ξ.auto-named-attr-at-59-18) - ), - ξ.index.plus(1), - ξ.hashes.with(ξ.hash) - ) - ), - auto-named-attr-at-59-18() ↦ ⟦ - key ↦ ξ.ρ.entry.key, - value ↦ ξ.ρ.entry.value, - hash ↦ ξ.ρ.hash - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi deleted file mode 100644 index f477d2a18..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range-of-ints.phi +++ /dev/null @@ -1,26 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - range-of-ints(start, end) ↦ ⟦ - φ ↦ 0.eq(ξ.start).or(1.eq(ξ.start.div(ξ.start))).and( - 0.eq(ξ.end).or(1.eq(ξ.end.div(ξ.end))) - ).if( - Φ̇.structs.range(ξ.auto-named-attr-at-42-8, ξ.end), - Φ̇.error("Some of the arguments are not integers") - ), - auto-named-attr-at-42-8() ↦ ⟦ - build(num) ↦ ⟦ - φ ↦ ξ.num, - next ↦ ξ.ρ.build(1.plus(ξ.φ)) - ⟧, - φ ↦ ξ.build(ξ.ρ.start) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi deleted file mode 100644 index 338bb09dd..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/range.phi +++ /dev/null @@ -1,23 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - range(start, end) ↦ ⟦ - φ ↦ Φ̇.structs.list( - ξ.start.lt(ξ.end).if( - ξ.appended(Φ̇.tuple(Φ̇.tuple.empty, ξ.start), ξ.start.next), Φ̇.tuple.empty - ) - ), - appended(acc, current) ↦ ⟦ - φ ↦ ξ.current.lt(ξ.ρ.end).if( - ξ.ρ.appended(ξ.acc.with(ξ.current), ξ.current.next), ξ.acc - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi deleted file mode 100644 index 72f9f44e3..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/structs/set.phi +++ /dev/null @@ -1,37 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - structs() ↦ ⟦ - set(lst) ↦ ⟦ - φ ↦ ξ.initialized( - Φ̇.structs.map( - Φ̇.structs.list(ξ.lst).mapped( - ⟦ - item ↦ ∅, - φ ↦ Φ̇.structs.map.entry(ξ.item, Φ̇.true) - ⟧ - ).origin - ) - ).initialized, - initialized(map) ↦ ⟦ - initialized ↦ ξ, - φ ↦ ξ.map.keys, - size ↦ ξ.map.size, - with(item) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.with(ξ.item, Φ̇.true)) - ⟧, - without(item) ↦ ⟦ - φ ↦ ξ.ρ.ρ.ρ.set.initialized(ξ.ρ.map.without(ξ.item)) - ⟧, - has(item) ↦ ⟦ - φ ↦ ξ.ρ.map.has(ξ.item) - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi deleted file mode 100644 index 07c5340cd..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/switch.phi +++ /dev/null @@ -1,18 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - switch(cases) ↦ ⟦ - len ↦ Φ̇.dataized(ξ.cases.length).as-bytes, - φ ↦ ξ.len.eq(0).if(Φ̇.error("switch cases are empty"), ξ.case-at(0)), - case-at(index) ↦ ⟦ - case ↦ ξ.ρ.cases.at(ξ.index), - φ ↦ ξ.index.eq(ξ.ρ.len).if( - Φ̇.true, ξ.case.at(0).if(ξ.case.at(1), ξ.ρ.case-at(ξ.index.plus(1))) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi deleted file mode 100644 index 4697eba5d..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/getenv.phi +++ /dev/null @@ -1,19 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - getenv(name) ↦ ⟦ - φ ↦ Φ̇.sys.os.is-windows.if( - Φ̇.sys.win32( - "GetEnvironmentVariable", Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.name), 512) - ), - Φ̇.sys.posix("getenv", Φ̇.tuple(Φ̇.tuple.empty, ξ.name)) - ).output - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi deleted file mode 100644 index 34a457b2e..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/line-separator.phi +++ /dev/null @@ -1,14 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - line-separator() ↦ ⟦ - φ ↦ Φ̇.string(Φ̇.sys.os.is-windows.if("\r\n", "\n").as-bytes) - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi deleted file mode 100644 index e545be378..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/os.phi +++ /dev/null @@ -1,23 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - os() ↦ ⟦ - φ ↦ ξ.name, - is-windows() ↦ ⟦ - os-name ↦ Φ̇.dataized(ξ.ρ.name).as-bytes, - φ ↦ ξ.os-name.size.gt(6).and(ξ.os-name.slice(0, 7).eq("Windows")) - ⟧, - is-linux ↦ Φ̇.txt.regex("/linux/i").matches(ξ.name).as-bool, - is-macos ↦ Φ̇.txt.regex("/mac/i").matches(ξ.name).as-bool, - name() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_os_name - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi deleted file mode 100644 index 5dcb9673b..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/posix.phi +++ /dev/null @@ -1,35 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - posix(name, args) ↦ ⟦ - stdin-fileno ↦ 0, - stdout-fileno ↦ 1, - af-inet ↦ 2, - sock-stream ↦ 1, - ipproto-tcp ↦ 6, - inaddr-none ↦ -1, - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_posix_φ - ⟧, - return(code, output) ↦ ⟦ - called ↦ ξ, - φ ↦ ξ.output - ⟧, - timeval(tv-sec, tv-usec) ↦ ⟦ - self ↦ ξ - ⟧, - sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ - sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), - size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( - ξ.sin-zero.size - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi deleted file mode 100644 index 25465a93e..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/sys/win32.phi +++ /dev/null @@ -1,38 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - sys() ↦ ⟦ - win32(name, args) ↦ ⟦ - std-input-handle ↦ -10, - std-output-handle ↦ -11, - af-inet ↦ 2, - sock-stream ↦ 1, - ipproto-tcp ↦ 6, - invalid-socket ↦ -1, - socket-error ↦ -1, - inaddr-none ↦ -1, - winsock-version-2-2 ↦ Φ̇.bytes(⟦ Δ ⤍ 02-02 ⟧), - φ() ↦ ⟦ - λ ⤍ Lorg_eolang_sys_win32_φ - ⟧, - return(code, output) ↦ ⟦ - called ↦ ξ, - φ ↦ ξ.output - ⟧, - system-time(year, month, day, day-of-week, hour, minute, second, milliseconds) ↦ ⟦ - self ↦ ξ - ⟧, - sockaddr-in(sin-family, sin-port, sin-addr) ↦ ⟦ - sin-zero ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00-00 ⟧), - size ↦ ξ.sin-family.size.plus(ξ.sin-port.size).plus(ξ.sin-addr.size).plus( - ξ.sin-zero.size - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi deleted file mode 100644 index f4c9ca8d2..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/regex.phi +++ /dev/null @@ -1,56 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - regex(expression) ↦ ⟦ - φ ↦ ξ.compiled, - compiled() ↦ ⟦ - λ ⤍ Lorg_eolang_txt_regex_compiled - ⟧, - pattern(serialized) ↦ ⟦ - matches(txt) ↦ ⟦ - φ ↦ ξ.ρ.match(ξ.txt).next.exists - ⟧, - match(txt) ↦ ⟦ - next ↦ ξ.matched-from-index(1, 0).matched, - matched-from-index(position, start) ↦ ⟦ - λ ⤍ Lorg_eolang_txt_regex_pattern_match_matched_from_index - ⟧, - matched(position, start, from, to, groups) ↦ ⟦ - matched ↦ ξ, - groups-count ↦ ξ.groups.length, - exists ↦ ξ.start.gte(0), - next ↦ ξ.exists.if( - ξ.ρ.matched-from-index(ξ.position.plus(1), ξ.to).matched, - Φ̇.error("Matched block does not exist, can't get next") - ), - text ↦ ξ.exists.if( - ξ.group(0), Φ̇.error("Matched block does not exist, can't get text") - ), - group(index) ↦ ⟦ - φ ↦ ξ.ρ.groups.at(ξ.index) - ⟧ - ⟧, - not-matched(position) ↦ ⟦ - φ ↦ ξ.ρ.matched( - ξ.position, - -1, - Φ̇.error( - "Matched block does not exist, can't get 'from' position" - ), - Φ̇.error( - "Matched block does not exist, can't get 'to' position" - ), - Φ̇.error("Matched block does not exist, can't get groups") - ) - ⟧ - ⟧ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi deleted file mode 100644 index b8353c056..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/sscanf.phi +++ /dev/null @@ -1,14 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - sscanf(format, read) ↦ ⟦ - λ ⤍ Lorg_eolang_txt_sscanf - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file diff --git a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi b/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi deleted file mode 100644 index 28cb8d7d8..000000000 --- a/eo-phi-normalizer/data/0.50.0/org/eolang/txt/text.phi +++ /dev/null @@ -1,275 +0,0 @@ -{⟦ - org() ↦ ⟦ - eolang() ↦ ⟦ - txt() ↦ ⟦ - text(origin) ↦ ⟦ - φ ↦ ξ.origin, - is-alphanumeric ↦ Φ̇.txt.regex("/^[A-Za-z0-9]+$/").matches(ξ.origin), - is-alpha ↦ Φ̇.txt.regex("/^[a-zA-Z]+$/").matches(ξ.origin), - is-ascii ↦ Φ̇.txt.regex("/^[\\x00-\\x7F]*$/").matches(ξ.origin), - slice(start, len) ↦ ⟦ - φ ↦ ξ.ρ.ρ.text(ξ.ρ.origin.slice(ξ.start, ξ.len)) - ⟧, - trimmed-left() ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - idx ↦ Φ̇.dataized(ξ.first-non-space-index(0)).as-bytes, - φ ↦ 0.eq(ξ.len).if( - ξ.ρ, ξ.ρ.slice(ξ.idx, Φ̇.number(ξ.len).minus(Φ̇.number(ξ.idx))) - ), - first-non-space-index(index) ↦ ⟦ - char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, - φ ↦ ξ.ρ.len.eq(ξ.index).if( - ξ.index, - " ".eq(ξ.char).if( - ξ.ρ.first-non-space-index(ξ.index.plus(1)), ξ.index - ) - ) - ⟧ - ⟧, - trimmed-right() ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.origin.length).as-bytes, - φ ↦ 0.eq(ξ.len).if( - ξ.ρ, ξ.ρ.slice(0, ξ.first-non-space-index(Φ̇.number(ξ.len).plus(-1))) - ), - first-non-space-index(index) ↦ ⟦ - char ↦ Φ̇.dataized(ξ.ρ.ρ.origin.slice(ξ.index, 1)).as-bytes, - φ ↦ -1.eq(ξ.index).if( - 0, - " ".eq(ξ.char).if( - ξ.ρ.first-non-space-index(ξ.index.plus(-1)), ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - trimmed() ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.length).if(ξ.ρ, ξ.ρ.trimmed-left.trimmed-right) - ⟧, - joined(items) ↦ ⟦ - delimiter ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, - first ↦ ξ.items.at(0), - len ↦ Φ̇.dataized(ξ.items.length).as-bytes, - not-empty ↦ Φ̇.dataized( - 1.eq(ξ.len).if( - ξ.first, ξ.first.as-bytes.concat(ξ.with-delimiter("".as-bytes, 1)) - ) - ).as-bytes, - φ ↦ ξ.ρ.ρ.text(0.eq(ξ.len).if("", Φ̇.string(ξ.not-empty))), - with-delimiter(acc, index) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.index).if( - ξ.acc, - ξ.ρ.with-delimiter( - ξ.acc.concat(ξ.ρ.delimiter.concat(ξ.ρ.items.at(ξ.index))), ξ.index.plus(1) - ) - ) - ⟧ - ⟧, - repeated(times) ↦ ⟦ - bts ↦ Φ̇.dataized(ξ.ρ.origin.as-bytes).as-bytes, - amount ↦ Φ̇.dataized(ξ.times).as-bytes, - φ ↦ 0.gt(ξ.amount).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Can't repeat text %d times", Φ̇.tuple(Φ̇.tuple.empty, ξ.amount) - ) - ), - ξ.ρ.ρ.text( - 0.eq(ξ.amount).if("", Φ̇.string(ξ.rec-repeated(ξ.bts, 1))) - ) - ), - rec-repeated(accum, index) ↦ ⟦ - φ ↦ ξ.ρ.amount.eq(ξ.index).if( - ξ.accum, ξ.ρ.rec-repeated(ξ.accum.concat(ξ.ρ.bts), ξ.index.plus(1)) - ) - ⟧ - ⟧, - contains(substring) ↦ ⟦ - φ ↦ -1.eq(ξ.ρ.index-of(ξ.substring)).not - ⟧, - ends-with(substring) ↦ ⟦ - substr ↦ Φ̇.dataized(ξ.substring).as-bytes, - φ ↦ ξ.ρ.index-of(ξ.substr).eq(ξ.ρ.length.minus(ξ.substr.size)) - ⟧, - starts-with(substring) ↦ ⟦ - φ ↦ 0.eq(ξ.ρ.index-of(ξ.substring)) - ⟧, - index-of(substring) ↦ ⟦ - self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, - substr ↦ Φ̇.string(ξ.substr-as-bytes), - sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, - end ↦ Φ̇.dataized(Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len))).as-bytes, - φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( - ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) - ).if(-1, ξ.rec-index-of-substr(0)), - rec-index-of-substr(idx) ↦ ⟦ - φ ↦ ξ.ρ.end.eq(ξ.idx).if( - ξ.contains.if(ξ.idx, -1), - ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(1))) - ), - contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) - ⟧, - substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes - ⟧, - last-index-of(substring) ↦ ⟦ - self-len ↦ Φ̇.dataized(Φ̇.string(ξ.ρ.origin.as-bytes).length).as-bytes, - substr ↦ Φ̇.string(ξ.substr-as-bytes), - sub-len ↦ Φ̇.dataized(ξ.substr.length).as-bytes, - φ ↦ Φ̇.number(ξ.sub-len).gt(ξ.self-len).or( - ξ.sub-len.eq(ξ.self-len).and(ξ.substr.eq(ξ.ρ.origin).not) - ).if( - -1, - ξ.rec-index-of-substr( - Φ̇.number(ξ.self-len).minus(Φ̇.number(ξ.sub-len)) - ) - ), - rec-index-of-substr(idx) ↦ ⟦ - φ ↦ 0.eq(ξ.idx).if( - ξ.contains.if(ξ.idx, -1), - ξ.contains.if(ξ.idx, ξ.ρ.rec-index-of-substr(ξ.idx.plus(-1))) - ), - contains ↦ ξ.ρ.substr.eq(ξ.ρ.ρ.slice(ξ.idx, ξ.ρ.sub-len)) - ⟧, - substr-as-bytes ↦ Φ̇.dataized(ξ.substring).as-bytes - ⟧, - up-cased() ↦ ⟦ - ascii-z ↦ Φ̇.dataized(ξ.ascii("z")).as-bytes, - ascii-a ↦ Φ̇.dataized(ξ.ascii("a")).as-bytes, - distance ↦ Φ̇.number(ξ.ascii-a).minus(ξ.ascii("A")), - φ ↦ ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( - Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-258-22 - ) - ) - ), - ascii(char) ↦ ⟦ - φ ↦ Φ̇.bytes(⟦ Δ ⤍ 00-00-00-00-00-00-00 ⟧).concat(ξ.char.as-bytes).as-i64.as-number - ⟧, - auto-named-attr-at-258-22(accum, byte) ↦ ⟦ - ascii-bte ↦ ξ.ρ.ascii(ξ.byte), - φ ↦ ξ.accum.concat( - ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( - ξ.ascii-bte.minus(ξ.ρ.distance).as-i64.as-bytes.slice(7, 1), ξ.byte - ) - ) - ⟧ - ⟧, - low-cased() ↦ ⟦ - ascii-z ↦ ξ.ρ.up-cased.ascii("Z"), - ascii-a ↦ ξ.ρ.up-cased.ascii("A"), - φ ↦ ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(Φ̇.structs.bytes-as-array(ξ.ρ.origin.as-bytes)).reduced( - Φ̇.bytes(⟦ Δ ⤍ -- ⟧), ξ.auto-named-attr-at-291-22 - ) - ) - ), - auto-named-attr-at-291-22(accum, byte) ↦ ⟦ - ascii-bte ↦ ξ.ρ.ρ.up-cased.ascii(ξ.byte), - φ ↦ ξ.accum.concat( - ξ.ascii-bte.lte(ξ.ρ.ascii-z).and(ξ.ascii-bte.gte(ξ.ρ.ascii-a)).if( - ξ.ascii-bte.plus(ξ.ρ.ρ.up-cased.distance).as-i64.as-bytes.slice( - 7, 1 - ), - ξ.byte - ) - ) - ⟧ - ⟧, - at(i) ↦ ⟦ - len ↦ Φ̇.dataized(ξ.ρ.length).as-bytes, - idx ↦ Φ̇.dataized(ξ.i).as-bytes, - index ↦ Φ̇.dataized( - 0.gt(ξ.idx).if(Φ̇.number(ξ.len).plus(ξ.idx), ξ.idx) - ).as-bytes, - φ ↦ 0.gt(ξ.index).or(Φ̇.number(ξ.index).gte(ξ.len)).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Given index %d is out of text bounds", Φ̇.tuple(Φ̇.tuple.empty, ξ.index) - ) - ), - ξ.ρ.slice(ξ.index, 1) - ) - ⟧, - replaced(target, replacement) ↦ ⟦ - self-as-bytes ↦ Φ̇.dataized(ξ.ρ.origin).as-bytes, - reinit ↦ Φ̇.string(ξ.self-as-bytes), - matched ↦ ξ.target.match(ξ.reinit).next, - φ ↦ ξ.matched.exists.not.if( - Φ̇.txt.text(ξ.reinit), - Φ̇.txt.text(ξ.rec-replaced(ξ.matched, "", ξ.matched.start)) - ), - rec-replaced(block, accum, start) ↦ ⟦ - φ ↦ ξ.block.exists.if( - ξ.ρ.rec-replaced( - ξ.block.next, - ξ.accum.concat( - ξ.ρ.reinit.slice(ξ.start, ξ.block.from.minus(ξ.start)) - ).concat(ξ.ρ.replacement), - ξ.block.to - ), - Φ̇.string( - ξ.accum.concat( - ξ.ρ.reinit.slice(ξ.start, ξ.ρ.reinit.length.minus(ξ.start)) - ) - ) - ) - ⟧ - ⟧, - as-number() ↦ ⟦ - scanned ↦ Φ̇.txt.sscanf("%f", ξ.ρ.origin), - φ ↦ ξ.scanned.length.eq(0).if( - Φ̇.error( - Φ̇.txt.sprintf( - "Can't convert text %s to number", Φ̇.tuple(Φ̇.tuple.empty, ξ.ρ.origin) - ) - ), - ξ.scanned.tail - ) - ⟧, - split(delimiter) ↦ ⟦ - delim ↦ Φ̇.dataized(ξ.delimiter).as-bytes, - self-as-bytes ↦ ξ.ρ.origin.as-bytes, - len ↦ Φ̇.dataized(ξ.self-as-bytes.size).as-bytes, - φ ↦ ξ.len.eq(0).if(Φ̇.tuple.empty, ξ.rec-split(Φ̇.tuple.empty, 0, 0)), - rec-split(accum, start, current) ↦ ⟦ - φ ↦ ξ.ρ.len.eq(ξ.current).if( - ξ.with-substr, - ξ.ρ.delim.eq(ξ.ρ.self-as-bytes.slice(ξ.current, 1)).if( - ξ.ρ.rec-split( - ξ.with-substr, ξ.current.plus(1), ξ.current.plus(1) - ), - ξ.ρ.rec-split(ξ.accum, ξ.start, ξ.current.plus(1)) - ) - ), - with-substr ↦ ξ.accum.with( - Φ̇.string( - ξ.ρ.self-as-bytes.slice(ξ.start, ξ.current.minus(ξ.start)) - ) - ) - ⟧ - ⟧, - chained(others) ↦ ⟦ - φ ↦ 0.eq(ξ.others.length).if( - ξ.ρ, - ξ.ρ.ρ.text( - Φ̇.string( - Φ̇.structs.list(ξ.others).reduced( - ξ.ρ.origin.as-bytes, - ⟦ - accum ↦ ∅, - str ↦ ∅, - φ ↦ ξ.accum.concat(ξ.str.as-bytes) - ⟧ - ) - ) - ) - ) - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧ -⟧} \ No newline at end of file From 1ac19e900d2a688ea0448c076310080402a21071 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Dec 2024 16:36:41 +0000 Subject: [PATCH 69/69] chore(ci): Update Markdown files --- site/docs/src/eo-phi-normalizer/dataize.md | 1430 +---------- site/docs/src/eo-phi-normalizer/rewrite.md | 79 +- site/docs/src/eo-phi-normalizer/test.md | 54 +- site/docs/src/quick-start.md | 2610 +------------------- 4 files changed, 102 insertions(+), 4071 deletions(-) diff --git a/site/docs/src/eo-phi-normalizer/dataize.md b/site/docs/src/eo-phi-normalizer/dataize.md index e083c42e4..227446c15 100644 --- a/site/docs/src/eo-phi-normalizer/dataize.md +++ b/site/docs/src/eo-phi-normalizer/dataize.md @@ -81,1208 +81,66 @@ eo-phi-normalizer dataize --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/ ```console Evaluating lambda 'Package' : ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package ⟧ - - Dataizing: Φ.org.eolang.float ( + Dataizing: Φ̇.float( as-bytes ↦ 25.0 ) - - Phi: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( + NF: Φ̇.float( as-bytes ↦ 25.0 ) - - NF: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( + Dataizing inside application: Φ̇.float + Dataizing inside dispatch: Φ̇ + Dataizing inside dispatch: Φ.org + Dataizing inside dispatch: Φ + Nothing to dataize: Φ + Dataization changed nothing: Φ̇.float( as-bytes ↦ 25.0 ) - - Dataizing inside application: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ - - Evaluating lambda 'Package' : ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ - - Dataization changed nothing: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ 25.0 -) - - Dataizing: ξ.c.times ( - x ↦ 1.8 -) -.plus ( - x ↦ 32.0 -) - - xi: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.c.times ( - x ↦ 1.8 -) -.plus ( - x ↦ 32.0 -) - - DOT: Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( - x ↦ 1.8 -) -.plus ( - x ↦ 32.0 -) - - Phi: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( - x ↦ 1.8 -) -.plus ( - x ↦ 32.0 -) - - Phi: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( - x ↦ 1.8 -) -.plus ( - x ↦ 32.0 -) - - Phi: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( + Dataizing: ξ.c.times( x ↦ 1.8 -) -.plus ( +).plus( x ↦ 32.0 ) - - NF: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( + NF: ξ.c.times( x ↦ 1.8 -) -.plus ( +).plus( x ↦ 32.0 ) - - Dataizing inside application: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( + Dataizing inside application: ξ.c.times( x ↦ 1.8 -) -.plus - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( +).plus + Dataizing inside dispatch: ξ.c.times( x ↦ 1.8 ) - - Dataizing inside application: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) - - Dataizing inside application: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org - Dataizing inside dispatch: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ - - Evaluating lambda 'Package' : ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ - - Dataization changed nothing: ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package -⟧ -.org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) -) -.times ( + Dataizing inside application: ξ.c.times + Dataizing inside dispatch: ξ.c + Dataizing inside dispatch: ξ + Nothing to dataize: ξ + Dataization changed nothing: ξ.c.times( x ↦ 1.8 -) -.plus ( +).plus( x ↦ 32.0 ) - Dataized 'Package' siblings: ⟦ - c ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ) - .times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package ⟧ - ``` ### `--output-file FILE` @@ -1305,116 +163,12 @@ eo-phi-normalizer dataize --recursive --rules eo-phi-normalizer/test/eo/phi/rule ```console { ⟦ - c ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ) - .times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -1435,13 +189,12 @@ eo-phi-normalizer dataize --minimize-stuck-terms --recursive --enable-atom "Lorg ```console { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -1460,13 +213,12 @@ eo-phi-normalizer dataize --minimize-stuck-terms --recursive --disable-atom "Lor ```console { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -1485,116 +237,12 @@ cat celsius.phi | eo-phi-normalizer dataize --recursive --rules ./eo-phi-normali ```console { ⟦ - c ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.float ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.number ( - as-bytes ↦ ⟦ - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - .org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ) - .times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package diff --git a/site/docs/src/eo-phi-normalizer/rewrite.md b/site/docs/src/eo-phi-normalizer/rewrite.md index 9e39ed31e..0b3cdf5be 100644 --- a/site/docs/src/eo-phi-normalizer/rewrite.md +++ b/site/docs/src/eo-phi-normalizer/rewrite.md @@ -63,17 +63,16 @@ eo-phi-normalizer rewrite --rules ./eo-phi-normalizer/test/eo/phi/rules/new.yaml ``` ```console -Rule set based on Yegor's draft +Rule set following Nov 2024 revision Input: { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -83,13 +82,12 @@ Input: Result 1 out of 1: { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -107,17 +105,16 @@ eo-phi-normalizer rewrite --chain --rules ./eo-phi-normalizer/test/eo/phi/rules/ ``` ```console -Rule set based on Yegor's draft +Rule set following Nov 2024 revision Input: { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -127,13 +124,12 @@ Input: Result 1 out of 1: [ 1 / 1 ] NF: { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -151,37 +147,17 @@ eo-phi-normalizer rewrite --chain --tex bar.phi ``` ```tex -% Rule set following Nov 2024 revision +% Rule set based on Yegor's draft \documentclass{article} \usepackage{eolang} \begin{document} - -This is the 1st possible chain of normalizing rewritings: - -\begin{phiquation*} -[[ m -> [[ x -> [[ t -> [[ D> 42- ]] ]].t ]].x ]] \trans_{\rulename{DOT}} - \trans [[ m -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]].x ]] \trans_{\rulename{DOT}} - \trans [[ m -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] )( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{RHO}} - \trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( )( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{DUP}} - \trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{STAY}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]]( ) ]] \trans_{\rulename{DUP}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]] \trans_{\rulename{NF}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]]. -\end{phiquation*} - -This is the 2nd possible chain of normalizing rewritings: - \begin{phiquation*} [[ m -> [[ x -> [[ t -> [[ D> 42- ]] ]].t ]].x ]] \trans_{\rulename{DOT}} - \trans [[ m -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]].x ]] \trans_{\rulename{RHO}} - \trans [[ m -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ) ]].x ]] \trans_{\rulename{DUP}} \trans [[ m -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]].x ]] \trans_{\rulename{DOT}} - \trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ^ -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]] ) ]] \trans_{\rulename{STAY}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]]( ) ]] \trans_{\rulename{DUP}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]] \trans_{\rulename{NF}} - \trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]]. + \trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]] \trans_{\rulename{NF}} + \trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]]. \end{phiquation*} \end{document} @@ -195,12 +171,12 @@ eo-phi-normalizer rewrite --json --chain --rules ./eo-phi-normalizer/test/eo/phi ```json { - "input": "{\n ⟦\n c ↦ Φ.org.eolang.float (\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times (\n x ↦ 1.8\n )\n .plus (\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}", + "input": "{\n ⟦\n c ↦ Φ̇.float(\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times(\n x ↦ 1.8\n ).plus(\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}", "output": [ [ [ "NF", - "{\n ⟦\n c ↦ Φ.org.eolang.float (\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times (\n x ↦ 1.8\n )\n .plus (\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" + "{\n ⟦\n c ↦ Φ̇.float(\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times(\n x ↦ 1.8\n ).plus(\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" ] ] ] @@ -216,13 +192,12 @@ eo-phi-normalizer rewrite --single --rules ./eo-phi-normalizer/test/eo/phi/rules ```console { ⟦ - c ↦ Φ.org.eolang.float ( + c ↦ Φ̇.float( as-bytes ↦ 25.0 ), - result ↦ ξ.c.times ( + result ↦ ξ.c.times( x ↦ 1.8 - ) - .plus ( + ).plus( x ↦ 32.0 ), λ ⤍ Package @@ -237,7 +212,7 @@ eo-phi-normalizer rewrite --single --single-line --rules ./eo-phi-normalizer/tes ``` ```console -{ ⟦ c ↦ Φ.org.eolang.float ( as-bytes ↦ 25.0 ), result ↦ ξ.c.times ( x ↦ 1.8 ) .plus ( x ↦ 32.0 ), λ ⤍ Package ⟧ } +{ ⟦ c ↦ Φ̇.float( as-bytes ↦ 25.0 ), result ↦ ξ.c.times( x ↦ 1.8 ).plus( x ↦ 32.0 ), λ ⤍ Package ⟧ } ``` ### `--single` `--json` @@ -247,7 +222,7 @@ eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/ph ``` ```console -"{\n ⟦\n c ↦ Φ.org.eolang.float (\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times (\n x ↦ 1.8\n )\n .plus (\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" +"{\n ⟦\n c ↦ Φ̇.float(\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times(\n x ↦ 1.8\n ).plus(\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" ``` ### `--tex` @@ -257,14 +232,14 @@ eo-phi-normalizer rewrite --tex bar.phi ``` ```tex -% Rule set following Nov 2024 revision +% Rule set based on Yegor's draft \documentclass{article} \usepackage{eolang} \begin{document} \begin{phiquation*} -[[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]] +[[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]] \end{phiquation*} \end{document} @@ -286,5 +261,5 @@ cat celsius.phi | eo-phi-normalizer rewrite --single --json --rules ./eo-phi-nor ``` ```console -"{\n ⟦\n c ↦ Φ.org.eolang.float (\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times (\n x ↦ 1.8\n )\n .plus (\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" +"{\n ⟦\n c ↦ Φ̇.float(\n as-bytes ↦ 25.0\n ),\n result ↦ ξ.c.times(\n x ↦ 1.8\n ).plus(\n x ↦ 32.0\n ),\n λ ⤍ Package\n ⟧\n}" ``` diff --git a/site/docs/src/eo-phi-normalizer/test.md b/site/docs/src/eo-phi-normalizer/test.md index 7118adf1e..365def74f 100644 --- a/site/docs/src/eo-phi-normalizer/test.md +++ b/site/docs/src/eo-phi-normalizer/test.md @@ -33,48 +33,54 @@ The full command is hidden to not show unnecessary details in the documentation. ```console User-defined rules unit tests - Rule set based on Yegor's draft - xi - Does not replace ξ inside a subformation [✔] + Rule set following Nov 2024 revision DOT + Contextualization changes ξ [✔] + Contextualization applies recursively [✔] + Phi Paper - Example E2 [✔] + Phi Paper - Example E3 - first R_dot [✔] + Phi Paper - Example E3 - second R_dot [✔] + Phi Paper - Example E4 - first R_dot [✔] + Phi Paper - Example E4 - second R_dot [✔] + Phi Paper - Example E5 - first R_dot [✔] + Phi Paper - Example E5 - second R_dot [✔] + COPY Should match [✔] - Shouldn't match [✔] - Shouldn't match [✔] - Should apply in subformations [✔] - Should respect surrounding context [✔] - DOTrho Should match [✔] + Phi Paper - Example E1 [✔] + Phi Paper - Example E4 - dispatch on y [✔] + Phi Paper - Example E4 - remove dispatch on y [✔] + RHO + Phi Paper - Example E5 - first R_rho [✔] phi - Attribute does not exist [✔] - Attribute exists [✔] - Both attributes do not exist [✔] - COPY + Phi Paper - Example E5 - R_phi [✔] + STAY + Phi Paper - Example E3 - first R_stay [✔] Should match [✔] - Should not match in subformations [✔] - COPY1 - Should match first void attribute [✔] - COPY2 - Should match positional arguments [✔] - EMPTY - Should match [✔] - Should not match [✔] - Should match in subformation [✔] - Should work with empty formation [✔] OVER Language.EO.Test.YamlSpec[46:13] [✔] STOP Accessing nonexistent attribute [✔] + NULL + Phi Paper Example E2 second dispatch [✔] + DUP + Should match [✔] + Should not match [✔] + Should match in subformation [✔] + Should work with empty formation [✔] + Phi Paper - Example E5 - first R_rho [✔] MISS Language.EO.Test.YamlSpec[46:13] [✔] Should not match if attr is present [✔] - Should not match if phi is present [✔] + Should not match for rho [✔] Should apply in subformations [✔] DD Dispatch on bottom is bottom [✔] Dispatch on anything else is not touched [✔] DC Should apply in subformations [✔] + Phi Paper Example E2 last application [✔] Finished in 0.0062 seconds -27 examples, 0 failures +34 examples, 0 failures ``` diff --git a/site/docs/src/quick-start.md b/site/docs/src/quick-start.md index 2b9f069b9..91a86ae9c 100644 --- a/site/docs/src/quick-start.md +++ b/site/docs/src/quick-start.md @@ -20,2610 +20,12 @@ eo-phi-normalizer dataize \ ```console { ⟦ - c ↦ 25.0, - result ↦ ⟦ - x ↦ 1.8, - λ ⤍ Lorg_eolang_float_times, - ρ ↦ ⟦ - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - as-bytes ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - org ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - ⟧ - ⟧ - .number ( - as-bytes ↦ ⟦ - Δ ⤍ 40-39-00-00-00-00-00-00, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧, - ρ ↦ ⟦ - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - org ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - ⟧ - ⟧ - ⟧ - ), - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧, - ρ ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package, - ρ ↦ ⟦ - org ↦ ⟦ - eolang ↦ ⟦ - float ↦ ⟦ - as-bytes ↦ ∅, - φ ↦ ξ.as-bytes, - eq ↦ ⟦ - x ↦ ∅, - x-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - self-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ - ) - .as-bytes, - nan-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ Φ.org.eolang.nan - ) - .as-bytes, - pos-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - neg-zero-as-bytes ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 80-00-00-00-00-00-00-00 - ) - ) - ) - .as-bytes, - φ ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.nan-as-bytes - ) - ) - .if ( - α0 ↦ Φ.org.eolang.false, - α1 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.x-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - .and ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.pos-zero-as-bytes - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.neg-zero-as-bytes - ) - ) - ) - .or ( - α0 ↦ ξ.self-as-bytes.eq ( - α0 ↦ ξ.x-as-bytes - ) - ) - ) - ⟧, - lt ↦ ⟦ - x ↦ ∅, - φ ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-00 - ) - ) - .gt ( - α0 ↦ ξ.ρ.minus ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ ξ.value - ) - ) - ), - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes - ⟧, - lte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.lt ( - α0 ↦ ξ.value - ) - ) - ⟧, - gt ↦ ⟦ - λ ⤍ Lorg_eolang_float_gt, - x ↦ ∅ - ⟧, - gte ↦ ⟦ - x ↦ ∅, - value ↦ Φ.org.eolang.dataized ( - α0 ↦ ξ.x - ) - .as-bytes, - φ ↦ ξ.ρ.eq ( - α0 ↦ ξ.value - ) - .or ( - α0 ↦ ξ.ρ.gt ( - α0 ↦ ξ.value - ) - ) - ⟧, - times ↦ ⟦ - λ ⤍ Lorg_eolang_float_times, - x ↦ ∅ - ⟧, - plus ↦ ⟦ - λ ⤍ Lorg_eolang_float_plus, - x ↦ ∅ - ⟧, - neg ↦ ⟦ - φ ↦ ξ.ρ.times ( - α0 ↦ ξ.ρ.ρ.float ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ BF-F0-00-00-00-00-00-00 - ) - ) - ) - ⟧, - minus ↦ ⟦ - φ ↦ ξ.ρ.plus ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - div ↦ ⟦ - λ ⤍ Lorg_eolang_float_div, - x ↦ ∅ - ⟧ - ⟧, - bytes ↦ ⟦ - Δ ⤍ ∅, - as-bytes ↦ ξ, - eq ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_eq, - b ↦ ∅ - ⟧, - size ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_size - ⟧, - slice ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_slice, - start ↦ ∅, - len ↦ ∅ - ⟧, - as-string ↦ ⟦ - φ ↦ Φ.org.eolang.string ( - α0 ↦ ξ.ρ - ) - ⟧, - as-int ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-69-6E-74 - ) - ) - ) - ) - ⟧, - as-float ↦ ⟦ - φ ↦ ξ.ρ.size.eq ( - α0 ↦ Φ.org.eolang.int ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 00-00-00-00-00-00-00-08 - ) - ) - ) - .if ( - α0 ↦ Φ.org.eolang.float ( - α0 ↦ ξ.ρ - ), - α1 ↦ Φ.org.eolang.error ( - α0 ↦ Φ.org.eolang.string ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 43-61-6E-27-74-20-63-6F-6E-76-65-72-74-20-6E-6F-6E-20-38-20-6C-65-6E-67-74-68-20-62-79-74-65-73-20-74-6F-20-66-6C-6F-61-74 - ) - ) - ) - ) - ⟧, - and ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_and, - b ↦ ∅ - ⟧, - or ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_or, - b ↦ ∅ - ⟧, - xor ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_xor, - b ↦ ∅ - ⟧, - not ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_not - ⟧, - left ↦ ⟦ - φ ↦ ξ.ρ.right ( - α0 ↦ ξ.x.neg - ), - x ↦ ∅ - ⟧, - right ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_right, - x ↦ ∅ - ⟧, - as-bool ↦ ⟦ - φ ↦ ξ.ρ.eq ( - α0 ↦ Φ.org.eolang.bytes ( - Δ ⤍ 01- - ) - ) - ⟧, - concat ↦ ⟦ - λ ⤍ Lorg_eolang_bytes_concat, - b ↦ ∅ - ⟧ - ⟧, - λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧, - c ↦ Φ.org.eolang.float ( - as-bytes ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-39-00-00-00-00-00-00 - ) - ) - ), - result ↦ ξ.c.times ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD - ) - ) - ) - .plus ( - x ↦ Φ.org.eolang.number ( - as-bytes ↦ Φ.org.eolang.bytes ( - Δ ⤍ 40-40-00-00-00-00-00-00 - ) - ) - ), - λ ⤍ Package - ⟧ - ⟧ - ⟧ - ⟧ - ⟧ - .plus ( + c ↦ Φ̇.float( + as-bytes ↦ 25.0 + ), + result ↦ ξ.c.times( + x ↦ 1.8 + ).plus( x ↦ 32.0 ), λ ⤍ Package