Lelek is a parser generator
for F# written in F# with the following features
- Generated parsers are
- Generated parsers are predictive, i.e. they implement a
- Uses a special
LL(k)technique: LLm(n), i.e.
- Generated parsers use a
flexible lookaheadfor each non-terminal; they use only as much lookahead as needed
- Rule selection is done by a deterministic finite
lookahead automatonfor each non-terminal
- Lexers and parsers are generated from
one single grammar descriptionfile
- The grammar description (coined 'LLK grammar') is provided in an
Sematic actionscan be embedded in this LLK grammar description as function calls
- This is the only coupling you have to specify between your language definition and the language processing
- The grammar description supports definition of language comment declaration via a
- Provides tools for
parse tree visualizationto support your grammar implementation
detects direct and indirect left recursionsin your grammar description
Lelek currently generates simple lexers based on .NET Regex. These lexers automatically skip whitespaces to support the most common use cases directly. But it is planned to make this property configurable.
This project contains some introductory grammar examples from entry level up to a complete Oberon-2 LLK grammar.
There are also examples that describe the principles of language processing possible with the Lelek tool using semantic actions.
But of course there exists another opportunity to process the parse result. The concrete syntax tree the parser spits out can be processed by user created tools too. So no one is tied to Lelek's approach to Semantic Actions.
Lelek is a proof of concept. I decided to use .NET Core for this project to make it available to a greater group of developers.