[Python-ideas] Does jargon make learning more difficult?

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Sun Aug 26 07:52:54 EDT 2018


Greg Ewing writes:

 > For understanding what kinds of things an LL parser can parse,
 > it helps to have gone through the exercise of implementing a
 > recursive descent parser.

I deliberately decided not to go this route.  I'm curious whether Abe
found both posts useful.  (Comparisons are invidious; please don't. ;-)

 > > I don't think of it in terms of the parser knowing "where" it is
 > > in the program, but rather in terms of whether it can do more
 > > work on the AST with the token (or EOF) in hand.
 > 
 > Not so much where it is in the program, but where it is in
 > the *grammar*.

[Concise useful description of what this means and why it's useful
elided.]

 > Unfortunately, Python's parser doesn't seem to make much
 > use of this. :-(

Indeed, and that's part of why I chose the route I did.  But the main
point is that in the context of the particular example (the lambda
swallowing the if-else expression if the lambda is not parenthesized),
the "keep going until you can't" aspect of subpattern matching (used
for ambiguity resolution) is the cause of the need for parentheses
here.



More information about the Python-ideas mailing list