SQLite Forum

lemon - optional namespace support
Login
> Token pasting of names works partly but with some issues.
> 
>   * Cannot have %name my::name:: without upsetting Lemon itself.

That is surely remedied with a tiny change, perhaps even a code reduction.
 
>   * Defining my::name::ParseFree directly will fail since it would need to be declared first within a `namespace my { namespace name { ... } }' before it can be define. Defining it directly will not compile.

True, although that's where the wrapping I suggested comes into play. If, for a given compilation unit, it is all wrapped as '...' is above, except for the external dependencies, (such as #include <stdio.h>), then the declarations and subsequent definitions are in the same namespace. And, I dare say, the wrapper injection needs to appear in just a few places.

> In the meantime, I have looked over another response for Richard.

I wish you good luck with that. His LALR parser is a joy to use (and read rules written for) compared to yacc or bison.  I once adapted bison for C++ use, and it appears that your changes are less invasive for Lemon than would likely be the case for those other venerable tools. Please appreciate that my suggestions are not intended as "a better way" from a pure programming perspective. Rather, I had hoped that an even less extensive set of changes would enhance the prospects for Lemon becoming a more general purpose tool without first splitting from the SQLite  project.