Description

A simple expression parser, that allows parsing and evaluating strings that describe mathematical operations.

The following operators are included by default:

  • minus (-)
  • unary minus (-)
  • plus (+)
  • unary plus (+) (doesn't do much, purely added for support)
  • increment (++)
  • multiplication (*)
  • division (/)
  • modulo (%)
  • power (^)

It will also detect and warn about mismatching/missing parentheses, in which case it will always return a configurable error value.

It's basically a slightly modified implementation of the shunting yard algorithm by Dijkstra, with the addition of an evaluator for the post-fix notation it creates and a tokenizer for input strings.

Adding new operators has been overhauled in version 1.4.0. To add an operator, simply duplicate one of the existing ones in the Operator folder and modify it entirely to your needs. The top part determines the operator's properties (symbol, precedence, etc), the bottom part defines the operation. It should automatically be found as long as its file name has the prefix "_EP_OP_".

Example usage:

evaluate_expression("(1+2)^3") 
output: 27

End User Licence Agreement (EULA).

Changes in 1.4.6

  • Fixed parsing bug where unary operator detection malfunctioned when having numbers with more than one digit

Version 1.4.6. Published July 11, 2018

Age Rating: 4+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Dylan C 24 June 2019

Good but...

This is really good but it lacks documentation on how to add your own operators for example adding sin() would be quite hard.


Gravatar

Mousbah B 14 April 2018

Quite nice

Very good parser +

This review was left for a previous version of this asset.

Logo

Archer (Publisher) 08 April 2018

Dear Mousbah,

This should be resolved in version 1.4.2, let me know if there are any other issues.

Package contents

Loading, please wait

What is the issue?

Back to Top