3 ms·
I don't think most languages in widespread use have lexers that are regular. Here the same author gives the example of Python's indentation requiring a stack:
by chubot 9y ago
I don't think most languages in widespread use have lexers that are regular. Here the same author gives the example of Python's indentation requiring a stack: http://trevorjim.com/python-is-not-context-free/ http://trevorjim.com/python-is-not-context-free/
Also Haskell: http://trevorjim.com/haskell-is-not-context-free/ http://trevorjim.com/haskell-is-not-context-free/
I'm pretty sure in JavaScript that the /s+/ regex syntax can't be recognized with a regular language. Perl is of course insane -- it's not even statically parseable [1]. Shell isn't context-free.
The theme of this set of posts is that most languages used in practice aren't expressible with CFGs, and I agree. I didn't prove it but he shows how you would prove it.
[1] http://www.oilshell.org/blog/2016/10/20.html http://www.oilshell.org/blog/2016/10/20.html (see the end of this post for links about C++, Perl, Make)