Parsing, where can I learn about it

前端 未结 12 669
鱼传尺愫
鱼传尺愫 2020-12-13 14:56

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 le

相关标签:
12条回答
  • 2020-12-13 15:47

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

    0 讨论(0)
  • 2020-12-13 15:49

    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.

    0 讨论(0)
  • 2020-12-13 15:50

    After taking (quite) a few compilers classes, I've used both The Dragon Book and C&T. I think C&T does a far better job of making compiler construction digestible. Not to take anything away from The Dragon Book, but I think C&T is a far more practical book.

    Also, if you like writing in Java, I recommend using JFlex and BYACC/J for your lexing and parsing needs.

    0 讨论(0)
  • 2020-12-13 15:53

    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.

    0 讨论(0)
  • 2020-12-13 15:54

    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.

    0 讨论(0)
  • 2020-12-13 15:54

    Yet another textbook to consider is Programming Language Pragmatics. I prefer it over the Dragon book, but YMMV.

    If you're using Perl, yet another tool to consider is Parse::RecDescent.

    If you just need to do this translation once and don't know anything about compiler technology, I would suggest that you get as far as you can with some fairly simplistic translations and then fix it up by hand. Yes, it is a lot of work. But it is less work than learning a complex subject and coding up the right solution for one job. That said, you should still learn the subject, but don't let not knowing it be a roadblock to finishing your current project.

    0 讨论(0)
提交回复
热议问题