Jump to content

Lemon (parser generator)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ser Amantio di Nicolao (talk | contribs) at 07:00, 7 March 2016 (Cat-a-lot: Moving from Category:Public domain software with source code to Category:Public-domain software with source code). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Lemon Parser Generator
Developer(s)D. Richard Hipp
Written inC
Operating systemCross-platform
TypeParser generator
LicensePublic domain
Websitewww.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, so as to help prevent common coding errors. Other distinctive features include a reentrant, thread-safe output parser, and the concept of "non-terminal destructors" that try to make it easier to avoid leaking 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 this project was listed as "in the works".[1]

Lemon, in combination with re2c and a re2c wrapper called Perplex, are used[2][3][4] in BRL-CAD as platform-agnostic and easily compilable alternatives to Flex and Bison. This combination is also used with STEPcode.[5]

Notes

  1. ^ Kneuss, Etienne (2008-03-25). "Request for Comments: Replace Bison based parser with Lemon". PHP Wiki. Retrieved 2010-05-08.
  2. ^ http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/lemon/
  3. ^ http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/re2c/
  4. ^ http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/perplex/
  5. ^ http://stepcode.org/docs/build_process/

References