⇐ MY QUORA-INDEX QUORA - my answered Questions

QUORA - my answered Questions

Q004: Is there a programming language small enough to fit on a postcard?

If you speak of syntax, I would say FORTH. Forth does not have a syntax at all.

The only syntax is to have a sequence of words and numbers.

Split the text into words, separated by white spaces. Look if the word exists in dictionary, if so, execute it, if not try to convert it into a number and push it on data stack. If it is not a number throw an error. In compile mode instead of executing a word compile a jump to subroutine call. If the word is a macro, then execute it. If the word was a number, compile a literal. Throw an error otherwise.

Example for hello world. (ok> is the FORTH prompt)

ok> .? Hello World? cr
Hello Word
ok>

.? is a word which take the input until ? and put it on display

cr is a word which emits a newline on display.