munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.75k stars 1.03k forks source link

Flag how variable names cannot start with reserved words #981

Closed savarin closed 3 years ago

savarin commented 3 years ago

In Section 4.7 Reserved Words and Identifiers, it might be worth pointing out that it's not possible to have variable names starting with reserved keywords. For example, the word "orchid" can't be used as a variable name because it starts with the reserved keyword "or" (i.e. the maximal munch doesn't look for a space after). Not an error per se but thought it would be useful to flag.

While I'm here, thank you thank you @munificent for writing this book - I've learned a lot!

savarin commented 3 years ago

Sorry I'm actually mistaken here - will close this out.