[Ometa] True higher order rules
Ondřej Bílka
neleai at seznam.cz
Mon Mar 19 07:18:01 PDT 2012
I do not know why they still do not have lambda.
In ruby-ometa I added lambda without any trouble.
Year ago I sent mail how js ometa can be improved including lambda
but it seem nothing was implemented.
If you wish to port ometa compare my implementation https://github.com/neleai/ruby-ometa
vs javascript one. Mine offers better features with simpler
implementation.
I now work on amethyst which started on ometa and is much stronger.
On Mon, Mar 19, 2012 at 12:36:35PM +0100, Loup Vaillant wrote:
> Higher order rules are currently used like this:
>
> ometa Foo {
> until :rule = apply(rule)
> | anything until(rule),
> close = ']',
> until_close = <until('close')>
> }
> Foo.matchAll('yada]yada', 'until_close') // prints 'yada]'
>
> So, to pass the rule 'close' as a parameter, I have to refer to it by
> name (as a string), then invoke it with apply(). This causes 2 problems:
>
> - I can't pass around anonymous rules. (this is a limitation of
> Ometa's syntax)
>
> - I can't do partial application:
> foo('bar(baz)') // ankward attempt at partial application.
> // of course, it will fail miserably, as there is
> // no rule with parentheses in its name
>
> In an ideal world, I'd like to be able to write:
>
> ometa Foo {
> until :rule = rule // apply() is now unnecessary
> | anything until(rule),
> close = ']',
> until_close = <until(close)> // no quote around 'close', it is
> // passed directly
> }
>
> Or even better:
>
> ometa Foo {
> until :rule = rule
> | anything until(rule),
> until_close = <until(\']')> // no, I don't mean the character ']'
> // So I added a Haskell-like backslash
> // to represent a "lambda" anonymous
> // rule.
> }
>
> Now the question is, why Alessandro didn't do this in the first place?
> Are there implementation difficulties? Which are those? I'm currently
> trying to port OMeta to Lua, so it would be good to know.
>
> Thanks,
> Loup.
> _______________________________________________
> OMeta mailing list
> OMeta at vpri.org
> http://vpri.org/mailman/listinfo/ometa
--
network down, IP packets delivered via UPS
More information about the OMeta
mailing list