Parsing, where can I learn about it

2019-01-22 08:10发布

I've been given a job of 'translating' one language into another. The source is too flexible (complex) for a simple line by line approach with regex. Where can I go to learn more about lexical analysis and parsers?

标签: parsing lex
12条回答
等我变得足够好
2楼-- · 2019-01-22 08:28

If you want to get "emotional" about the subject, pick up a copy of "The Dragon Book." It is usually the text in a compiler design course. It will definitely meet your need "learn more about lexical analysis and parsers" as well as a bunch of other fun stuff!

IMH(umble)O, save yourself an arm and/or leg and buy an older edition - it will fill your information desires.

查看更多
Summer. ? 凉城
3楼-- · 2019-01-22 08:29

Lots of people have recommended books. For many these are much more useful in a structured environment with assignments and due dates and so forth. Even if not, having the material presented in a different way can help greatly.

(a) Have you considered going to a school with a decent CS curriculum?
(b) There are lots of online lectures, such as MIT's Open Courseware. Their EE/CS section has many courses that touch on parsing, though I can't see any on parsing per se. It's typically introduced as one of the first theory courses as language classification and automata is at the heart of much of CS theory.

查看更多
疯言疯语
4楼-- · 2019-01-22 08:31

I found this site helpful:

Lex and YACC primer/HOWTO

The first time I used lex/yacc was for a relatively simple project. This tutorial was all I really needed. When I approached more complex projects later, the familiarity I had from this tutorial and a simple project allowed me to build something fancier.

查看更多
时光不老,我们不散
5楼-- · 2019-01-22 08:32

Parsing Techniques - A Practical Guide By Dick Grune and Ceriel J.H. Jacobs

This book (freely available as PDF) gives an extensive overview of different parsing techniques/algorithms. If you really want to understand the different parsing algorithms, this IMO is a better reference than the Dragon Book (as Parsing Techniques focuses entirely on parsing, while the Dragon Book covers parsing only as one - although important - part of the compiler construction process).

查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-22 08:37

I've recently been working with PLY which is an implementation of lex and yacc in Python. It's quite easy to get started with it and there are some simple examples in the documentation.

Parsing can quickly become a very technical topic and you'll find that you probably won't need to know all the details of the parsing algorithm if you're using a parser builder like PLY.

查看更多
戒情不戒烟
7楼-- · 2019-01-22 08:40

Try ANLTR:

ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages.

There's a book for it also.

alt text

查看更多
登录 后发表回答