[Versa] Problem with splitting the grammar
Michael Olson
Mike.Olson at fourthought.com
Tue Sep 27 15:22:03 MDT 2005
On Sep 27, 2005, at 3:13 PM, Uche Ogbuji wrote:
> On Tue, 2005-09-27 at 14:07 -0600, Michael Olson wrote:
>> If we split the grammar, then the production (in bind) for a function
>> definition must be something like
>>
>> @function function_name = ([^;])+ ';'
>>
>> Basically, the bind parser does not know the grammar of the function,
>> so it just gives it everything.
>>
>> This causes a problem back in versa land for a query that looks like
>>
>> @prefix ft = foo
>> @function myFunc () = ft:s - ft:p -> ft:o;
>> @prefix ft = bar;
>> myFunc()
>>
>>
>> Because "myFunc" would not be parsed until after the complete bind
>> expression is parsed.
>>
>> Is this bad?
>>
>> We could just disallow redefining, probably the best.
>
> I'm not sure I follow, but if I do, this is a semantic issue, not a
> grammar issue. In the above specific case, line 3 would pretty much be
> a no-op. An implementation would implement the semantics of the
> function using the prefixes in scope at the time, which are foo. That
> function would always have those constant URIs using the foo prefix,
> regardless of the next line.
>
> I don't really see a problem.
>
The problem is with the first statement I made. By splitting the
grammars, we have 2 parsers. One for bind and one for what every
language bind is binding. So, from binds POV, the string "ft:s - ft:p
-> ft:o" is opaque. So to use this new approach, we would first create
a bind parser and parse the context query. That would result in a
bunch of variables, functions and the end query that are just opaque
strings. Then, a Versa parser is created to parse the variables,
functions and finally the query. Because of the two-step, we lose
order of the context grammar and the function "myFunc" would use the
second, overriding, prefix definition for ft.
Mike
>
> --
> Uche Ogbuji Fourthought, Inc.
> http://uche.ogbuji.net http://fourthought.com
> http://copia.ogbuji.net http://4Suite.org
> Articles: http://uche.ogbuji.net/tech/publications/
>
> _______________________________________________
> Versa mailing list
> Versa at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/versa
>
------------------------------------------------------------------------
-----------------
Mike Olson Principal
Consultant
mike.olson at fourthought.com +1 720 253 4662
Fourthought, Inc.
http://Fourthought.com
PO Box 270590, http://4Suite.org
Louisville, CO 80027-5009, USA
XML strategy, XML tools, knowledge management
More information about the Versa
mailing list