Extract lines from file, add to new files

Antoon Pardon antoon.pardon at vub.be
Mon Jan 15 04:52:02 EST 2024



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


More information about the Python-list mailing list