Extract lines from file, add to new files
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Jan 15 02:53:03 EST 2024
On 15/01/24 1:28 am, Left Right wrote:
> Python isn't a context-free language, so the grammar that is used to
> describe it doesn't actually describe the language
Very few languages have a formal grammar that *fully* describes
the set of strings that constitute valid programs, including all
the rules about things having to be declared, types matching up,
etc. The only one I know of which attempted that is Algol 68,
and it seems to be regarded as a technical success but a practical
failure.
> ... so, it's a "pretend grammar" that ignores indentation.
Indentation isn't ignored, it appears in the grammar by means of
INDENT and DEDENT lexical tokens.
It's true that the meaning of these tokens is described informally
elsewhere, but that's true of all the lexical features.
--
Greg
More information about the Python-list
mailing list