Re: Simple expression parser for PHP. [message #179762 is a reply to message #179754] |
Mon, 03 December 2012 20:39 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 03/12/12 17:28, Daniel Pitts wrote:
> On 12/2/12 3:45 AM, Thomas 'PointedEars' Lahn wrote:
>> Daniel Pitts wrote:
>>
>>> On 12/1/12 9:58 AM, Thomas 'PointedEars' Lahn wrote:
>>>> Daniel Pitts wrote:
>>>> > I have a requirement that I need to take an expression and evaluate
>>>> > it.
>>>> >
>>>> > I'd very much like to avoid using PHP's eval(), for obvious
>>>> > reasons.
>>>> > I'm kind of looking for something that is similar to OGNL (a Java
>>>> > library for expressions).
>>>> >
>>>> > Speed is a plus, ease of integration is a nice-to-have. Low bug
>>>> > density
>>>> > and active community is also a plus.
>>>>
>>>> What kind of expression are you talking about?
>>>
>>> Things along the lines of "request['some_attribute']" or "3 * someValue"
>>> etc... Where I can specify the objects available to act upon ('request'
>>> in the first example, 'someValue' in the second).
>>>
>>> Some method of traversing object graphs would be useful as well. Like I
>>> said, something similar to OGNL, but for PHP instead.
>>
>> What do you need this for?
> A program I'm writing. What's it to you? I've given the specific
> requirements. ;-)
>
> More specifically, it is to ease configuration of my program. The
> expressions are going to be embedded into a DSL (domain-specific
> language) for declaring a part of the business logic.
>
> I'm trying to avoid using "eval" or forcing someone to write a PHP
> function and reference that function by name. Most of the time, the
> expressions are so simple, and only make sense in the context they
> appear in the DSL.
>
> Thanks,
> Daniel.
>
I still havent a clue what you are talking about.
Hint: smart people make complex things understandable by good
description. Stupid people make simple things incomprehensible, to make
them look smarter than they really are. Or at least that's what they
think...
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
|
|
|