
On Sat, Jul 4, 2009 at 2:29 PM, Eric Niebler<eric@boostpro.com> wrote:
Felipe Magno de Almeida wrote:
And I want to create the looser grammar, composed of all sub-expressions inside the full grammar somehow. Is there a way to do this in proto, or should I start creating it with mpl? Is there a way to iterate a grammar?
This sounds like more work than is truly necessary. There is really only one good reason to specify a grammar when defining a domain, and that is to disable troublesome operator overloads. My suggestion would be to not specify your dsel's grammar up front, but rather only validate full expressions at the point of evaluation. You lose no safety that way.
Defining a grammar loosely is harder than specifying it fully. Doing it fully, all I need to do is: shift(create, table, table_name, columns) and I'm done. But if I do it for all partial expressions, I might forget something. I'm trying to define a SQL grammar. Having it checked earlier, helps me traversing it later, since I know it is right. Also, it prohibits most expressions right away, giving better error messages. I wouldn't have to check later on if there's a non-sensical terminal anywhere. create << table << create would have no overloads. All I need is to traverse a grammar, and define another grammar with all sub-expressions. Since the grammar is not very big, it shouldn't be too hard on the compiler (I hope). Though I'm not very experienced with proto yet. Is transforming a grammar a really difficult task?
-- Eric Niebler BoostPro Computing http://www.boostpro.com
-- Felipe Magno de Almeida