[Python-ideas] Does jargon make learning more difficult?
Steven D'Aprano
steve at pearwood.info
Wed Aug 22 02:20:52 EDT 2018
On Tue, Aug 21, 2018 at 05:45:53PM -0500, Abe Dillon wrote:
> Can you explain how far the parser is capable of backtracking?
Its an LL(1) parser, if I recall correctly, so if you look at the
details of LL(1) parsing, that should answer the question.
https://en.wikipedia.org/wiki/LL_parser
But if I'm reading the Wikipedia page correctly, I think the answer is
"no backtracking at all".
> It seems like <expression> with <signature> would require a similar amount
> of backtracking to ternary expressions:
>
> <expression> if <condition> else <expression>
I don't think needs any backtracking. The parser doesn't have to read
the "if" and then go back to re-read the previous expression. It can
look ahead from the expression by one token, see the "if", and recognise
it is a ternary if.
--
Steve
More information about the Python-ideas
mailing list