uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.63k stars 116 forks source link

Web interpreter infinite loop #280

Closed Hessesian closed 1 year ago

Hessesian commented 1 year ago

For some reason I couldn't isolate, this: https://www.uiua.org/pad?src=0_5_1__TWFwIOKGkCAkIDQ2Ny4uMTE0Li4KICAgICAgJCAuLi4qLi4uLi4uCiAgICAgICQgLi4zNS4uNjMzLgogICAgICAkIC4uLi4uLiMuLi4KICAgICAgJCA2MTcqLi4uLi4uCiAgICAgICQgLi4uLi4rLjU4LgogICAgICAkIC4uNTkyLi4uLi4KICAgICAgJCAuLi4uLi43NTUuCiAgICAgICQgLi4uJC4qLi4uLgogICAgICAkIC42NjQuNTk4Li4KTnVtcyDihpAgK0AwIOKHoSAxMApTeW1iIOKGkCAiLiIKTGluZXMg4oaQIOKKnOKImOKJoEBcbiAuIE1hcApOdW1NYXAg4oaQIOKIijpOdW1zIExpbmVzClN5bU1hcCDihpAgwqwg4oiKOiDiioJTeW1iIE51bXMgTGluZXMKU3ltTG9jIOKGkCDiipogU3ltTWFwCkFyb3VuZCDihpAgL-KKgiDiip7iioIuLTHih6EzClNybmQg4oaQIOKGr-KHjOKWsyAuKyDihq_ih4zilrMgLiBBcm91bmQKXChb4oqDKy1dKeKJoSjiio8xKS4g4oqaIE51bU1hcAo=

Will cause infinite loop and will never evaluate, while locally 0.4.1 returns an error Error: Cannot couple arrays with shapes [] and [2] at /home/ocel/Work/uiua/first/aoc_3.ua:19:1 19 | ([⊃+-])≡(⊏1). ⊚ NumMap

Maybe add "abort" calculation to webui ?

kaikalii commented 1 year ago

That code triggers a capacity error because it tries to make an array that is far too large. Particularly in \([⊃+-]), which doubles the size of the array on every iteration. I have added a nicer error message to catch this.