php/php-langspec

primary-expression and assignment-expression not being used

dende opened this issue · 2 comments

dende commented

It might be, that I'm missing something, because formal language definition is somewhat new to me, but right now it seems to me, that a statement can never generate a simple expression like $v = 1.

A statement can generate an expression statement, which can generate an expression.

expression-statement:
   expressionopt   ;

But I can't find any way to generate a primary-expression or an assignment-expression out of an expression. When searching the repository for the terms, I can only find their definitions, not any usages of them: repository search for 'primary-expression'

What am I missing here?

dende commented

I see, and i can follow that chain even to assignment-expression and simple-assignemnt-expression. Thank you!

But I don't seem to find a way to generate an assignment from an expression-statement.

All of expression's child rules

   include-expression
   include-once-expression
   require-expression
   require-once-expression

have their keywords "hardcoded" into them.

I see the chain from expression over logical-inc-OR-expression-2 to yield-expression, but can not find a way to generate an assignment-expression without the keywords yield or yield from before it