Skip to main content
8 events
when toggle format what by license comment
Jul 24, 2023 at 9:23 history edited kaya3 CC BY-SA 4.0
deleted 19 characters in body
Jul 11, 2023 at 15:19 comment added CoffeeTableEspresso Having to figure out what a keyword means by context alone (i.e. when the keyword is overloaded for multiple things) probably complicates the compiler much more than just having an extra keyword.
Jul 11, 2023 at 15:18 comment added CoffeeTableEspresso Even if you do a linear search to lookup keywords, it won't really matter for performance. Most languages have dozens (or a few hundred in large cases) of keywords...
Jul 5, 2023 at 12:50 comment added kaya3 @MatthieuM. Well, if you will choose to have an ambiguous grammar then you're going to have problems when you have to parse it. That's not surprising, but many languages overload keywords without making their grammar ambiguous.
Jul 5, 2023 at 12:49 comment added Matthieu M. In this specific case, yes. Ask C++ about using <> to delimit template parameter lists though...
Jul 5, 2023 at 12:38 comment added kaya3 @MatthieuM. The context is generally already known by the parser, implicitly based on the control-flow. For example when parseExpr sees an if keyword it can only be an if expression, whereas if parseStmt sees the same keyword it can only be an if statement.
Jul 5, 2023 at 12:32 comment added Matthieu M. If anything, I would argue that overloading a keyword makes the job of the subsequent passes more complicated, as the exact meaning now depends on the context which must be looked up...
Jul 4, 2023 at 13:03 history answered kaya3 CC BY-SA 4.0