Re: [sqlite] using lemon to create a c++ parser class

2007-12-09 Thread Christian Smith

Wilson, Ron uttered:

It has been a very long time since I have tinkered with lex/yacc but my 
current project requires a parser.  I'm thinking of learning lemon. 
Frankly, the sqlite code base is far more complex than what I will 
implement.  Is anyone willing to share a lemon parse.y code example for 
something less complex than SQL?



There are tutorials on the net that might be worth looking at, for 
example:

http://freshmeat.net/articles/view/1270/


  Also, i'm looking for advice on using 
lemon to make a c++ parser class instead of a global c parser function. 
Is it as simple as declaring the following?


%name MyParserClass::Parse

I'm pretty sure I can create the right c++ preamble with %include. 
Also, is there a cheap way to make lemon output a .cpp file besides 
renaming the output file?


Feel free to tell me I'm on a foolish quest if I am.



The C++ quest might be unnecassary, but I wouldn't say foolish. There is 
no problem linking C and C++ code. I'd say just leave the Parse function 
as a C function. You might even be able to make it static, thus limiting 
it's scope, and wrapping that static function in a class, but why bother?





RW



Christian


--
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] using lemon to create a c++ parser class

2007-12-08 Thread Wilson, Ron
It has been a very long time since I have tinkered with lex/yacc but my current 
project requires a parser.  I'm thinking of learning lemon.  Frankly, the 
sqlite code base is far more complex than what I will implement.  Is anyone 
willing to share a lemon parse.y code example for something less complex than 
SQL?  Also, i'm looking for advice on using lemon to make a c++ parser class 
instead of a global c parser function.  Is it as simple as declaring the 
following?

%name MyParserClass::Parse

I'm pretty sure I can create the right c++ preamble with %include.  Also, is 
there a cheap way to make lemon output a .cpp file besides renaming the output 
file?

Feel free to tell me I'm on a foolish quest if I am.

RW


-
To unsubscribe, send email to [EMAIL PROTECTED]
-