Example parsers to learn how to write them [closed]
I am looking for source codes of parsers and/or parser generators that could be studied in order to develop further, my skills that I acquired during a school course. Do you know any recommendable parsers of any type?
Solution 1:
You should know how to build recursive descent parsers by hand. Here's an SO link to a quick lesson on how to do this: https://stackoverflow.com/a/2336769/120163
If you want to understand how recursive descent parsers can be constructed automatically, you can read a paper (and see a tutorial) on MetaII at this link: https://stackoverflow.com/a/1142034/120163
Solution 2:
- Bison is a classical example (C/C++).
- Pyparsing is a great module, and it is very easy to use (Python) .
- Lemon is very easy to use (C++).
Check the examples, and good luck.
Edit:
I guess I should comment. A parser
is a program which processes an input and "understands" it. A parser generator
is a tool used to write parsers. I guess you mean you want to learn more about generating parsers, in which case, you should refer to the documentation of parser generators (all of the above).