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

J@EO & Polystat compatibility. Expressions #26

Open
someilay opened this issue May 27, 2022 · 0 comments
Open

J@EO & Polystat compatibility. Expressions #26

someilay opened this issue May 27, 2022 · 0 comments

Comments

@someilay
Copy link

Expressions

Supported all ariphmetic expressions with +, -, ++, --, (, ), *, / (without implicit casting):

Java:

a + b - c * (d / e++);

Eo:

seq > @
  s2145970759
[] > s2145970759
  b992768706.sub > @
    b1226204845
[] > b992768706
  s_r393040818.add > @
    s_r158453976
[] > s_r393040818
  a > @
[] > s_r158453976
  b > @
[] > b1226204845
  s_r1368594774.mul > @
    p1658926803
[] > s_r1368594774
  c > @
[] > p1658926803
  b210652080 > @
[] > b210652080
  s_r1652149987.div > @
    u_post1107730949
[] > s_r1652149987
  d > @
[] > u_post1107730949
  s_r700072760.inc_post > @
[] > s_r700072760
  e > @

Notice: all calculations has runtime support as calculation on Java long and Java double respectively.

Method calls. All calls are supposed to be non-static until callee is not class itself:

Java:

a.b.c.d(e, f, g);
...
String.valueOf(1);

Eo:

seq > @
  s1906808037
[] > s1906808037
  a.b.c.d > @
    a.b.c
    s_r1048027629
    s_r1073533248
    s_r599491651
[] > s_r1048027629
  e > @
[] > s_r1073533248
  f > @
[] > s_r599491651
  g > @
...
seq > @
  s912011468
[] > s912011468
  class__String.valueOf > @
    l11902257
[] > l11902257
  prim__int.constructor_2 > @
    prim__int.new
    1

Any cast to int:

Java:

(int) 1.0;

Eo:

seq > @
  s852445367
[] > s852445367
  prim__int.from > @
    l2142080121
[] > l2142080121
  prim__float.constructor_2 > @
    prim__float.new
    1.0

Ternary is not supported, but for converting boolean to int use cast:

Java:

(int) true;

Field access (any access to object attribute should start from this):

Java:

a.b.c.d;

Eo:

seq > @
  s912011468
[] > s912011468
  f_a1308109015.d > @
[] > f_a1308109015
  f_a11902257.c > @
[] > f_a11902257
  s_r1660794022.b > @
[] > s_r1660794022
  a > @

Instance creation, if there is only one defined constructor:

Java:

new A(b, c, d);

Eo:

seq > @
  s770911223
[] > s770911223
  class__A.constructor > @
    class__A.new
    s_r1890187342
    s_r19986569
    s_r294184992
[] > s_r1890187342
  b > @
[] > s_r19986569
  c > @
[] > s_r294184992
  d > @

Array creation with array initializer:

int[] a; // Supported
int a[]; // Unsupported
int[] a = {1}; // Unsupported
int[] a = new int[1]; // Unsupported

Java:

int[] a = {1, 2, 3};

Eo:

seq > @
  d673186785
cage > a
[] > d673186785
  a.write > @
    i_a1906808037
[] > i_a1906808037
  * > @
    i_s1983025922
    i_s1579526446
    i_s1308109015
[] > i_s1983025922
  l11902257 > @
[] > l11902257
  prim__int.constructor_2 > @
    prim__int.new
    1
[] > i_s1579526446
  l599491651 > @
[] > l599491651
  prim__int.constructor_2 > @
    prim__int.new
    2
[] > i_s1308109015
  l293002476 > @
[] > l293002476
  prim__int.constructor_2 > @
    prim__int.new
    3

Array access:

Java:

a[0][0];

Eo:

seq > @
  s1795960102
[] > s1795960102
  a_a1669712678.get > @
    l943081537.v
[] > a_a1669712678
  s_r683962652.get > @
    l1500608548.v
[] > s_r683962652
  a > @
[] > l1500608548
  prim__int.constructor_2 > @
    prim__int.new
    0
[] > l943081537
  prim__int.constructor_2 > @
    prim__int.new
    0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant