Python PLY zero or more occurrences of a parsing item

巧了我就是萌 提交于 2019-12-06 01:08:14

How about this:

EXPR : NUMBER
        | STRING
        | LPAREN funcname EXPR_REPEAT RPAREN
EXPR_REPEAT: /*nothing*/
        | EXPR EXPR_REPEAT

Are you sure you want a Context Free Grammar and not a Parsing Expression Grammar? Also, in my experience the design of PLY couples the grammar and parsing and post-processing very badly so I would recommend an implementation with more modular design.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!