Python 3.5 的语法是 LL(1) 吗?

Is Python 3.5's grammar LL(1)?

我看到 http://matt.might.net/teaching/compilers/spring-2015/ 说 Python 3.4 是 LL(1)

Python3.5 的语法是否仍然是 LL(1),因此可以编写递归下降解析器?

是的。这是一种故意的语言特性,而不仅仅是碰巧发生的事情。 PEP 3099 明确地 拒绝 对 Python 2 -> 3 转换的任何更改(比任何 3.x -> [=17 转换明显更大) =] 将是):

  • The parser won't be more complex than LL(1).

    Simple is better than complex. This idea extends to the parser. Restricting Python's grammar to an LL(1) parser is a blessing, not a curse. It puts us in handcuffs that prevent us from going overboard and ending up with funky grammar rules like some other dynamic languages that will go unnamed, such as Perl.