On Fri, 2006-08-25 at 14:47 +0300, Mark Wotton wrote:

> GOTO is fine - I can target this dumbass Basic variant we have. Low- 
> level non-inferred statically-typed imperative languages are all more  
> or less the same, right? ;)

Well, Turing said something about it .. but some languages developed
in the days of 'structured programming' .. such as Pascal, Modula,
etc .. have no goto command.

> Ok, that should be doable.
> Is there a big runtime library for felix? These chips are pretty  
> small - maybe 16k program code.

No. The core control inversion RTL can be done in a few
lines of code: in C++ it is basically:

        con_t *p = new StartObject();
        while (p) p = p->resume();
        // finished!

In assembler, basic, or whatever, it is not much more.
The actual Felix driver also supplies communication channels,
which require one machine word and a flag to say if that
word points to a read list or a write list: the list is
a singly linked list (two machine words per node).

Each 'thread' is just a record of the current continuation
of that thread, which is the 'top of stack' object of
the type con_t above. 

When a read or write is done a flag in the continuation
says "wait until my channel is ready" .. so instead of just
the p in the resume loop above, there is a list of
active objects. The 'unready' objects are hung off the
channels they're waiting on and are owned by all those
threads that know about the channel .. one of them must
be active (if not, all the waiting threads for that channel
are deadlocked forever .. in Felix flx_run this has the pleasant
effect of collecting all those objects as garbage since they
become unreachable .. making deadlocking impossible 
'in vaccuuo' :)

For a micro controller, you probably don't want a garbage collector
(though I'm not sure).

> Ah, John, you're too honest. Here I am offering to work on backend  
> code for Felix, and you tell me it's easier to roll my own... :)

A happy non-customer is better than an annoyed customer :)

16K Rom should be enough to run a Felix like system.
But it may take some work to reduce the overheads and make
suitable compromises, especially if you're not talking
about using C as a target language. 

> > What is the 'program counter' but a continuation?
> 
> Sure. But the program counter is implicit, and a continuation is  
> explicit, and there's a strong bias toward explicitness in FP.

Hmm .. well Monads seem to do just the opposite: they allow you to
be explict once about making stuff implicit :)

There was actually a functional language called SNOBOL which
as designed for string processing .. where you had to write:

label pattern .. operation t:target f:target

on every line: the last bit is the place to go next,
if the operation was successful or failed, respectively.


> >> (Background: I'm doing some lighting programming, and writing my own
> >> event loops and queues gets old fast.)
> >
> > Oh? For whom? Curious because I *invented* the software
> > part of the digital dimmer :)
> 
> David Atkins Enterprises - I'm in Doha,

Cool .. capital of Qatar .. well actually HOT is probably more
like it :)

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to