Search code examples
esoteric-languageswhitespace-language

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


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?


Solution

  • 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]