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/.gitignore b/.gitignore index 9655aa2b6..945189f45 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,7 @@ *.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 dist @@ -49,3 +46,4 @@ pipeline/* node_modules try-unphi +tmp diff --git a/eo b/eo index 0757c993a..27abe8bef 160000 --- a/eo +++ b/eo @@ -1 +1 @@ -Subproject commit 0757c993acee2fdd1cb8363b6d0191825091827b +Subproject commit 27abe8befa33f8b1e64a89ffb90a015f150f4ec7 diff --git a/eo-phi-normalizer/Setup.hs b/eo-phi-normalizer/Setup.hs index 93243d2c9..5a30e7105 100644 --- a/eo-phi-normalizer/Setup.hs +++ b/eo-phi-normalizer/Setup.hs @@ -89,7 +89,8 @@ 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" + , "rm -f Print.hs ErrM.hs Skel.hs Test.hs Abs.hs.bak Print.hs.bak" , "true" ] @@ -99,7 +100,6 @@ main = _ <- callCommand fullCommand _ <- addLicense "Abs.hs" - _ <- addLicense "Print.hs" postConf simpleUserHooks args flags packageDesc localBuildInfo } diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index 8d77f7106..e7c931edc 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -79,11 +79,11 @@ 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) -import Language.EO.Phi.Syntax (desugar, 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) @@ -275,6 +275,9 @@ data CommandParser = CommandParser , test :: Parser CLI'Test } +rulesFile :: String +rulesFile = "yegor.yaml" + commandParser :: CommandParser commandParser = CommandParser{..} @@ -285,7 +288,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{..} @@ -556,17 +559,21 @@ 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 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) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- * Main @@ -600,7 +607,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 @@ -696,6 +703,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/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 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 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 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..d1f82494c --- /dev/null +++ b/eo-phi-normalizer/data/0.50.0/dependencies.md @@ -0,0 +1,1016 @@ +# 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/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/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/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/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/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/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/sprintf.phi](./org/eolang/txt/sprintf.phi) + +```console +{⟦ + org() ↦ ⟦ + eolang() ↦ ⟦ + txt() ↦ ⟦ + sprintf(format, args) ↦ ⟦ + λ ⤍ Lorg_eolang_txt_sprintf + ⟧, + λ ⤍ 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/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/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/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/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/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/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/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/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 diff --git a/eo-phi-normalizer/eo-phi-normalizer.cabal b/eo-phi-normalizer/eo-phi-normalizer.cabal index abd62532e..a6b95e02b 100644 --- a/eo-phi-normalizer/eo-phi-normalizer.cabal +++ b/eo-phi-normalizer/eo-phi-normalizer.cabal @@ -189,6 +189,186 @@ 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 + 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 + 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 test/eo/phi/rules/yegor.yaml @@ -223,6 +403,8 @@ 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.Pretty Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common @@ -234,7 +416,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 @@ -270,8 +451,12 @@ library , hspec , hspec-core , lens + , megaparsec , mtl + , parser-combinators + , prettyprinter , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -316,9 +501,13 @@ executable eo-phi-normalizer , hspec , hspec-core , lens + , megaparsec , mtl , optparse-applicative + , parser-combinators + , prettyprinter , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -345,6 +534,8 @@ 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.Pretty Language.EO.Phi.Report.Data Language.EO.Phi.Report.Html Language.EO.Phi.Rules.Common @@ -356,7 +547,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 @@ -394,8 +584,12 @@ test-suite doctests , hspec , hspec-core , lens + , megaparsec , mtl + , parser-combinators + , prettyprinter , regex-compat + , replace-megaparsec , scientific , template-haskell , text @@ -449,8 +643,12 @@ test-suite spec , hspec-core , hspec-discover , lens + , megaparsec , mtl + , parser-combinators + , prettyprinter , regex-compat + , replace-megaparsec , scientific , template-haskell , text diff --git a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf index 7e5736f4d..29c847fb3 100644 --- a/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf +++ b/eo-phi-normalizer/grammar/EO/Phi/Syntax.cf @@ -39,6 +39,9 @@ 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+)?) ; +token StringRaw '"' ((char - ["\"\\"]) | ('\\' ["\"\\tnrfu"]))* '"'; Program. Program ::= "{" "⟦" [Binding] "⟧" "}" ; @@ -48,22 +51,28 @@ 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 ::= "⊥" ; +ConstStringRaw. Object ::= StringRaw ; +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; +internal ConstString. Object ::= String; AlphaBinding. Binding ::= Attribute "↦" Object ; +AlphaBindingSugar. Binding ::= Object ; EmptyBinding. Binding ::= Attribute "↦" "∅" ; DeltaBinding. Binding ::= "Δ" "⤍" Bytes ; DeltaEmptyBinding. Binding ::= "Δ" "⤍" "∅" ; @@ -73,10 +82,13 @@ MetaDeltaBinding. Binding ::= "Δ" "⤍" BytesMetaId ; separator Binding "," ; Phi. Attribute ::= "φ" ; -- decoratee object +PhiSugar. Attribute ::= "~" "φ" "(" [LabelId] ")"; 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/package.yaml b/eo-phi-normalizer/package.yaml index 8178003aa..bc390057b 100644 --- a/eo-phi-normalizer/package.yaml +++ b/eo-phi-normalizer/package.yaml @@ -93,6 +93,10 @@ dependencies: - containers - code-page - with-utf8 + - replace-megaparsec + - megaparsec + - parser-combinators + - prettyprinter 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..c7f13c3db 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{} -> errorExpectedDesugaredObject f ConstFloat x -> Right (floatToBytes x) + 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 068b3fa89..1b80716c6 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{}) = 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 021129206..7a87863fd 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, errorExpectedDesugaredObject) import Language.EO.Phi.Syntax.Abs data Context = Context @@ -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 [] @@ -79,8 +80,11 @@ 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) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject 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..0252b0ad7 --- /dev/null +++ b/eo-phi-normalizer/src/Language/EO/Phi/Preprocess.hs @@ -0,0 +1,80 @@ +{- 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 + +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/Pretty.hs b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs new file mode 100644 index 000000000..68223e9b1 --- /dev/null +++ b/eo-phi-normalizer/src/Language/EO/Phi/Pretty.hs @@ -0,0 +1,168 @@ +{- 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 #-} + +-- {-# 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.StringRaw where + pretty (Abs.StringRaw i) = pretty i + +instance Pretty Abs.Program where + pretty = \case + Abs.Program bindings -> + vsep + [ lbrace + , indent 2 (pretty (Formation bindings)) + , 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 -> + 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 "Φ̇" + Abs.ThisObject -> pretty "ξ" + Abs.Termination -> pretty "⊥" + 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 + 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 + Abs.PhiSugar labelids -> pretty Abs.Phi <> 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 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..7c01340b0 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{} -> [] + obj@GlobalObjectPhiOrg{} -> errorExpectedDesugaredObject obj ThisObject{} -> [] Termination -> [] MetaObject _ -> [] @@ -126,8 +127,11 @@ withSubObject f ctx root = MetaSubstThis _ _ -> [] MetaContextualize _ _ -> [] ConstString{} -> [] + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt{} -> [] + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj -- | Given a unary function that operates only on plain objects, -- converts it to a function that operates on named objects @@ -153,6 +157,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{} -> errorExpectedDesugaredBinding b EmptyBinding{} -> [] DeltaBinding{} -> [] DeltaEmptyBinding{} -> [] @@ -188,16 +193,25 @@ 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 -> errorExpectedDesugaredObject 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@ConstStringRaw{} -> errorExpectedDesugaredObject obj obj@ConstInt{} -> objectSize (desugar obj) + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj obj@ConstFloat{} -> objectSize (desugar obj) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj bindingSize :: Binding -> Int bindingSize = \case @@ -206,8 +220,9 @@ 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) + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b -- | A variant of `applyRules` with a maximum application depth. applyRulesWith :: ApplicationLimits -> Context -> Object -> [Object] @@ -250,6 +265,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{} = 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 8abae456c..25eeda6ad 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,7 @@ fastYegorInsideOut ctx = \case AlphaBinding a (fastYegorInsideOut ctx' objA) _ -> binding ] + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj Termination -> Termination MetaSubstThis{} -> error "impossible MetaSubstThis!" MetaContextualize{} -> error "impossible MetaContextualize!" @@ -212,5 +213,8 @@ 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) + 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 f00e22ada..2e5a376ef 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 -> errorExpectedDesugaredObject obj ThisObject -> mempty Formation bindings -> foldMap bindingLabelIds bindings ObjectDispatch obj a -> objectLabelIds obj <> attrLabelIds a @@ -239,8 +240,11 @@ 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) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj bindingLabelIds :: Binding -> Set LabelId bindingLabelIds = \case @@ -251,6 +255,7 @@ bindingLabelIds = \case LambdaBinding _ -> mempty MetaBindings _ -> mempty MetaDeltaBinding _ -> mempty + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b attrLabelIds :: Attribute -> Set LabelId attrLabelIds (Label l) = Set.singleton l @@ -278,6 +283,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 = errorExpectedDesugaredObject obj objectMetaIds ThisObject = mempty objectMetaIds Termination = mempty objectMetaIds (MetaObject x) = Set.singleton (MetaIdObject x) @@ -286,8 +292,11 @@ 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) +objectMetaIds obj@ConstFloatRaw{} = errorExpectedDesugaredObject obj bindingMetaIds :: Binding -> Set MetaId bindingMetaIds (AlphaBinding attr obj) = attrMetaIds attr <> objectMetaIds obj @@ -297,6 +306,7 @@ bindingMetaIds DeltaEmptyBinding = mempty bindingMetaIds (LambdaBinding _) = mempty bindingMetaIds (MetaBindings x) = Set.singleton (MetaIdBindings x) bindingMetaIds (MetaDeltaBinding x) = Set.singleton (MetaIdBytes x) +bindingMetaIds b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b attrMetaIds :: Attribute -> Set MetaId attrMetaIds Phi = mempty @@ -304,12 +314,15 @@ attrMetaIds Rho = mempty attrMetaIds (Label _) = mempty attrMetaIds (Alpha _) = mempty attrMetaIds (MetaAttr x) = Set.singleton (MetaIdLabel x) +attrMetaIds a@(AttrSugar{}) = errorExpectedDesugaredAttribute a +attrMetaIds a@(PhiSugar{}) = errorExpectedDesugaredAttribute a objectHasMetavars :: Object -> Bool 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 = errorExpectedDesugaredObject obj objectHasMetavars ThisObject = False objectHasMetavars Termination = False objectHasMetavars (MetaObject _) = True @@ -318,8 +331,11 @@ 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) +objectHasMetavars obj@ConstFloatRaw{} = errorExpectedDesugaredObject obj bindingHasMetavars :: Binding -> Bool bindingHasMetavars (AlphaBinding attr obj) = attrHasMetavars attr || objectHasMetavars obj @@ -329,6 +345,7 @@ bindingHasMetavars DeltaEmptyBinding = False bindingHasMetavars (LambdaBinding _) = False bindingHasMetavars (MetaBindings _) = True bindingHasMetavars (MetaDeltaBinding _) = True +bindingHasMetavars b@AlphaBindingSugar{} = errorExpectedDesugaredBinding b attrHasMetavars :: Attribute -> Bool attrHasMetavars Phi = False @@ -336,6 +353,8 @@ attrHasMetavars Rho = False attrHasMetavars (Label _) = False attrHasMetavars (Alpha _) = False attrHasMetavars (MetaAttr _) = True +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 @@ -436,6 +455,7 @@ applySubst subst@Subst{..} = \case ObjectDispatch obj a -> ObjectDispatch (applySubst subst obj) (applySubstAttr subst a) GlobalObject -> GlobalObject + obj@GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj ThisObject -> ThisObject obj@(MetaObject x) -> fromMaybe obj $ lookup x objectMetas Termination -> Termination @@ -449,8 +469,11 @@ 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) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj applySubstAttr :: Subst -> Attribute -> Attribute applySubstAttr Subst{..} = \case @@ -471,6 +494,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{} -> errorExpectedDesugaredBinding b mergeSubst :: Subst -> Subst -> Subst mergeSubst (Subst xs ys zs ws us) (Subst xs' ys' zs' ws' us') = @@ -520,9 +544,13 @@ matchOneHoleContext ctxId pat obj = matchWhole <> matchPart ThisObject -> [] Termination -> [] ConstString{} -> [] + ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt{} -> [] + ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat{} -> [] - -- should cases below be errors? + ConstFloatRaw{} -> errorExpectedDesugaredObject obj + -- TODO #617:30m Should cases below be errors? + GlobalObjectPhiOrg -> errorExpectedDesugaredObject obj MetaSubstThis{} -> [] MetaContextualize{} -> [] MetaObject{} -> [] @@ -629,6 +657,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 -> errorExpectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to substitute ξ in " <> printTree obj) @@ -636,12 +665,11 @@ 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 - --- {⟦ x ↦ ⟦ b ↦ ⟦ Δ ⤍ 01- ⟧, φ ↦ ⟦ b ↦ ⟦ Δ ⤍ 02- ⟧, c ↦ ⟦ a ↦ ξ.ρ.ρ.b ⟧.a ⟧.c ⟧.φ, λ ⤍ Package ⟧} - --- {⟦ λ ⤍ Package, x ↦ ⟦ b ↦ ⟦⟧ ⟧ ⟧} + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj substThisBinding :: Object -> Binding -> Binding substThisBinding obj = \case @@ -652,6 +680,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{} -> errorExpectedDesugaredBinding b contextualize :: Object -> Object -> Object contextualize thisObj = go @@ -662,6 +691,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 -> errorExpectedDesugaredObject obj Termination -> Termination obj@MetaTailContext{} -> error ("impossible: trying to contextualize " <> printTree obj) obj@MetaContextualize{} -> error ("impossible: trying to contextualize " <> printTree obj) @@ -669,8 +699,11 @@ 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) + obj@ConstFloatRaw{} -> errorExpectedDesugaredObject obj contextualizeBinding :: Object -> Binding -> Binding contextualizeBinding obj = \case @@ -681,3 +714,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{} -> 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 69b690251..91dd74441 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs @@ -21,17 +21,21 @@ -- 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 ( module Language.EO.Phi.Syntax.Abs, desugar, printTree, - shrinkDots, + printTreeDontSugar, -- * Conversion to 'Bytes' intToBytes, @@ -74,40 +78,182 @@ module Language.EO.Phi.Syntax ( paddedLeftChunksOf, normalizeBytes, parseWith, + errorExpectedDesugaredObject, + errorExpectedDesugaredBinding, + errorExpectedDesugaredAttribute, ) where 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 -- >>> :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 = errorExpectedButGot "Object" + +errorExpectedDesugaredBinding :: Binding -> a +errorExpectedDesugaredBinding = errorExpectedButGot "Binding" + +errorExpectedDesugaredAttribute :: Attribute -> a +errorExpectedDesugaredAttribute = errorExpectedButGot "Attribute" + +class DesugarableInitially a where + desugarInitially :: a -> a + desugarInitially = id + +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 + ConstFloatRaw (DoubleSigned x) -> ConstFloat (read x) + 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" + ThisObject -> ThisObject + Termination -> Termination + MetaSubstThis obj this -> MetaSubstThis (desugarInitially obj) (desugarInitially this) + obj@MetaObject{} -> obj + MetaContextualize obj1 obj2 -> MetaContextualize (desugarInitially obj1) (desugarInitially obj2) + MetaTailContext obj metaId -> MetaTailContext (desugarInitially obj) metaId + MetaFunction name obj -> MetaFunction name (desugarInitially obj) + +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 (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 + +instance DesugarableInitially Program where + desugarInitially :: Program -> Program + desugarInitially (Program bindings) = Program (desugarInitially bindings) + +instance DesugarableInitially Binding where + desugarInitially = \case + obj@AlphaBindingSugar{} -> errorExpectedDesugaredBinding obj + AlphaBinding a obj -> AlphaBinding a (desugarInitially obj) + obj -> obj + +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 + sugarFinally (Program bindings) = Program (sugarFinally bindings) + +instance SugarableFinally Object where + sugarFinally :: Object -> Object + sugarFinally = \case + "Φ.org.eolang" -> GlobalObjectPhiOrg + obj@ConstString{} -> obj + obj@ConstStringRaw{} -> errorExpectedDesugaredObject 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 + obj@(AlphaBinding (PhiSugar _) _) -> 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 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) + obj@ConstStringRaw{} -> errorExpectedDesugaredObject obj ConstInt n -> wrapBytesInInt (intToBytes (fromInteger n)) + obj@ConstIntRaw{} -> errorExpectedDesugaredObject obj ConstFloat x -> wrapBytesInFloat (floatToBytes x) - Formation bindings -> Formation (map desugarBinding bindings) - Application obj bindings -> Application (desugar obj) (map desugarBinding bindings) + 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 -> errorExpectedDesugaredObject obj ThisObject -> ThisObject Termination -> Termination MetaSubstThis obj this -> MetaSubstThis (desugar obj) (desugar this) @@ -118,21 +264,28 @@ 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 (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 -- 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" @@ -141,21 +294,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 @@ -164,13 +317,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) @@ -180,107 +333,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) => a -> String -printTree = shrinkDots . render . Phi.prt 0 - --- | 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 @@ -603,19 +655,32 @@ 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 :: (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 - 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 :: (DesugarableInitially a) => ([Token] -> Either String a) -> String -> a unsafeParseWith parser input = case parseWith parser input of Left parseError -> error parseError Right object -> object + +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/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index 84c5e858b..fb120850e 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,75 @@ 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 + | ConstStringRaw StringRaw + | ConstIntRaw IntegerSigned + | ConstFloatRaw DoubleSigned + | MetaSubstThis Object Object + | MetaContextualize Object Object + | MetaObject ObjectMetaId + | MetaTailContext Object TailMetaId + | 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 - = 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 + | PhiSugar [LabelId] + | 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 +108,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 +144,13 @@ 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 IntegerSigned = IntegerSigned 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 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 09f7ad2df..321b1d3ee 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,9 @@ except ``"`` unless preceded by ``\``. + + + Bytes literals are recognized by the regular expression `````{"--"} | ["0123456789ABCDEF"] ["0123456789ABCDEF"] '-' | ["0123456789ABCDEF"] ["0123456789ABCDEF"] ('-' ["0123456789ABCDEF"] ["0123456789ABCDEF"])+````` @@ -74,6 +77,15 @@ MetaFunctionName literals are recognized by the regular expression `````'@' (char - [" !'(),-.:;?[]{|}⟦⟧"])*````` +IntegerSigned literals are recognized by the regular expression +`````'-'? digit+````` + +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. @@ -84,10 +96,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 +120,19 @@ All other symbols are terminals. | | **|** | //Object// ``(`` //[Binding]// ``)`` | | **|** | //Object// ``.`` //Attribute// | | **|** | ``Φ`` + | | **|** | ``Φ̇`` | | **|** | ``ξ`` | | **|** | ``⊥`` - | | **|** | //String// - | | **|** | //Integer// - | | **|** | //Double// + | | **|** | //StringRaw// + | | **|** | //IntegerSigned// + | | **|** | //DoubleSigned// | | **|** | //Object// ``[`` ``ξ`` ``↦`` //Object// ``]`` | | **|** | ``⌈`` //Object// ``,`` //Object// ``⌉`` | | **|** | //ObjectMetaId// | | **|** | //Object// ``*`` //TailMetaId// | | **|** | //MetaFunctionName// ``(`` //Object// ``)`` | //Binding// | -> | //Attribute// ``↦`` //Object// + | | **|** | //Object// | | **|** | //Attribute// ``↦`` ``∅`` | | **|** | ``Δ`` ``⤍`` //Bytes// | | **|** | ``Δ`` ``⤍`` ``∅`` @@ -129,10 +143,15 @@ All other symbols are terminals. | | **|** | //Binding// | | **|** | //Binding// ``,`` //[Binding]// | //Attribute// | -> | ``φ`` + | | **|** | ``~`` ``φ`` ``(`` //[LabelId]// ``)`` | | **|** | ``ρ`` | | **|** | //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..945d1192c 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,18 @@ $s [$u # [\t \n \r \ \! \' \( \) \, \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * \@ [$u # [\t \n \r \ \! \' \( \) \, \- \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * { tok (eitherResIdent T_MetaFunctionName) } +-- token IntegerSigned +\- ? $d + + { tok (eitherResIdent T_IntegerSigned) } + +-- token DoubleSigned +\- ? $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) } @@ -124,6 +136,9 @@ data Tok | T_ObjectMetaId !String | T_BytesMetaId !String | 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. @@ -196,6 +211,9 @@ tokenText t = case t of PT _ (T_ObjectMetaId s) -> s PT _ (T_BytesMetaId s) -> s 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 @@ -222,18 +240,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.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index 26c6a8ee4..349549b5f 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,9 @@ import Language.EO.Phi.Syntax.Lex L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } L_BytesMetaId { PT _ (T_BytesMetaId $$) } L_MetaFunctionName { PT _ (T_MetaFunctionName $$) } + L_IntegerSigned { PT _ (T_IntegerSigned $$) } + L_DoubleSigned { PT _ (T_DoubleSigned $$) } + L_StringRaw { PT _ (T_StringRaw $$) } %% @@ -121,6 +128,15 @@ 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 } +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 } + +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 } @@ -139,11 +155,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 } + | 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 } | '⌈' Object ',' Object '⌉' { Language.EO.Phi.Syntax.Abs.MetaContextualize $2 $4 } | ObjectMetaId { Language.EO.Phi.Syntax.Abs.MetaObject $1 } @@ -153,6 +170,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 } @@ -169,10 +187,18 @@ 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 } | 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 deleted file mode 100644 index 8698e9be6..000000000 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs +++ /dev/null @@ -1,286 +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 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, - ($), - (*), - (+), - (++), - (-), - (.), - (<), - (==), - ) - --- | 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.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.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.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 ")")]) - -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.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]) - -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] diff --git a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs index 241b64b07..e614db4cc 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/ToLaTeX.hs @@ -24,17 +24,20 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} {-# 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} @@ -53,11 +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 = \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 + mkLabels ls = intercalate ", " ((\(LabelId l') -> l') <$> ls) instance ToLatex Binding where toLatex (AlphaBinding attr obj) = toLatex attr <> " -> " <> toLatex obj @@ -67,6 +75,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{} = errorExpectedDesugaredBinding b instance ToLatex Object where toLatex (Formation bindings) = @@ -76,6 +85,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 @@ -84,8 +94,11 @@ 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) + 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/Phi/DataizeSpec.hs b/eo-phi-normalizer/test/Language/EO/Phi/DataizeSpec.hs index f55cc633e..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 #-} @@ -62,23 +63,30 @@ getProgram inputFile = do spec :: Spec spec = do DataizeTestGroup{..} <- runIO (dataizationTests "test/eo/phi/dataization.yaml") - ruleset <- runIO $ parseRuleSetFromFile "test/eo/phi/rules/yegor.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 + 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 diff --git a/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs b/eo-phi-normalizer/test/Language/EO/Rules/PhiPaperSpec.hs index 0ba0891b9..2dc84c754 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 (errorExpectedDesugaredBinding, intToBytes, printTree) 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 (-1_000_000, 1_000_000) instance Arbitrary Phi.ObjectMetaId where arbitrary = Phi.ObjectMetaId . ("!b" ++) <$> arbitraryNonEmptyString @@ -107,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. -- @@ -142,6 +150,7 @@ bindingAttr = \case LambdaBinding{} -> Label "λ" MetaDeltaBinding{} -> Label "Δ" MetaBindings{} -> error "attempting to retrieve attribute of meta bindings" + b@AlphaBindingSugar{} -> errorExpectedDesugaredBinding b arbitraryBindings :: Gen [Binding] arbitraryBindings = @@ -330,14 +339,14 @@ 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") + , ("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 16134213e..fa1e17fe3 100644 --- a/eo-phi-normalizer/test/Language/EO/YamlSpec.hs +++ b/eo-phi-normalizer/test/Language/EO/YamlSpec.hs @@ -31,7 +31,7 @@ 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/yegor.yaml" , "test/eo/phi/rules/streams.yaml" ] diff --git a/eo-phi-normalizer/test/eo/phi/dataization.yaml b/eo-phi-normalizer/test/eo/phi/dataization.yaml index 3ca516121..1057b0e1f 100644 --- a/eo-phi-normalizer/test/eo/phi/dataization.yaml +++ b/eo-phi-normalizer/test/eo/phi/dataization.yaml @@ -24,33 +24,68 @@ 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.4/org/eolang/number.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | - {⟦ - c ↦ Φ.org.eolang.number( - as-bytes ↦ Φ.org.eolang.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" - 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.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 ↦ Φ.org.eolang.true) ⟧} + { + ⟦ + φ ↦ Φ̇.true.eq(α0 ↦ Φ̇.true) + ⟧ + } output: bytes: "01-" - 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 +93,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 +110,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 +131,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 +152,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 +173,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 +196,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 +215,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 +230,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,44 +259,68 @@ 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 ⟧ - - name: "ξ in application" + # 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: [] input: | - {⟦ x ↦ ⟦ a ↦ ∅ ⟧(a ↦ ξ.b), b ↦ ⟦ Δ ⤍ 01- ⟧ , λ ⤍ Package ⟧} - output: - object: | - ⟦ x ↦ ⟦ - a ↦ ⟦ - Δ ⤍ 01-, - ρ ↦ ⟦ - b ↦ ⟦ Δ ⤍ 01- ⟧, - x ↦ ⟦ a ↦ ∅ ⟧ (a ↦ ξ.b), - λ ⤍ Package - ⟧ - ⟧ + { + ⟦ + a ↦ ξ.b, + b ↦ ξ.c, + c ↦ ξ.d, + d ↦ ⟦ + Δ ⤍ 01- ⟧, - b ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ - - - name: "ξ chain" - dependencies: [] - input: | - {⟦ a ↦ ξ.b, b ↦ ξ.c, c ↦ ξ.d, d ↦ ⟦ Δ ⤍ 01- ⟧ , λ ⤍ Package ⟧} + } output: object: | ⟦ a ↦ ⟦ Δ ⤍ 01- ⟧, b ↦ ⟦ Δ ⤍ 01- ⟧, c ↦ ⟦ Δ ⤍ 01- ⟧, d ↦ ⟦ Δ ⤍ 01- ⟧, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference (1)" # dependencies: [] # input: | @@ -176,7 +329,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference (2)" # dependencies: [] # input: | @@ -185,7 +338,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (1)" # dependencies: [] # input: | @@ -194,7 +347,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (1)" # dependencies: [] # input: | @@ -203,7 +356,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (2)" # dependencies: [] # input: | @@ -212,7 +365,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "cross-reference + dispatch (3)" # dependencies: [] # input: | @@ -221,7 +374,7 @@ tests: # object: | # NOT ⟦ x ↦ ⊥, λ ⤍ Package ⟧ - # FIXME: fails + # TODO #636:30min fails # - name: "interleaving ρ and other dispatches" # dependencies: [] # input: | @@ -232,32 +385,41 @@ tests: - name: "Dataize in siblings of Package" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.4/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- ⟧ + ) + ) + ⟧, + z ↦ ⟦ + y ↦ ⟦ + x ↦ ∅, + φ ↦ ξ.x + ⟧, + φ ↦ Φ̇.bool( + Φ̇.bytes( + ⟦ Δ ⤍ 01- ⟧ + ) + ) ⟧, - φ ↦ Φ.org.eolang.bool( - α0 ↦ Φ.org.eolang.bytes(Δ ⤍ 01-) - ) + λ ⤍ Package ⟧, λ ⤍ Package ⟧, λ ⤍ Package - ⟧, - λ ⤍ Package - ⟧} + ⟧ + } output: object: | ⟦ @@ -275,210 +437,273 @@ 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.4/org/eolang/i64.phi + - ./data/0.49.4/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" - 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.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: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 06- ⟧, - x ↦ ⟦ Δ ⤍ 09- ⟧, - λ ⤍ Lorg_eolang_int_gt + { + ⟦ + φ ↦ ⟦ + ρ ↦ ⟦ + Δ ⤍ 06- + ⟧, + x ↦ ⟦ + Δ ⤍ 09- + ⟧, + λ ⤍ Lorg_eolang_int_gt + ⟧ ⟧ - ⟧} + } output: bytes: "00-" - # Missing int tests: div + # TODO #636:30min Missing int tests: div - name: "bitwise and" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.4/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" - name: "bitwise not" dependencies: - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.4/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" - name: "bytes size" dependencies: - - ./data/0.41.2/org/eolang/i64.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/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" - 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.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: | - {⟦ - φ ↦ ⟦ - ρ ↦ ⟦ Δ ⤍ 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-" - # 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: - - ./data/0.41.2/org/eolang/number.phi - - ./data/0.41.2/org/eolang/bytes.phi + - ./data/0.49.4/org/eolang/number.phi + - ./data/0.49.4/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" - 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.4/org/eolang/number.phi + - ./data/0.49.4/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" - # Missing float tests: gt, div + # TODO #636:30min Missing float tests: gt, div - 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.4/org/eolang/string.phi + - ./data/0.49.4/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\"" - 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.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/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\"" - 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.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/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 - 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.4/org/eolang/string.phi + - ./data/0.49.4/org/eolang/i64.phi + - ./data/0.49.4/org/eolang/bytes.phi input: | - {⟦ - φ ↦ ⟦ - ρ ↦ "Hello world", - λ ⤍ Lorg_eolang_string_length + { + ⟦ + φ ↦ ⟦ + ρ ↦ "Hello world", + λ ⤍ Lorg_eolang_string_length + ⟧ ⟧ - ⟧} + } 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/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 ↦ ⟦⟧ - ⟧ - () + ⟧() ⟧ } 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: | 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 diff --git a/package-lock.json b/package-lock.json index 4920cd377..d84c65fde 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.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.24.0", - "resolved": "https://registry.npmjs.org/eolang/-/eolang-0.24.0.tgz", - "integrity": "sha512-Uv+KGtC8VAGk8AgDBfbJmX6k2vbh51cfpo19iP+nxpm2wqZFYdwbQoHmzjW+Rbwu+TVAEZvnpinbGpjZWxGE4Q==", + "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", - "fast-xml-parser": "4.5.0", - "node": "23.2.0", + "eo2js": "0.0.8", + "fast-xml-parser": "4.5.1", + "node": "23.5.0", "relative": "3.0.2", "semver": "7.6.3", "sync-request": "6.1.0", @@ -237,9 +241,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": [ { @@ -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.2.0", - "resolved": "https://registry.npmjs.org/node/-/node-23.2.0.tgz", - "integrity": "sha512-o2LBqSz7WpETv9RP+E9pIELw5xpwYkCn7Dk+v+MoQMk3YxHUgOXr8R9XiyXJf6mEwfHwFrzjNm7YYeG2VEdasw==", + "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 106da4dc9..611013512 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eo-phi-normalizer", "devDependencies": { - "eolang": "^0.24.0", + "eolang": "^0.28.1", "prettier": "^3.2.5" } } diff --git a/pipeline/config.yaml b/pipeline/config.yaml index 7aaa03533..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 @@ -423,6 +427,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 +500,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 @@ -535,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 @@ -725,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 diff --git a/pipeline/pipeline.lock b/pipeline/pipeline.lock index 56d98e55c..7f3fefff0 100644 --- a/pipeline/pipeline.lock +++ b/pipeline/pipeline.lock @@ -1,2 +1,2 @@ -EO_HEAD_HASH="0757c993acee2fdd1cb8363b6d0191825091827b" -PIPELINE_CONFIG_HASH="7aaa035336af9dbe10610e01d7f8e305c5fb2adb" +EO_HEAD_HASH="27abe8befa33f8b1e64a89ffb90a015f150f4ec7" +PIPELINE_CONFIG_HASH="14a17f7ccb009770050834eb2f56d12e7052e296" diff --git a/scripts/lib.sh b/scripts/lib.sh index 600dde621..6abbe43ee 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" @@ -169,11 +169,11 @@ 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" + git commit -m "chore(ci): Update $updated_message" git push else echo "Nothing to commit."; @@ -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 --easy "$@" } export -f eo diff --git a/site/docs/src/eo-phi-normalizer/dataize.md b/site/docs/src/eo-phi-normalizer/dataize.md index 49496fbf7..227446c15 100644 --- a/site/docs/src/eo-phi-normalizer/dataize.md +++ b/site/docs/src/eo-phi-normalizer/dataize.md @@ -76,1213 +76,71 @@ 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 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` @@ -1299,122 +157,18 @@ 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 { ⟦ - 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 @@ -1429,19 +183,18 @@ 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 { ⟦ - 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 @@ -1454,19 +207,18 @@ 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 { ⟦ - 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 @@ -1479,122 +231,18 @@ 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 { ⟦ - 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/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..0b3cdf5be 100644 --- a/site/docs/src/eo-phi-normalizer/rewrite.md +++ b/site/docs/src/eo-phi-normalizer/rewrite.md @@ -53,27 +53,26 @@ 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 -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 @@ -103,21 +101,20 @@ 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 -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} @@ -190,17 +166,17 @@ 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 { - "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}" ] ] ] @@ -210,19 +186,18 @@ 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 { ⟦ - 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 @@ -233,21 +208,21 @@ 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 -{ ⟦ 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` ```$ 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 -"{\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} @@ -282,9 +257,9 @@ 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 -"{\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 161c83a5c..365def74f 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 - 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 bb18f72f8..91a86ae9c 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 @@ -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 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: