Open deemp opened 4 months ago
Commands (using the correct program - see https://github.com/objectionary/eo/issues/3228#issuecomment-2167502794):
mkdir try-phi
cd try-phi
cat <<EOF > example.eo
# Some comment here.
[] > app
malloc.for > @
2
[m]
while > @
m.as-int.lt 6 > [i] >>
[i] >>
seq > @
*
QQ.io.stdout
QQ.txt.sprintf
*
"%d x %d = %d\n"
m.as-int > num
num
num.times num
m.write
0
num.plus 1
EOF
npx eoc --parser=0.38.0 phi
example.phi
:
{
⟦
app ↦ ⟦
φ ↦ Φ.org.eolang.malloc.for(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 00-00-00-00-00-00-00-02
)
),
α1 ↦ ⟦
m ↦ ∅,
φ ↦ Φ.org.eolang.while(
α0 ↦ ξ.auto-named-attr-at-7-27,
α1 ↦ ξ.auto-named-attr-at-8-11
),
auto-named-attr-at-7-27 ↦ ⟦
φ ↦ ξ.ρ.m.as-int.lt(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 00-00-00-00-00-00-00-06
)
)
),
i ↦ ∅
⟧,
auto-named-attr-at-8-11 ↦ ⟦
i ↦ ∅,
φ ↦ Φ.org.eolang.seq(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple.empty,
α1 ↦ Φ.org.eolang.io.stdout(
α0 ↦ Φ.org.eolang.txt.sprintf(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple(
α0 ↦ Φ.org.eolang.tuple.empty,
α1 ↦ Φ.org.eolang.string(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 25-64-20-78-20-25-64-20-3D-20-25-64-0A
)
)
),
α1 ↦ ξ.num
),
α1 ↦ ξ.num
),
α1 ↦ ξ.num.times(
α0 ↦ ξ.num
)
)
)
)
),
α1 ↦ ξ.ρ.m.write(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 00-00-00-00-00-00-00-00
)
),
α1 ↦ ξ.num.plus(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 00-00-00-00-00-00-00-01
)
)
)
)
)
),
num ↦ ξ.ρ.m.as-int
⟧
⟧
)
⟧
⟧
}
--minimize-stuck-terms
disabledProgram ran too long. I didn't wait for the termination.
--minimize-stuck-terms
enablednormalizer dataize \
--minimize-stuck-terms \
--as-package \
--recursive \
--dependency-file .eoc/phi/org/eolang/string.phi --dependency-file .eoc/phi/org/eolang/dataized.phi --dependency-file .eoc/phi/org/eolang/nan.phi --dependency-file .eoc/phi/org/eolang/as-phi.phi --dependency-file .eoc/phi/org/eolang/positive-infinity.phi --dependency-file .eoc/phi/org/eolang/switch.phi --dependency-file .eoc/phi/org/eolang/go.phi --dependency-file .eoc/phi/org/eolang/true.phi --dependency-file .eoc/phi/org/eolang/cage.phi --dependency-file .eoc/phi/org/eolang/rust.phi --dependency-file .eoc/phi/org/eolang/cti.phi --dependency-file .eoc/phi/org/eolang/negative-infinity.phi --dependency-file .eoc/phi/org/eolang/bytes.phi --dependency-file .eoc/phi/org/eolang/seq.phi --dependency-file .eoc/phi/org/eolang/io/stdin.phi --dependency-file .eoc/phi/org/eolang/io/stdout.phi --dependency-file .eoc/phi/org/eolang/malloc.phi --dependency-file .eoc/phi/org/eolang/float.phi --dependency-file .eoc/phi/org/eolang/while.phi --dependency-file .eoc/phi/org/eolang/error.phi --dependency-file .eoc/phi/org/eolang/tuple.phi --dependency-file .eoc/phi/org/eolang/try.phi --dependency-file .eoc/phi/org/eolang/int.phi --dependency-file .eoc/phi/org/eolang/false.phi \
.eoc/phi/example.phi
{⟦
app ↦ ⟦
φ ↦ Φ.org.eolang.malloc.for (α0 ↦ Φ.org.eolang.int (α0 ↦ Φ.org.eolang.bytes (Δ ⤍ 00-00-00-00-00-00-00-02)),
α1 ↦ ⟦
m ↦ ∅, φ ↦ Φ.org.eolang.while (α0 ↦ ξ.auto-named-attr-at-7-27, α1 ↦ ξ.auto-named-attr-at-8-11),
auto-named-attr-at-7-27 ↦ ⟦
φ ↦ ξ.ρ.m.as-int.lt (α0 ↦ Φ.org.eolang.int (α0 ↦ Φ.org.eolang.bytes (Δ ⤍ 00-00-00-00-00-00-00-06))),
i ↦ ∅
⟧,
auto-named-attr-at-8-11 ↦ ⟦
i ↦ ∅, φ ↦ Φ.org.eolang.seq (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple.empty, α1 ↦ Φ.org.eolang.io.stdout (α0 ↦ Φ.org.eolang.txt.sprintf (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple (α0 ↦ Φ.org.eolang.tuple.empty, α1 ↦ Φ.org.eolang.string (α0 ↦ Φ.org.eolang.bytes (Δ ⤍ 25-64-20-78-20-25-64-20-3D-20-25-64-0A))),
α1 ↦ ξ.num),
α1 ↦ ξ.num),
α1 ↦ ξ.num.times (α0 ↦ ξ.num))))),
α1 ↦ ξ.ρ.m.write (α0 ↦ Φ.org.eolang.int (α0 ↦ Φ.org.eolang.bytes (Δ ⤍ 00-00-00-00-00-00-00-00)),
α1 ↦ ξ.num.plus (α0 ↦ Φ.org.eolang.int (α0 ↦ Φ.org.eolang.bytes (Δ ⤍ 00-00-00-00-00-00-00-01)))))),
num ↦ ξ.ρ.m.as-int
⟧
⟧
)
⟧
⟧}
@fizruk, normalizer hangs.
many-wrappers.eo
# Input.
[] > input /?
# Pass.
[x] > pass
x.gt 18 > @
# Rject.
[] > reject
QQ.io.stdout > @
"Sorry, no"
# Accept.
[] > accept
QQ.io.stdout > @
"You are welcome!"
# Gate.
[p left right] > gate
p.if > @
left
right
# App.
[] > app
gate > @
pass input
accept
reject
command (see https://github.com/objectionary/normalizer/issues/404#issuecomment-2169248415)
npx eoc phi --parser=0.38.4 --home-tag=0.38.2
.eoc/phi/many-wrappers.phi
{
⟦
input ↦ ⟦
λ ⤍ Linput
⟧,
pass ↦ ⟦
x ↦ ∅,
φ ↦ ξ.x.gt(
α0 ↦ Φ.org.eolang.int(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 00-00-00-00-00-00-00-12
)
)
)
⟧,
reject ↦ ⟦
φ ↦ Φ.org.eolang.io.stdout(
α0 ↦ Φ.org.eolang.string(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 53-6F-72-72-79-2C-20-6E-6F
)
)
)
⟧,
accept ↦ ⟦
φ ↦ Φ.org.eolang.io.stdout(
α0 ↦ Φ.org.eolang.string(
α0 ↦ Φ.org.eolang.bytes(
Δ ⤍ 59-6F-75-20-61-72-65-20-77-65-6C-63-6F-6D-65-21
)
)
)
⟧,
gate ↦ ⟦
p ↦ ∅,
left ↦ ∅,
right ↦ ∅,
φ ↦ ξ.p.if(
α0 ↦ ξ.left,
α1 ↦ ξ.right
)
⟧,
app ↦ ⟦
φ ↦ ξ.ρ.gate(
α0 ↦ ξ.ρ.pass(
α0 ↦ ξ.ρ.input
),
α1 ↦ ξ.ρ.accept,
α2 ↦ ξ.ρ.reject
)
⟧
⟧
}
command to normalize
normalizer dataize --minimize-stuck-terms --as-package --recursive --dependency-file .eoc/phi/org/eolang/string.phi --dependency-file .eoc/phi/org/eolang/dataized.phi --dependency-file .eoc/phi/org/eolang/nan.phi --dependency-file .eoc/phi/org/eolang/as-phi.phi --dependency-file .eoc/phi/org/eolang/positive-infinity.phi --dependency-file .eoc/phi/org/eolang/switch.phi --dependency-file .eoc/phi/org/eolang/go.phi --dependency-file .eoc/phi/org/eolang/true.phi --dependency-file .eoc/phi/org/eolang/cage.phi --dependency-file .eoc/phi/org/eolang/rust.phi --dependency-file .eoc/phi/org/eolang/cti.phi --dependency-file .eoc/phi/org/eolang/negative-infinity.phi --dependency-file .eoc/phi/org/eolang/bytes.phi --dependency-file .eoc/phi/org/eolang/seq.phi --dependency-file .eoc/phi/org/eolang/io/stdin.phi --dependency-file .eoc/phi/org/eolang/io/stdout.phi --dependency-file .eoc/phi/org/eolang/malloc.phi --dependency-file .eoc/phi/org/eolang/float.phi --dependency-file .eoc/phi/org/eolang/while.phi --dependency-file .eoc/phi/org/eolang/error.phi --dependency-file .eoc/phi/org/eolang/tuple.phi --dependency-file .eoc/phi/org/eolang/try.phi --dependency-file .eoc/phi/org/eolang/int.phi --dependency-file .eoc/phi/org/eolang/false.phi .eoc/phi/many-wrappers.phi
Result: requires a lot of memory and hangs
We need to show that not normalizing inside atoms won't improve metrics.
Use the multiplication table example (link) (blocked on https://github.com/objectionary/eo/issues/3228)
Run
normalizer dataize
like in the pipeline (link), but without--minimize-stuck-terms
.Blocked on: