Op 14/01/2024 om 13:28 schreef Left Right via Python-list:
Python isn't a context-free language, so the grammar that is used to
describe it doesn't actually describe the language... so, it's a
"pretend grammar" that ignores indentation.

No it doesn't. Here is the definition of a block, it clearly mentions
indentation:

block:
    |  NEWLINE INDENTstatements  DEDENT
| simple_stmts But you are correct that python in not a context-free language. But so is any programming language. Yet a lot of those non context-free language designers thought it helpful to have a modified/extended BNF description of a superset of the intended language and used other means to further check whether the code in question was valid or not. -- Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to