Skip to content

Latest commit

 

History

History
77 lines (39 loc) · 1.94 KB

README.md

File metadata and controls

77 lines (39 loc) · 1.94 KB

Parser for Arithmetic Operations in Marathi Language

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.

Example Inputs and Outputs

Input 1

10 अधिक 2 गुणिले 3 वजा 4 भागिले 2

This input can be interpreted as the expression:

10 + 2 * 3 - 4 / 2

and the output will be 14

Input 2

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

Input 3

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

Input 4

16 वजा 8 अधिक 14 भागिले 2

This input can be interpreted as the expression:

16 - 8 + 14 / 2

and the output will be 15

Input 5

16 वजा (8 अधिक 14) भागिले 2

This input can be interpreted as the expression:

16 - (8 + 14) / 2

and the output will be 5

Input 6

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

Input 7

1अधिक2अधिक3

This input can be interpreted as the expression:

1 + 2 + 3

and the output will be 6