Software:Lemon (parser generator)
Developer(s) | D. Richard Hipp |
---|---|
Written in | C |
Operating system | Cross-platform |
Type | Parser generator |
License | Public domain |
Website | {{{1}}} |
Lemon is a parser generator, maintained as part of the SQLite project, that generates a look-ahead LR parser (LALR parser) in the programming language C from an input context-free grammar. The generator is quite simple, implemented in one C source file with another file used as a template for output. Lexical analysis is performed externally.
Lemon is similar to the programs Bison and Yacc, but is incompatible with both. The grammar input format is different, 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 memory leaks.
SQLite uses Lemon with a hand-coded tokenizer to parse SQL strings.
Lemon, together with re2c and a re2c wrapper named Perplex, are used[1][2][3] in BRL-CAD as platform-agnostic and easily compilable alternatives to Flex and Bison. This combination is also used with STEPcode.[4]
OpenFOAM expression evaluation[5] uses a combination of ragel and a version of lemon that has been minimally modified[6] to ease C++ integration without affecting C integration.[7] The parser grammars are augmented with m4 macros.
Notes
- ↑ Brlcad; Carlmoore (2017-11-30). "BRL-CAD: The Lemon Parser Generator". Slashdot Media. https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/lemon/.
- ↑ Bumbulis, Peter (2011-08-23). "Read Me". Slashdot Media. https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/re2c/.
- ↑ Boerger, Marcus (2014-06-24). "Read Me". Slashdot Media. https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/tools/perplex/.
- ↑ "Read Me". GitHub. 2015. http://stepcode.org/docs/build_process/.
- ↑ "New expressions syntax". OpenCFD. 2019-12-23. https://www.openfoam.com/releases/openfoam-v1912/pre-processing.php#pre-processing-expressions-syntax.
- ↑ "wmake sources". OpenCFD. 2019-09-27. https://develop.openfoam.com/Development/openfoam/blob/master/wmake/src.
- ↑ "README". OpenCFD. 2019-09-27. https://develop.openfoam.com/Development/openfoam/blob/master/wmake/src/README.txt.
References
- "The Lemon Parser Generator". https://www.hwaci.com/sw/lemon/.
- "Architecture of SQLite". 2008-11-01. https://www.sqlite.org/arch.html.
External links
- Calculator with Lemon and Lex in C++ Example
- Understanding Lemon generated Parser
- Lemon, bundled with Re2c and Perplex
- Lemon Grove: Lemon along with sibling projects, forks and assets
Original source: https://en.wikipedia.org/wiki/Lemon (parser generator).
Read more |