lemon - namespace support

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

lemon - namespace support

Mark.O
I've fairly recently been using lemon for building several parsers in
C++ and found what I believe to be a *minimalist* means of avoiding
symbol clashes without adding bloat, or affecting C code generation.

- New '-e' command line option to define the code extension. By default
this is 'c', but with this option can define somethinglike -ecxx etc for
using a C++ compiler.

- New (optional) '%namespace' directive. This can be used to embed the
'Parse*' routines into a C++ namespace. If the '%namespace' is not
defined, there is no change in behaviour.
The namespace can be anonymous or contain multiple nested namespaces.
For example,
     %namespace {}
     %namespace {ns1::ns2::ns3}

This makes it easy to generate lemon parsers for C++ without any
potential symbol clashes, and it imposes no C++ interface on the user.
It does not fundamentally change how lemon works.

I hope that the changes are useful enough for broader interest and/or
sufficiently encapsulated that they could be incorporated into the sources.

Here are references to the patches:

https://develop.openfoam.com/Development/openfoam/blob/develop/wmake/src/lemon.c.patch

https://develop.openfoam.com/Development/openfoam/blob/develop/wmake/etc/lempar.c.patch


Cheers,
/mark
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users