I wonder how is generated the grammar of the Python language and how it is understood by the interpreter.

In python, the file `graminit.c` seems to implement the grammar, but i don't clearly understand it.

More broadly, what are the different ways to generate a grammar and are there differences between how the grammar is implemented in languages such as Perl, Python or Lua.