endojs / Jessie

Tiny subset of JavaScript for ocap-safe universal mobile code
Apache License 2.0
281 stars 16 forks source link

let and const are not keywords? #7

Closed dckc closed 2 years ago

dckc commented 6 years ago

Some experimentation suggests I don't really want to know what they are in EcmaScript, but in TinySES... shouldn't they just be keywords?

dtribble commented 6 years ago

It sounds like you are not running in strict mode

Sent from my phone

On Jun 28, 2018, at 9:33 PM, Dan Connolly notifications@github.com wrote:

Some experimentation suggests I don't really want to know what they are in EcmaScript, but in TinySES... shouldn't they just be keywords?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

dckc commented 6 years ago

Strict mode? I'm not running JS at all. I'm trying to read the TinySES grammar (and port it to scala).

erights commented 6 years ago

"const" is listed as a keyword at https://github.com/Agoric/TinySES/blob/92f6766a1a392b82f85f5d4dc89f53f73ce4dee9/src/tinyses.js#L58

On "let", I missed the note at http://www.ecma-international.org/ecma-262/8.0/#sec-keywords so I thought I could just start with the ES-grammar reserved words, except for the exceptions I knew about: "get" and "set". The other surprise mentioned in that note is "static", which should also be defined as reserved in TinySES.

Both "let" and "static" should be added to the RESERVED_WORD list at https://github.com/Agoric/TinySES/blob/92f6766a1a392b82f85f5d4dc89f53f73ce4dee9/src/tinyses.js#L51

Thanks for catching this!

dckc commented 6 years ago

Thanks for the spec pointers.

Overall, I'm struggling to understand how the bnf library handles keywords and IDENT. Care to elaborate a bit? how does RESERVED_WORD get into the mix? Perhaps add some in comments in the code, in order to promote TinySES to language implementors such as myself that are not steeped in JavaScript lore?