Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try To Use Canonical Notation #709

Closed
volodya-lombrozo opened this issue Sep 17, 2024 · 2 comments
Closed

Try To Use Canonical Notation #709

volodya-lombrozo opened this issue Sep 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@volodya-lombrozo
Copy link
Member

This issue comes from this comment:

@volodya-lombrozo first of all, as Yegor said above there is no such object seq in global scope. All object FQNs start with either Q or $. Here Q - global scope, $ - scope of current abstract object. So seq anyway will get a prefix org.eolang or Q.org.eolang. So you simple object seq is converted to the sequence of dispatches (method calls) Q.org.eolang.seq.

Globally, There are 2 different notations for dispatching, which are used in EO:

  1. Direct
# horizontal 
org.eolang.seq 

# OR 
Q.org.eolang.seq

# OR
$.instructions

# OR vertical
org
.eolang
.seq

# OR
Q
.org
.eolang
.seq

# OR
$
.instructions

In XMIR it may look like:

<o base="org.eolang.seq"/>
// OR
<o base="Q.org.eolang.seq"/>
// OR
<o base="Q"/>
<o base=".org" method=""/>
<o base=".eolang" method=""/>
<o base=".seq" method=""/>
// OR
<o base="$"/>
<o base=".instructions" method=""/>

At the level of XMIR such notation is not canonical and during optimize it will be transformed into the second one.

  1. Reversed
seq.
  eolang.
    org

# OR
seq.
  eolang.
    org.
      Q

# OR
instructions.
  $

It works the same as direct notation but it looks like the sequence of applications. At the level of EO every object that is used as method ENDS with dot.

In XMIR it look like:

<o base=".seq">
  <o base=".eolang">
    <o base=".org">
      <o base="Q"/>
    </o>
  </o>
</o>
// OR
<o base=".seq">
  <o base=".eolang">
    <o base="org"/>
  </o>
</o>
// OR
<o base=".instructions">
  <o base="$"/>
</o>

Here all objects that are used as methods STARTS with dot. Such notation is canonical. All XMIRs returned by unphi 100% are in reversed notation. So if you teach JEO to generate/understand XMIR in such notation - you'll succeed

So we should try to apply this "canonical" notation. It is reversed and we don't have any specification on it, so there might be some problems.

@volodya-lombrozo
Copy link
Member Author

btw, it is also important:

@volodya-lombrozo So this it how JEO should print in order to not get into a trouble:

<o base=".seq48">
  <o base=".eolang">
    <o base=".org">
      <o base="Q"/>
    </o>
  </o>
  <o base="opcode" line="1913064591"/>
  <o base="opcode" line="1913064591"/>
  <o base="opcode" line="1913064591"/>
  <o base="opcode" line="1913064591"/>
  ...
</o>

@volodya-lombrozo volodya-lombrozo self-assigned this Sep 17, 2024
@volodya-lombrozo volodya-lombrozo added the bug Something isn't working label Sep 17, 2024
@volodya-lombrozo
Copy link
Member Author

After face-to-face discussion we decided to solve this problem differently: #710

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant