grammarkdown | like DSL for defining grammatical syntax | Code Quality library
kandi X-RAY | grammarkdown Summary
kandi X-RAY | grammarkdown Summary
grammarkdown is a markdown-style parser for syntactic grammars, designed to make it easily to rapidly prototype a grammar and statically verify its consistency. The grammar supported by grammarkdown is based on the parametric grammar used by ECMA-262 (the JavaScript language standard).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of grammarkdown
grammarkdown Key Features
grammarkdown Examples and Code Snippets
Community Discussions
Trending Discussions on grammarkdown
QUESTION
The Javascript grammar allows an assignment expression (AssignmentExpression
) to be used in a computed property name (ComputedPropertyName
) (see 12.2.6 Object Initializer or ES 2015 Grammarkdown):
ANSWER
Answered 2019-Dec-18 at 00:40Basically, it is the reverse of your first thought. There is no need to special-case the kind of expression allowed inside a ComputedPropertyName
, so the language designers chose to use the "normal" expression, which is an AssignmentExpression
.
If you look through the EcmaScript grammar, you will see that the only place where ConditionalExpression
is used is in the definition of AssignmentExpression
. In this respect, it is similar to all the other expression sub-syntaxes defined in the grammar before AssignmentExpression
, which are present only to define the operator-precedence order of the grammar. (A practical parser based on operator precedence parsing might not even have anything which corresponds to these various non-terminals.)
Basically, aside from defining operator precedence, there are only two expression non-terminals used in the grammar: AssignmentExpression
and Expression
. The difference has to do with the unfortunate C legacy of the comma operator (which evaluates and then forgets its first argument). Expression
is used in contexts in which the comma operator is permitted:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install grammarkdown
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page