C's syntax (was Re: Python Formatted C Converter (PfCC))

William Tanksley wtanksle at dolphin.openprojects.net
Thu Nov 9 19:54:50 EST 2000


On 01 Nov 2000 12:45:37 +1100, Timothy Docker wrote:
>wtanksle at dolphin.openprojects.net (William Tanksley) writes:

>> Of course, there's now a strongly staticly typed Forth, so I might still
>> disappear.  I've never seen such a simple but powerful typechecking/static
>> polymorphism system.

>Sounds curious (if not bizarre). Can you post a reference?

It is indeed facinating.  There are decent docs and a reference
implementation (which tries to otherwise be very close to ANSI Forth) at:

http://home.t-online.de/home/s.becher/forth/

The implementation is beautifully simple:

1. the programmer is required to place a type declaration at the start of
every function which has some stack effect.  The compiler places a
type-token onto the compile-time typestack for each declared input type.

2. every time the compiler looks up a name, it matches the type signatures
of the words it finds against the current contents of the type stack.

3. when a matching word is found, it's compiled, its input types are
popped off the typestack, and its output types are placed on there.

4. at the end of the definition the output types are compared to the
typestack.

>Tim

-- 
-William "Billy" Tanksley



More information about the Python-list mailing list