NO

Author Topic: Lemon Juice - Parser Lexer suite  (Read 2367 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1757
Lemon Juice - Parser Lexer suite
« on: April 07, 2012, 08:59:12 pm »
Recently I made intensive use of Lemon Parser (the one used in SQLight) and I have to say that it works very well.
The problem is that doesn't exist a lexer with the same characteristics: light and resource friendly. The hystorical LEX and FLEX and derivatives are very heavy, and if you need more than one lexer in a single program is absolutely not easy.
At beginning I wrote scanners using routines in C, but for each grammar you had to rewrite the whole scanne, debug it, and so on...
Following some experiments on using regex's I found them more a more friendly and fast way to write a lexer. When I got aware that the code remained almost unchanged between implementations I decided to write a simple lexer with its own grammar to define and create scanners.
So this is, in the sample you'll find an hacked version of Lemon (I modified it to generate prototypes in the generated header file), the Juice lexer source and a sample called Calc.
Calc is a calculatore that have almost all mathematical and logical operators of C. You can write complex expression with brackets to modify the precedence.
Keep in mind that this is an alpha release.
Improvements and comments are welcome.
« Last Edit: April 07, 2012, 09:01:20 pm by frankie »