3 ms·
I think it must have been. If he was aware of it at all, he would have associated it with the Reverse Polish Notation of his HP calculator, and probably knew t
by etfb 12y ago
I think it must have been. If he was aware of it at all, he would have associated it with the Reverse Polish Notation of his HP calculator, and probably knew that, while they were certainly powerful, RPN calcs were never going to make it to the mainstream.
And actually implementing a basic interpreter isn't all that complex. The loop is simple:
Read a line.
If the line starts with an integer, you're adding a line to your program; otherwise you need to interpret then execute.
Read the first word. In some BASICs, this is the first string of characters that matches one of the keywords; in others, it's all the alphanumerics up to a non-alphanumeric.
(In effect) dispatch to the appropriate interpretation routine based on which keyword you just read in. For example, PRINT goes to the argument handler for PRINT, LET goes to the argument handler for LET, and so on.
Then you just have a bunch of routines (read one variable name, read an expression and interpret it as a number, read a destination line number, etc) and different keywords use them in different ways.
It's pretty simple, really. Way easier than writing a full LALR parser.