[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OT(slightly): parser generator for expression with custom operators
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 29 Jun 2011 18:09:09 +0200
On Wed, Jun 29, 2011 at 5:48 PM, Lorenzo Donati
<lorenzodonatibz@interfree.it> wrote:
> For example, consider math vectors:
>
> W = V1 :x: V2 + V3
> W = V1:cross_product(V2) + V3 -- less readable
OK, good one. But you could overload ^ for that, and * for dot
product. (And % is also available)
True, :x: is cute. To answer your question, one thing that LuaMacro
can not do is parse infix expressions. You could define ':x:' as a
lexical token and replace it by '%', that kind of thing. But for such
a simple step, gsub is your friend ;)
steve d.