4 Replies - 677 Views - Last Post: 15 November 2013 - 02:46 PM

#1 stdq  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 64
  • Joined: 15-May 12

A Simple Interpreter for Mathematical Expressions

Posted 15 November 2013 - 02:34 PM

Hello, can anyone show me how to write a simple interpreter (in pseudocode) for mathematical expressions, like 1 + 2 * 3 + 4 / 5 ? I plan to expand it into something bigger. Thanks in advance!
Is This A Good Question/Topic? 0
  • +

Replies To: A Simple Interpreter for Mathematical Expressions

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9047
  • View blog
  • Posts: 33,955
  • Joined: 12-June 08

Re: A Simple Interpreter for Mathematical Expressions

Posted 15 November 2013 - 02:41 PM

Have you thought about putting it in Reverse Polish?

https://en.wikipedia...Polish_notation
Was This Post Helpful? 0
  • +
  • -

#3 stdq  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 64
  • Joined: 15-May 12

Re: A Simple Interpreter for Mathematical Expressions

Posted 15 November 2013 - 02:43 PM

Thanks, I'll take a look into it!
Was This Post Helpful? 0
  • +
  • -

#4 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: A Simple Interpreter for Mathematical Expressions

Posted 15 November 2013 - 02:44 PM

Take a look at the Shunting Yard Algorithm
Was This Post Helpful? 0
  • +
  • -

#5 stdq  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 64
  • Joined: 15-May 12

Re: A Simple Interpreter for Mathematical Expressions

Posted 15 November 2013 - 02:46 PM

Thanks!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1