How is this simple add numbers and output code doesn't work? (Whitespace language)

59 views Asked by At

I want the code to output 5, which is got from 2+3 (inputted from stack manually)

[space][space][space][tab][space] push 2
[space][space][space][tab][tab] push 3
[tab][space][space][space] add together
[tab][lf]
[space][tab] output number

But it seems to say that it is a invalid line end? What happened?

1

There are 1 answers

0
egilhh On BEST ANSWER

The Push commands should end with a line feed, so it should probably be (in a one-instruction-per-line format, i.e., only the annotated characters are significant)

[space][space][space][tab][space][lf]
[space][space][space][tab][tab][lf]
[tab][space][space][space]
[tab][lf][space][tab]