[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Extensible infix operators
- From: John Hind <john.hind@...>
- Date: Wed, 29 Nov 2006 15:36:35 +0000
I'm working on a calculator program which uses Lua as its expression
evaluator. I'd like to be able to offer extensible infix operators so
you'd be able to write something like:
c = a func b
where a and b are numeric variables or expressions and func is a
function. This would be evaluated as:
c = func(a, b)
At the moment I plan doing this by pre-processing the formula strings,
but it occurs to ask if MetaLua or Token Filters could be used to add
this to the language? It would be easier to disambiguate expressions
like this if I already know that a token represents a function taking
two parameters.
Any thoughts?