This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

readers/translators and ffi



Apologies if this is the wrong list for this sort of discussion, perhaps someone
 could point me to a better one....


I have a program which I use constantly which comprises a small LISP
 interpreter, some C/C++ builtins and a large amount of the afore-mentioned
 small LISP.

I think it would prove an interesting little project to convert it to run Guile
 instead of it's current LISP.

I have been through all the doc I can find on the web, in the source etc. and
 whilst this seems to be exactly the sort of thing that Guile should do easily,
 the documentation seems to lag behind the implementation (I would be surprised
 if it didn't)

I've also had a look at the tcltk and ctax translators - but without some doc
 they are somewhat impenetrable.

I see the steps I need to perform as these.

1) write a guile reader that transforms the small LISP into Guile
2) replace all the builtins with Guile functions
3) implement these functions on top of some FFI (they make use of X11)
4) add a little more Guile around the whole thing (an event loop)

let it go....

I figure this will drastically reduce the amount of code I mess around with
 (removal of small LISP interpreter), whilst allowing me to leverage against any
 new Guile related technologies that come along (byte-code compiler, ability to
 use other scripting languages to code for my app etc). Furthermore moving the
 C/C++ builtins into Guile should enhance there maintainability. Speed is
 probably not of the essence.

My questions are :

1) how do I write this reader/translator, do I need to produce a lexer for my
 language like the one in ctax. This seems like overkill, as I really only need
 to convert e.g. :

(defun foo (bar baz) .....) into (define (foo bar baz) ....)

In fact I might just be able to write a few macros to do the whole thing !

2) is there a Guile CLX (native X interface) - or do I need an FFI to bind
 libX11 into my image - is the FFI up to this ?, or do I need to write a
 complete set of builtins in C and then link my own interpreter to them (I'd
 like to avoid this final solution, as it is a lot less flexible).

3) Is this a sensible idea ? or is Guile still to immature for this sort of
 thing.

4) Is there any more doc out there ?


Thanks for your time,




Jules