I was wondering how they'd specify a language with semantic indents in an EBNF grammar. Apparently they don't do that at all - they seem to use "virtual" INDENT and DEDENT tokens that act like brackets. I suppose there is an instruction written in prose somewhere how to convert the actual python into the python-with-invisible-brackets that is defined here.
The algorithm for generating those tokens is explained in the Lexical Analysis reference[0], and a quick look at the cpython source shows the logic is implemented in Parser/tokenizer.c[1].
3 comments
[ 2.1 ms ] story [ 12.5 ms ] threadVery clever!
[0]: https://docs.python.org/3/reference/lexical_analysis.html#in...
[1]: https://github.com/python/cpython/blob/master/Parser/tokeniz...