Resources for lexing, tokenising and parsing in python

后端 未结 8 2568
鱼传尺愫
鱼传尺愫 2020-12-04 06:41

Can people point me to resources on lexing, parsing and tokenising with Python?

I\'m doing a little hacking on an open source project (hotwire) and wanted to do a fe

8条回答
  •  失恋的感觉
    2020-12-04 07:22

    Here's a few things to get you started (roughly from simplest-to-most-complex, least-to-most-powerful):

    http://en.wikipedia.org/wiki/Recursive_descent_parser

    http://en.wikipedia.org/wiki/Top-down_parsing

    http://en.wikipedia.org/wiki/LL_parser

    http://effbot.org/zone/simple-top-down-parsing.htm

    http://en.wikipedia.org/wiki/Bottom-up_parsing

    http://en.wikipedia.org/wiki/LR_parser

    http://en.wikipedia.org/wiki/GLR_parser

    When I learned this stuff, it was in a semester-long 400-level university course. We did a number of assignments where we did parsing by hand; if you want to really understand what's going on under the hood, I'd recommend the same approach.

    This isn't the book I used, but it's pretty good: Principles of Compiler Design.

    Hopefully that's enough to get you started :)

提交回复
热议问题