Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primary-expression and assignment-expression not being used #248

Open
dende opened this issue Feb 3, 2021 · 2 comments
Open

primary-expression and assignment-expression not being used #248

dende opened this issue Feb 3, 2021 · 2 comments

Comments

@dende
Copy link

dende commented Feb 3, 2021

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?

@nikic
Copy link
Member

nikic commented Feb 3, 2021

primary-expression is used in clone-expression: https://github.com/php/php-langspec/blob/master/spec/19-grammar.md#grammar-clone-expression

@dende
Copy link
Author

dende commented Feb 3, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants