hpi-swa / Ohm-S

A Squeak/Smalltalk implementation of the metaprogramming framework Ohm.
MIT License
24 stars 8 forks source link

BinaryCascade in latest fix #49

Closed Paula-Kli closed 4 years ago

Paula-Kli commented 4 years ago

In the latest commit from 07.07.2020 binary cascades are again matched as operand cascades.

We tried matching 1 + 2 negated; negated which was in the commit from 06.07.2020 matched as binaryCascade and in the commit from 07.07.2020 it is matched as operandCascade from OhmExplicitSendsSmalltalk.

codeZeilen commented 4 years ago

I looked into it and currently I think that this is actually correct to parse it as a binary cascade:

1 + 5 negated; negated
"corresponds to"
1
  + 5 negated;
  negated
"print it ->"
-1

Which is different from the unary message cascade case:

self new test; test
"corresponds to"
self new
  test;
  test
Paula-Kli commented 4 years ago

Yes and in your commit from 06.07. this works perfectly fine.

But in your updated version inspecting the cst I get this result:

grafik

I am starting to parse at the Rule Expression but this shouldn't make a difference right?

codeZeilen commented 4 years ago

Ah oops. I meant it is correct to parse it as an OperandCascade. The receiver of the #+ is the 1, the argument is 5 negated. Does it make a great difference for printing?

Paula-Kli commented 4 years ago

Ah ok I see! Thanks for clarifying that! I think we will ask our customer about it ;)

What is a binaryCascade then?

codeZeilen commented 4 years ago

An example for a binary cascade would be:

1 + 2 
  raised to: 10;
  yourself

In this case the receiver is the BinaryMessageSend 1 + 2.

Paula-Kli commented 4 years ago

Ah alright!

Thanks a lot!! That explains it! In that case it works fine ;)