esolangs/subleq.bqn

19 lines
538 B
BQN
Raw Normal View History

2022-03-18 16:21:42 +00:00
# Subleq interpreter
_while_ {𝔽𝔾𝔽_𝕣_𝔾𝔽𝔾𝕩}
ToNum {neg '-'=𝕩 (¯1neg)×10×+˜´·-'0'neg𝕩}
Subleq {
𝕊 memory:
{
𝕊 ipmem:
{
¯1b·: ip+3, (@-˜•term.CharB@)(b) mem;
a¯1·: •Out @+amem, ip+3, mem;
abc : d b-(mem)a, (0<d)c, ip+3, d(b) mem
} mem˜ip+3
} _while_ {𝕊 ipmem: ip0} 0memory
}
Subleq ToNum¨•args