Skip to content

Operator Precedence #2

@TCGV

Description

@TCGV

First of all, great work, I really liked your approach for parsing Boolean expressions. Now to the issue...

It seems your implementation doesn't deal with operator precedence like most expression evaluators do.

For instance, if you eval this expression in JavaScript: true || false && false it yields true

However, the same expression yields false in your implementation.

Making it short, your solution treats the expression as (true || false) && false while JavaScript treat it as true || (false && false).

Here is the JavaScript reference for Operator Precedence: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Operator_Precedence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions