You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am develping a c++ parser and evaluator for CQL2 using bison. https://github.com/IndoorSpatial/cql2cpp
When I handling the arrayPredicate, the bison prints some warnings about reduce/reduce conflicts and shift/reduce conflict.
After I go thourgh the whole bison rules file and the BNF file in the standard. I found the reason.
TRUE -> booleanLiteral -> booleanPrimary -> booleanFactor -> booleanTerm -> booleanExpression
(TRUE) -> ( booleanExpression ) -> booleanPrimary -> booleanFactor -> booleanTerm -> booleanExpression
so the (TRUE) and (FALSE) are boolExpression. basically, Example 2 equals to Example 1 and the evaluation result should be TRUE.
the "(TRUE)" and "(FALSE)" is another array. So the evaluation result should be NULL or error.
I think the reason is, we use "( )" for both booleanExpression and array.
Let's say if we use "( )" for booleanExpression and "[ ]" for array, it is easy to handle it in my parser.
for example of Option1
The text was updated successfully, but these errors were encountered:
kunlinyu
changed the title
Conflict when we use "(" boolExpression ")" in an array
Conflict between "(" booleanExpression ")" and "(" arrayElement ")"
Dec 31, 2024
kunlinyu
changed the title
Conflict between "(" booleanExpression ")" and "(" arrayElement ")"
CQL2 grammar rules Conflict between "(" booleanExpression ")" and "(" arrayElement ")"
Dec 31, 2024
@kunlinyu I seem to recall a discussion in the SWG about using "[]" for arrays but I am not sure why we did not do that. Let me go back and check about that. Also, I'll try the grammar with YACC too, just to verify that it complains as well. Please stand by ...
I am develping a c++ parser and evaluator for CQL2 using bison. https://github.com/IndoorSpatial/cql2cpp
When I handling the arrayPredicate, the bison prints some warnings about reduce/reduce conflicts and shift/reduce conflict.
After I go thourgh the whole bison rules file and the BNF file in the standard. I found the reason.
Example 1 consider this query:
apperently the evaluation result should be TRUE.
Example 2 But consider about this query:
The parser will be confused: what is the type of array elements in the second array?
Option 1
according to BNF:
TRUE -> booleanLiteral -> booleanPrimary -> booleanFactor -> booleanTerm -> booleanExpression
(TRUE) -> ( booleanExpression ) -> booleanPrimary -> booleanFactor -> booleanTerm -> booleanExpression
so the (TRUE) and (FALSE) are boolExpression. basically, Example 2 equals to Example 1 and the evaluation result should be TRUE.
Option 2
according to BNF:
the "(TRUE)" and "(FALSE)" is another array. So the evaluation result should be NULL or error.
I think the reason is, we use "( )" for both booleanExpression and array.
Let's say if we use "( )" for booleanExpression and "[ ]" for array, it is easy to handle it in my parser.
for example of Option1
for example of Option2
The text was updated successfully, but these errors were encountered: