ADQL: Bitwise operators

Dave Morris dave.morris at metagrid.co.uk
Tue Feb 20 04:07:35 CET 2018


Hi Markus, DAL et al,

On 2018-02-14 15:09, Markus Demleitner wrote:
> 
> The right way to deal with this would to have term and bitwise on two
> different levels.  Inspecting the C precendence table as well as
> postgres' behaviour, bitwise operators ought to bind less strongly
> than + and -.  This would mean that <bitwise_expression> has to go
> from <numeric_value_expression> and is used whereever right now we
> have <numeric_value_expression>.  And then <bitwise_expression> would
> have <numeric_value_expression> as its first alternative.
> 

What if we replace this :

     -   <bitwise_expression> ::=
     -       <bitwise_not> <numeric_value_expression>
     -       | <numeric_value_expression> <bitwise_and> 
<numeric_value_expression>
     -       | <numeric_value_expression> <bitwise_or>  
<numeric_value_expression>
     -       | <numeric_value_expression> <bitwise_xor> 
<numeric_value_expression>

     -   <numeric_value_expression> ::=
     -       <term>
     -     | <bitwise_expression>
     -     | <numeric_value_expression> <plus_sign> <term>
     -     | <numeric_value_expression> <minus_sign> <term>

With this :

     +   <numeric_value_expression> ::=
     +       <numeric_term_expression>
     +     | <bitwise_not> <numeric_value_expression>
     +     | <numeric_value_expression> <bitwise_and> 
<numeric_term_expression>
     +     | <numeric_value_expression> <bitwise_or>  
<numeric_term_expression>
     +     | <numeric_value_expression> <bitwise_xor> 
<numeric_term_expression>

     +   <numeric_term_expression> ::=
     +       <term>
     +     | <numeric_term_expression> <plus_sign> <term>
     +     | <numeric_term_expression> <minus_sign> <term>

Basically, rather than making 'bitwise_expression' the top of the tree, 
moving the name 'numeric_value_expression' up one level, to include what 
was in 'bitwise_expression', and then create a new name 
'numeric_term_expression' to represent what was in the original 
'numeric_value_expression'.

Does that solve the problem without costing too much ?

Regards,
Dave

--------
Dave Morris
Research Software Engineer
Wide Field Astronomy Unit
Institute for Astronomy
University of Edinburgh
--------


More information about the dal mailing list