[Tutor] forth

Alan Gauld alan.gauld at btinternet.com
Sat Mar 3 03:09:33 CET 2007


"Bob Gailer" <bgailer at alum.rpi.edu> wrote

> although is says 'resulting in a [sic] executable". Not sure what 
> that
> means, unless the obvious - an .exe file which when run displays 
> "Hello
> World!". In that case 263 bytes is remarkable.

It does and it is. That is Forth's strong point, it is often in the
same sort of size as assembler. Often tighter than C (which
needs to statically link its stdlib). Forth has such a small
runtime footprint and the compiler only links in the lib functions
it actually needs. As the programs get bigger they use more
of the library functions and quickly grow to be comparable
to C - hence the reason Sun used it for their bootloader but
not for their OS!

But it is wierd...

>> 2
>> 2
>> +
>> .
>>
>> As it uses Reverse Polish Notation and is stack oriented

Again very powerfuil in producing small code.
My first pocket calculator was a Novus which used RPN
(I couldn't afford an HP!) and once you get used to it you
can do amazing things in far fewer keystrokes than on
a conventional calculator.

Alan G. 




More information about the Tutor mailing list