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]

Re: readers/translators and ffi


julian.gosnell@nomura.co.uk writes:

> 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 !

You won't need a reader or ctax.  If the standard reader isn't
flexible enough to support another dialect of LISP, we should modify
it to be so.

A maybe too simplistic way to do it is to write a procedure
`lisp-syntax' that takes a LISP expression and returns a Scheme one.
Then start your files containing LISP with the header

(define-module (<package> <module name>) :use-syntax lisp-syntax)

... your LISP code ...

If you want interactive support in the repl you can write:

  (use-syntax lisp-syntax)

Switch it off with

  (use-syntax #f)

I guess there should be some supported standard way of handling
different languages, but, to my knowledge, no such standard exists
yet.

> 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).

I haven't looked at it myself, but you might want to have a look at:

http://ftp.red-bean.com/pub/guile/contrib/misc/xguile.tar.gz

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

I would say that Guile itself is mature for this, but since everyone
is waiting for someone else to do the pioneering work, the translation
tools don't grow.  :(

> 4) Is there any more doc out there ?

There is an essay about Guile internal representation at the Guile www
page: http://www.red-bean.com/guile

Best regards,
/mdj