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

标签 python parsing compiler-construction grammar

我看到了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/

相关文章:

python - 先决条件的简单比较不起作用

python - 适用于 Python 2.x 和 Python 3.x 的可移植、内存高效的 range()

python - 如何有效地删除非 ASCII 字符和数字,但保留重音 ASCII 字符

java - 如何执行 parse() 并返回正确的值

gcc - 如何更改GCC编译器的目标目录?

c++ - 为了确保 C++ 类型是 POD,我必须遵循哪些规则?

c - hiredis "undefined reference to"编译错误

Python Argparse - 将参数的默认值设置为另一个参数

java - MSML 的 XSD 架构中的 XML 失败 (RFC 5707)

java - 为什么这个简单的 jparsec 词法分析器会失败?