Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Using overload to parse arithmetic terms

by Tomte (Priest)
on Feb 07, 2006 at 12:30 UTC ( #528486=note: print w/ replies, xml ) Need Help??


in reply to Using overload to parse arithmetic terms

I may be completely mistaken, but IMHO parenthesis aren't things overload can overload - they're at least not mentioned in overload

To get better qualified help you should specify the code you wrote and mention what exactly "didn't work" in which way- your post is almost in the worst form you can ask such a question: state at least what you did, what you expected and what you got.

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus


Comment on Re: Using overload to parse arithmetic terms
Download Code
Re^2: Using overload to parse arithmetic terms
by esskar (Deacon) on Feb 07, 2006 at 12:43 UTC
    well i, did that:
    use overload '+' => \&add, '-' => \&sub, '*' => \&mul;
    so, i'm able to build a expression that uses +, - and * . Now, i want to be able to detect when the user uses parenthesis as shown above. I know that overload does not support parenthesis, but i hope that somebody has a idea how i can detect those parenthesis.

      Hmm, how do you store the expressions? If you store them as a tree, you already have the information necessary, because you can always generate parenthesis for an <+|->-Node with to children on the fly - that's what I meant with showing relevant code - do you store the expression as a tree - otherwise this is a useless info on my part *g*?


      regards,
      tomte


      An intellectual is someone whose mind watches itself.
      -- Albert Camus

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://528486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-07-30 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls