gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-30 00:29:30 27 4
gpt4 key购买 nike

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

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

最佳答案

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

  • 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.

关于python - Python 3.5 的语法是 LL(1) 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31637435/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com