logoalt Hacker News

justinpombrioyesterday at 5:29 PM1 replyview on HN

It treated that as

    1 0 0 + 8 8 / 4
which is nonsensical, but it has no error detection so it rolled with it. Really `100` should be its own token, but there's no way to input that.

Replies

dcrazyyesterday at 6:43 PM

How would one typically implement this tokenization? Pre-pass on the input? My initial thought was to push an operand-terminator token when encountering an operator, but it was unclear to me whether it should be pushed to the stack or the output.

show 2 replies