2 ms·
Thanks for the clarification :) (And sorry for not having replied earlier, i seems HN doesn't notify about replies any more.) The point i was trying to make w
by epidemian 11y ago
Thanks for the clarification :)
(And sorry for not having replied earlier, i seems HN doesn't notify about replies any more.)
The point i was trying to make was mostly about the difficulty of understanding the syntax (i.e. "parsing" for humans), not so much about syntax ambiguity or having to use a more sophisticated parsing strategy. The comments on the code represent the "rules" that a human might follow to try and make sense of that syntax. They are not as simple as they could be had Ruby only allows blocks to be denoted with do/end.
However, about the complexity on the parser itself, doesn't this case of block syntax need at least some dedicated logic to take care of ´foo {}´ not parsing the {} part as a hash literal expression but rather as a block? (e.g., maybe adding some explicit priories to the parser rules, or making the lexer add hidden parentheses so that the parser sees ´foo() {}´ and doesn't have to make that distinction).