Lemon Parser Generator
|
|
This article may require copy editing for grammar, style, cohesion, tone, or spelling. You can assist by editing it. (December 2011) |
|
|
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (December 2011) |
| Developer(s) | D. Richard Hipp |
|---|---|
| Written in | C |
| Operating system | Cross-platform |
| Type | Parser generator |
| License | Public domain |
| Website | www.hwaci.com/sw/lemon/ |
Lemon is a parser generator, maintained as part of the SQLite project, that generates an LALR parser in the C programming language from an input context-free grammar. The generator is quite simple, implemented in a single C source file with another file used as a template for output. Lexical analysis is performed externally.
Lemon is similar to bison and yacc; however it is not compatible with these programs. The grammar input format is different to help prevent common coding errors. Other distinctive features include an output parser that is reentrant and thread-safe, and the concept of "non-terminal destructors" that try to make it easier to create a parser that does not leak memory.
SQLite uses Lemon with a hand-coded tokenizer to parse SQL strings.
In 2008 a Lemon-generated parser was suggested to replace the bison-generated parser used for the PHP programming language; as of 2010[update] this project is listed as "in the works".[1]
[edit] Notes
- ^ Kneuss, Etienne (2008-03-25). "Request for Comments: Replace Bison based parser with Lemon". PHP Wiki. http://wiki.php.net/rfc/lemon. Retrieved 2010-05-08.
[edit] References
- "The LEMON Parser Generator". http://www.hwaci.com/sw/lemon/. Retrieved 2008-12-24.
- "Architecture of SQLite". 2008-11-01. http://www.sqlite.org/arch.html. Retrieved 2008-12-24.