
10 Feb
2021
10 Feb
'21
4:57 a.m.
Hi, I notice that in Lexer.x for GHC nested comments are parsed using a special function, with the comment "nested comments require traversing by hand, they can't be parsed using regular expressions." While I see that nested comments can't be parsed using regular expressions, the lexer has a state stack, and so it seems like nested comments could be parsed by pushing a new "nested comment" state onto the lexer state every time a "{-" is encountered. But perhaps this is not done because its not clear how to make the entire comment into a single token that way? This might be a naive question -- I don't have that much experience with lexers. Thanks! -BenRI