>>>>> "Collin" == Collin Peters <[EMAIL PROTECTED]> writes:

Collin> Randal L. Schwartz wrote:
>>>>>>> "Collin" == Collin Peters <[EMAIL PROTECTED]> writes:
Collin> ! winarea = (winwidth * winheight)/144
>> 

>> This design is highly assymetrical.  You probably want something
>> more like:
>> <evaluate op="/">
>> <evaluate op="*">
>> <variable name="winwidth"/>
>> <variable name="winheight"/>
>> </evaluate>
>> <number value="144"/>
>> </evaluate>
>> Then every variable is always "variable", evry number is "number"
>> every operator is always "evaluate", and it's the attributes to
>> distinguish them.  That's much more XML-ish.
>> 

Collin> What about the case of 'winwidth * winheight / winoper'?  That method
Collin> wouldn't work with having more than one operator.  This is one of the
Collin> reasons this is such a pain as there are SO many different options and
Collin> ways it can be written.  Thanks for the advice, any other ideas are
Collin> appreciated.

You have to build a tree, using precedence rules:

<evaluate op="/">
  <evaluate op="*">
    <variable name="winwidth"/>
    <variable name="winheight"/>
  </evaluate>
  <variable name="winoper"/>
</evaluate>

You'd be doing that anyway.  Binops always have two children.
You could even enforce that by changing the name to "binop" and
also have "unop" and "listop".  Then you can enforce the kidcount
with a scheme-du-jour.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to