?? use model

Is your capability/feature request related to a problem?

Why does ?? usage require ()?

Lets take the example first:

  procedure WaitForClock ( signal Clk : in std_logic ;  signal Enable : in boolean ; constant ClkActive : in std_logic := CLK_ACTIVE) is
  begin
    wait on Clk until (??(Clk ?= ClkActive)) and Enable ;
  end procedure WaitForClock ;

Simplifying it to the following is an error: wait on Clk until ??(Clk ?= ClkActive) and Enable ;

This is due to the syntax defintion:

expression ::=
    condition_operator primary
    | logical_expression
logical_expression ::=
    relation { and relation }
    | relation { or relation }
    | relation { xor relation }
    | relation [ nand relation ]
    | relation [ nor relation ]
    | relation { xnor relation }
relation ::=
    shift_expression [ relational_operator shift_expression ]
shift_expression ::=
    simple_expression [ shift_operator simple_expression ]
simple_expression ::=
    [ sign ] term { adding_operator term }
term ::=
    factor { multiplying_operator factor }
factor ::=
    primary [ ** primary ]
    | abs primary
    | not primary
    | logical_operator primary
primary ::=
    name
    | literal
    | aggregate
    | function_call
    | qualified_expression
    | type_conversion
    | allocator
    | ( expression )

Describe the solution you'd like

I think it is reasonable to write: wait on Clk until ??(Clk ?= ClkActive) and Enable ;

However I expect that some of the complexity is the result of the condition operator being implicitly implied in the condition of an if statement and friends.

I think this can be done by moving condition_operator from expression to factor to:

factor ::=
    primary [ ** primary ]
    | abs primary
    | not primary
    | logical_operator primary
    | condition_operator primary

Maybe that means a condition has to be the following. However, I don't think this adds anything to the above - I think it may add a loop of some sort.

condition ::=
    condition_operator primary
    | logical_expression 

Describe alternatives you've considered

I suppose the other direction to go is to make the following legal: wait on Clk until (?? Clk ?= ClkActive) and Enable ;

This is more ugly, but would only require a minor BNF update.

Other remarks

I rarely use ??, so I am not sure if it is worth the effort. So my alternative is do nothing and live with the annoying extra parens.

Edited by JimLewis