Parser for conditions with logical operators

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

before I rack my brain about something others have thought about, here
my question:

Is there any description how to write a parser that evaluates
expressions with logical operators like "(condition1 OR condition2 AND
(condition3 OR condition4))" in the right way?

Best regards,

Re: Parser for conditions with logical operators

André Hänsel wrote:
Quoted text here. Click to load it

Check out this article at Wikipedia for an brief intro on

Re: Parser for conditions with logical operators

Are you doing a template engine?

We parse <$TEST.TestName.otherparams> and write a cache file which will
contain this instead of the tag:


<$TEST.ELSE> is replaced as '} else {'
and <$/TEST> as '}'

$oForObj is set to be the object that displays the template and would
therefore be expected to have the required method.

All the logic then goes into that method, and you can get as
complicated as you like.

I suppose you could do something similar with switch, but we haven't

Site Timeline