An Expression is a combination of operands (that can be numbers constants, variables), operators and symbols of grouping(brackets, curly braces) written is a specific format/way.
Depending on how the expression is written, we can classify it into 3 types:
| Precedence | Name | Sybmols | Associativity |
|---|---|---|---|
| 1 | Parentheses | { } [ ] ( ) | Same |
| 2 | Exponent | ^ | Right to Left |
| 3 | Division & Multiplication | / * | Left to Right |
| 4 | Addition & Subraction | + - | Left to Right |
Infix expressions are human readable but not efficient for machine reading. Prefix and Postfix expressions do not need the concept of precedence & associativity hence it becomes highly efficient to parse expressions in prefix or postfix formats.
Will study the conversion of one type to another type & evaluation of expressions in seperate blog posts along with implemention using C++.
That's it from this blog post. If you liked it then do share this blog with your friends or people who wanna get into programming world. Thank You!