On 27/05/2009, at 6:41 AM, Erick Tryzelaar wrote:

> I just committed 6f6559 that adds support for an experimental new  
> driver called `flxc` that will support a REPL. It's got a ways to  
> go, but here's what it can already do:
>
>    # build/debug/bin/flxc -I build/debug/lib --import nugram.flxh -- 
> import flx.flx
>>>> 1;
>    ... PARSED:    call 1 ();
>    ... EXPANDED:  call 1 ();
>    ... DESUGARED: call 1 ();
>>>> (1 + 2) * 3;
>    ... PARSED:    call 1+2*3 ();

How would this be used without a line editor?
As it is, I haven't got line editing in Python and it sucks.

To store symbols, you can go forward to flx_symtab.
At that stage, redefinition of functions cannot be supported.
You can support redefinition of non-functions with a flag
that overrides a duplicate definition.

Binding etc must then proceed from the symtab to executable every
input.

The easiest way to do this is for Felix to loop in the driver
after creating the C++ code, pausing for more input.
It should make some file like "go.flag" when ready.

The driver script (Python) runs two threads which interlock
via this file. On thread launches the compiler and then waits
for it to die. The other thread loops on go.flag, running the usual
compile C++ and execution after deleting that flag.

Inside the compiler you will need to delete the caches.
These are mostly Hashtbl so they should be easy to clear
even if they're member of immutable data structure.

Note: in principle, it should be possible to "increment"
the fully bound symbol table, that is, bind the whole standard
library once, then just each input of the user is added.

At present the binding code binds everything, then does
a garbage collection pass: you can't do the garbage collection
since subsequent inputs might use the code.

It would actually be useful to modify flxg so that when you say

        flxg std file

it compiles "std" right up to the bound symbol table, and then
stores it to disk. Next time it just reloads std, already bound.
Keep this in mind during REPL development.

Ideally, Felix should support binding separate components
and saving.. in effect this is Felix version of "separate compilation".
However this requires relocation, or some way to reserve address
space based on say the filename. by "address space" I mean the
unique counter used to generate indices into the symbol table.

Relocation will not work for unique indicies added into string
names. I have no idea if that would be a serious problem or not.

Finally: I don't really see what this REPL buys. A simpler way to
implement one is a Python script that grabs some text, saves it
to a file, runs Felix on that file, then grabs more text, adds it
to the end of the file, and does it all again.

In fact, such a script has been written by me using TkInter,
it should still be in the repository, but it uses a graphics window
instead of a line editing loop. And allows load/save etc.



--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to