Lemon (parser generator)

Uses your system voice; voice and rate in settings.

Snapshot

≈ 3 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

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 in BRL-CAD as platform-agnostic and easily compilable alternatives to Flex and Bison. This combination is also used with STEPcode. OpenFOAM expression evaluation uses a combination of ragel and a version of lemon that has been minimally modified to ease C++ integration without affecting C integration. The parser grammars are augmented with m4 macros.

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 in BRL-CAD as platform-agnostic and easily compilable alternatives to Flex and Bison. This combination is also used with STEPcode. OpenFOAM expression evaluation uses a combination of ragel and a version of lemon that has been minimally modified to ease C++ integration without affecting C integration. The parser grammars are augmented with m4 macros.

Notes

References

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

Text derived from https://en.wikipedia.org/w/index.php?oldid=1366337912 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

7 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.