According to the ECMAScript specification in section 7.8.1 a NullLiteral is defined as follows:
NullLiteral ::
null
What I am trying to understand is how this is represented in tree form when a NullLiteral is included in the following productions found in sections 7.6.1 and 7.8.
ReservedWord ::
Keyword
FutureReservedWord
NullLiteral
BooleanLiteral
Literal ::
NullLiteral
BooleanLiteral
NumericLiteral
StringLiteral
My best guess as to how it would look is this:
InputElementDiv
|
Token
|
IdentifierName
|
ReservedWord
|
Literal
|
NullLiteral
|
null
This just does not seem right to me though.
Note
From my research it seems that very few compilers actually generate CSTs from the language grammar. I can of course understand why but this is a learning exercise for me so I want to get this right before I move to more professional means of parsing such as using a parser generator.