NO

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

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
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 »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Grincheux

  • Guest
Re: Lemon Juice - Parser Lexer suite
« Reply #1 on: February 13, 2021, 07:49:52 PM »
If I want to use that project It is obliged to create Lex files ?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Lemon Juice - Parser Lexer suite
« Reply #2 on: February 14, 2021, 01:24:12 AM »
Not sure to understand.
If you want to use the parser you can use it alone.
The parser I wrote is a simple lexer, but you don't have to use it if you don't need it.
The lemon parser works as usual stand-alone.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide