abs-lang / abs

Home of the ABS programming language: the joy of shell scripting.

Home Page:https://www.abs-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weird bug with subtraction without spaces

odino opened this issue · comments

⧐  10 -1
-1
⧐  10 - 1
9

The interpreter thinks -1 is a number itself, and does num num rather than num - num:

⧐  1 10
10

This last behavior is, in itself, problematic. I guess an easy fix is to see whether there's an operator between two numbers -- if not, raise an error. But if the second number "kind of has an operator" (-), we could simply subtract...

image
image

related to #401