Arithmetic evaluation: Difference between revisions
Content added Content deleted
Line 956: | Line 956: | ||
A compact recursive descent parser using Hanson's device. This program |
A compact recursive descent parser using Hanson's device. This program |
||
* handles left and right associativity and different precedences |
* handles left and right associativity and different precedences |
||
* is ready to handle any number of infix operators without adding more functions to handle the precedences |
|||
* accepts integers, reals, and radix constants (e.g. 3r10 is 3 in base 3) |
* accepts integers, reals, and radix constants (e.g. 3r10 is 3 in base 3) |
||
* accepts the Icon operators + - * / % (remainder) and ^ (exponentiation) and unary operators + and - |
* currently accepts the Icon operators + - * / % (remainder) and ^ (exponentiation) and unary operators + and - |
||
* string invocation is used to evaluate binary operators hence other Icon binary operators (including handle multiple character ones) can be easily added |
* string invocation is used to evaluate binary operators hence other Icon binary operators (including handle multiple character ones) can be easily added |
||
* uses Icon style type coercion on operands |
* uses Icon style type coercion on operands |