drom / wast-spec

WebAssembly AST specification
MIT License
9 stars 2 forks source link

identifier id -> string? #8

Open wanderer opened 8 years ago

wanderer commented 8 years ago

so it might be a little bit more consistent if we went from identifier.id to identifier.string and change literal.raw to literal.string

wanderer commented 8 years ago

or both to raw?

drom commented 8 years ago

This naming originates from Mozilla AST:

{ kind: 'identifier', name: 'a' }
{ kind: 'literal', value: 5, raw: '5' }
{ kind: 'literal', value: 'x', raw: '"x"' }

You can try it in https://astexplorer.net by typing: [a, 5, "x"]

Shift-AST makes explicit distinction between literal kinds, keeps name and value, looses raw

"IdentifierExpression"
"LiteralNumericExpression"
"LiteralStringExpression"

Sometimes it is convenient, sometimes not. We should think more. Especially that we have i64 literals ... that we keep as a strings.