objectionary / eo

EOLANG, an Experimental Pure Object-Oriented Programming Language Based on 𝜑-calculus
https://www.eolang.org
MIT License
940 stars 122 forks source link

Can't convert EO example in the README to PHI #3228

Closed deemp closed 2 weeks ago

deemp commented 2 weeks ago

@maxonfjvipon, @yegor256

Problem

I can't convert the multiplication table example to PHI.

https://github.com/objectionary/eo/blob/c66f07f9ce5ead0b95003a387d6390ba93aaf369/README.md?plain=1#L150-L168

Command

mkdir try-phi

cd try-phi

cat <<EOF > example.eo
[args...] > app
  memory 0 > x
  seq > @
    *
      x.write 2
      while.
        x.lt 6
        [i]
          seq > @
            *
              QQ.io.stdout
                QQ.txt.sprintf
                  "%d x %d = %d\n"
                  x
                  x
                  x.times x
              x.write
                x.plus 1
    true
EOF

eoc --parser=0.38.0 phi

Error

EO objects registered in .eoc/eo-foreign.json
Assembling into .eoc
EO program assembled in .eoc
[ERROR] net.sf.saxon.style.XSLMessage@7e967df3: Critical error identified:
  /home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/example.eo, 1: [1:5] no viable alternative at input '[args.': "[args...] &gt; app";
[ERROR] #fatalError(): Processing terminated by xsl:message at line 31 in fail-on-critical.xsl; SystemID: file:///org/eolang/parser/fail-on-critical.xsl; Line#: 31; Column#: 34
[ERROR] Processing terminated by xsl:message at line 31 in fail-on-critical.xsl
[ERROR] Failed to execute goal org.eolang:eo-maven-plugin:0.38.3:xmir-to-phi (default-cli) on project eoc: 'org.eolang.maven.PhiMojo@656922a0' execution failed: java.io.UncheckedIOException: java.io.IOException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Failed to transform by net.sf.saxon.jaxp.TransformerImpl: Processing terminated by xsl:message at line 31 in fail-on-critical.xsl; SystemID: file:///org/eolang/parser/fail-on-critical.xsl; Line#: 31; Column#: 34 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The command "/home/eyjafjallajokull/Desktop/gh/normalizer/node_modules/eolang/mvnw/mvnw eo:xmir-to-phi -Deo.version=0.38.3 -Deo.tag=0.38.3 --quiet -Deo.sourcesDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi -Deo.targetDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc -Deo.outputDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc/classes -Deo.generatedDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc/generated-sources -Deo.placed=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc/eo-placed.csv -Deo.placedFormat=csv -Deo.phiInputDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc/2-optimize -Deo.phiOutputDir=/home/eyjafjallajokull/Desktop/gh/normalizer/try-phi/try-phi/.eoc/phi --batch-mode --color=never --update-snapshots --fail-fast --strict-checksums" exited with #1 code
github-actions[bot] commented 2 weeks ago

@deemp thanks for the report, here is a feedback:

Problems

I would recommend making the title more descriptive, such as "Error Converting EO Multiplication Table Example to PHI in README".

Please fix the bug report in order it to get resolved faster. Analyzed with gpt-4

yegor256 commented 2 weeks ago

@deemp this snippet is no longer valid. @maxonfjvipon can you please suggest an updated one?

maxonfjvipon commented 2 weeks ago

@yegor256 there's no way we can print a number to console because of sprintf which does not work

maxonfjvipon commented 2 weeks ago

@deemp valid example should look like this but srprintf does not work for now

# 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
deemp commented 2 weeks ago

@maxonfjvipon, thanks, it works.