Re: S-expr form of C
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Sat, 01 Nov 2008 02:16:56 +0100
Rob Warnock wrote:
I'd like to ask the inverse of this, namely, is there any
generally-accepted "best style" in the Lisp community for
representing C source code in s-expr form? I know about
Aubrey Jaffer's "Schlep"[1], but it's really more a "translator"
from Scheme to C -- historical versions of it used a kind
of Hungarian mangling of function & variable names (based
on suffixes) to convey type information[2]. I'm more looking
for a more literal "representation" of C source in s-expr form,
with a view towards writing a sort of "LAP" which targets C,
with the ability to wrap CL macros around the "LAP". Anybody
got any pointers to prior art?
In my own S-exp to C system, the objective is to be able to generate (almost) all the possible C/C++ syntax from S-exp. I actually generate it from CLOS objects, and have macros defined to build these CLOS objects from the corresponding S-exp.
But this is only the lowest level of that system. (You could call it "CLAP", for "C Level Assembler Program").
Right away, I implement a macro system and progressively implement more and more of Common Lisp-alike features, generating C code. Soon enough we don't write (for ...) loops, but dotime or dolist loops...
So there's not much point in having a "generally-accepted best style" for this kind of things, since with macros you will develop your own DSL anyways.
--
__Pascal Bourguignon__
http://www.informatimago.com
.
- Follow-Ups:
- Re: S-expr form of C
- From: Rob Warnock
- Re: S-expr form of C
- Prev by Date: Re: use-package & name conflict: why they are not deferred?
- Next by Date: Re: Is it a bad sign...
- Previous by thread: Re: use-package & name conflict: why they are not deferred?
- Next by thread: Re: S-expr form of C
- Index(es):
Relevant Pages
|
Loading