If you’re parsing Rust for any practical purpose, the complexity class of the grammar isn’t in the top 10 things that are difficult. It isn’t even in the top 100.
-
-
The things that make parsing languages difficult are things like C’s lexer hack, or the way C++’s template expansion affects parsing. Not theoretical complexity class of the grammar.
3 replies 0 retweets 2 likes -
those are definitely the *biggest* factors, but grammar complexity class isn't completely irrelevant- especially since we've managed to avoid the C family's missteps
1 reply 0 retweets 0 likes -
a lot of parsers are little simple things- editor syntax specifications, quick fuzzy searches, cross-language tools, (unfortunately) proc macros. every little bit of complexity in the grammar makes things harder there
1 reply 0 retweets 3 likes -
I completely forgot about procedural macros! They make parsing so much more difficult as to make LL(k) not even relevant as a concern in comparison.
1 reply 0 retweets 2 likes -
not really? they work almost like comments when it comes to parsing, except you tokenize their innards (unlike comments)
1 reply 0 retweets 1 like -
Of course they’re easy to *tokenize*, but they’re not easy to *expand*. Any tool that does not expand macros is broken.
3 replies 1 retweet 3 likes -
syntax highlighting parsers don't need to handle this :) nor does rustfmt but yes, I agree with your general point wrt proc macros
2 replies 0 retweets 0 likes -
Syntax highlighting doesn’t even need to parse the language, only lex it.
2 replies 0 retweets 0 likes -
most highlighters differentiate between type and variable and function, so you kinda do
1 reply 0 retweets 0 likes
So what? Then they can do the lookahead. What frustrates me about this conversation is that we’re having it in a vacuum without even showing how it would break *specific* editors. It’s just FUD.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.