Many a Forth beginner has problems with reverse Polish notation (RPN).
Not that this is an unsurmountable problem. Just do it and get used to it.
Unfortunately the learning-curve can be steep,
and only after a lot of practice it becomes evident what the benefits of RPN are.
In other words, it can become a psychological stumbling block for impatient newbies.
There is hope: the program
KISS.FRT enables Profane Notation in Forth.
This is the solution all the world has been waiting for!
Of course, exactly those people that need it most won't be able to read the next program.
Not a problem: simply skip to
Defining KISS-commands.
Programs work regardless whether they're being understood.
Forth file: ec212.frt
\ KISS COMMANDS (Albert Nijhof) -- 1 april 2003
FORTH DEFINITIONS DECIMAL
VOCABULARY PARENTHESES
PARENTHESES DEFINITIONS ALSO
\ P-stack with relative stackpointer in cell # 0
12 CELLS CONSTANT pq
CREATE P 0 , PQ allot
: FRESH 0 P ! ; \ Reset p-stack
: ?P ( p# -- ) \ Check overflow and underflow
PQ 0 WITHIN
IF FRESH TRUE ABORT" Syntax Error "
THEN ;
: p> ( -- x ) P @ DUP CELL- DUP ?P P ! P + @ ;
: >P ( x -- ) P @ DUP ?P CELL+ DUP P ! P + ! ;
FORTH DEFINITIONS
: ) ( -- ) p> 2@ ( xt imm? )
0< STATE @ AND
IF COMPILE, EXIT
THEN EXECUTE ; IMMEDIATE
: KISS ( ccc -- )
>IN @ >R ' DROP \ Does this word exist?
R@ >IN ! BL WORD FIND R> >IN ! \ xt imm?
CREATE HERE 2 CELLS ALLOT 2! IMMEDIATE
DOES> >P
BL WORD COUNT EVALUATE
POSTPONE ) ;
: DUMMY ; IMMEDIATE
KISS DUMMY