Python3+Bash (78 - 185 = -107)
python3 -c"print(sum(sum(map(int,str(x+1)))for x in range(int(${1//^/**}))))"
- can handle all positive number
- can handle expressions with + - / * operation
- can handle ^ (power) operator.
- can handle expressions, without eval or similar¹
If the result of expression is not integer, it will be truncated first. If the result of the expression is negative, the result is undefined.
Use it like:
bash golf.sh "12 + (42 / 3 + 3**43^4)"
1: unless you count invoking Python from Bash as such, but I don't think it is the case. If you think that it actually is, then the adjusted score is -7.