Giter Club home page Giter Club logo

Comments (4)

Hywan avatar Hywan commented on August 25, 2024

Hello and thank you for the detailed bug report!

Here is my try:

$ hoa compiler:pp hoa://Library/Ruler/Grammar.pp <( echo 'a and b or c' ) -v dump
>  #expression
>  >  #and
>  >  >  token(identifier, a)
>  >  >  #or
>  >  >  >  token(identifier, b)
>  >  >  >  token(identifier, c)

I guess the tree should look like this:

$ hoa compiler:pp hoa://Library/Ruler/Grammar.pp <( echo '(a and b) or c' ) -v dump
>  #expression
>  >  #or
>  >  >  #and
>  >  >  >  token(identifier, a)
>  >  >  >  token(identifier, b)
>  >  >  token(identifier, c)

So in our implementation, logical operators are right-associatives, whilst they are commonly left-associatives.

from ruler.

Pittiplatsch avatar Pittiplatsch commented on August 25, 2024

Thank you for your reply.

In my eyes the problem isn't a question about left- or right-assiociatives. You can see that if you include my $rule3 in your inspections.

Either way (left- or right-assiociating), $rule2 and $rule3 will yield complementary results whilst they should be identical!

IMO operators must be set in relation to each other to achieve precedence. However I understand that with the current architecture this is far away from trivial.

Actually, I stumbled along this issue will thinking about how to implement new operators + and *, which need the same precedence...

from ruler.

Hywan avatar Hywan commented on August 25, 2024

@Pittiplatsch I am really really really sorry for the too late reply… I have finally time to work back on issues on Hoa. Excuse me. A PR has been proposed, see #107 please. Your feedback is valuable.

from ruler.

Pittiplatsch avatar Pittiplatsch commented on August 25, 2024

I'm still unsure about the right vs. left association thingy...
However, dividing the grammar into separate OR / AND pieces looks reasonable, as does your unit test, which exactly mirrors my test cases.
Thank you for fixing :-)

from ruler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.