This is a parser built in JavaScript that can parse arithmetic operations written in Marathi language, which is an Indian language. It follows the BODMAS (Bracket, Order, Division and Multiplication, Addition, Subtraction) rule to evaluate expressions. The parser can handle input strings that include Marathi words for division, multiplication, addition, and subtraction operations, as well as decimals, brackets, and whitespace. Notably, this parser does not use any built-in parsing mechanisms such as the eval()
method.
10 अधिक 2 गुणिले 3 वजा 4 भागिले 2
This input can be interpreted as the expression:
10 + 2 * 3 - 4 / 2
and the output will be 14
10.5 अधिक 2 गुणिले (3 वजा 4) भागिले 2.5
This input can be interpreted as the expression:
10.5 + 2 * (3 - 4) / 2.5
and the output will be 9.7
10.5अधिक2गुणिले(3वजा4)भागिले2.5
This input can be interpreted as the expression:
10.5 + 2 * (3 - 4) / 2.5
and the output will be 9.7
16 वजा 8 अधिक 14 भागिले 2
This input can be interpreted as the expression:
16 - 8 + 14 / 2
and the output will be 15
16 वजा (8 अधिक 14) भागिले 2
This input can be interpreted as the expression:
16 - (8 + 14) / 2
and the output will be 5
16.5अधिक2.5गुणिले(3वजा4)भागिले2.5
This input can be interpreted as the expression:
16.5 + 2.5 * (3 - 4) / 2.5
and the output will be 15.5
1अधिक2अधिक3
This input can be interpreted as the expression:
1 + 2 + 3
and the output will be 6