Re: C programs in Scheme syntax

2020-05-31 Thread tantalum
ive started https://github.com/sph-mn/sph-sc and have been using it a lot over the years and worked through several c edge cases. i enjoy using it, more and more even. the git repository page contains several hints and ideas on the general topic. i you have any questions, i'd be happy to answer

Re: C programs in Scheme syntax

2020-05-30 Thread Todor Kondić
> I have implemented a GNU Guile extension which compiles array operations to > machine code using LLVM: http://wedesoft.github.io/aiscm/ > I thought you might be interested since your example is an array operation. > > Regards > Jan > > Am 29. Mai 2020 04:23:46 GMT+01:00 schrieb Keith Wright k

Re: C programs in Scheme syntax

2020-05-29 Thread Jan Wedekind
I have implemented a GNU Guile extension which compiles array operations to machine code using LLVM: http://wedesoft.github.io/aiscm/ I thought you might be interested since your example is an array operation. Regards Jan Am 29. Mai 2020 04:23:46 GMT+01:00 schrieb Keith Wright : >I am thinkging

Re: C programs in Scheme syntax

2020-05-29 Thread Andrew Gwozdziewycz
One might also take a look at PreScheme: https://en.wikipedia.org/wiki/Scheme_48 which is a lowlevel Sexp based system that can generate C or Bytecode. There’s also BitC, which was/is a sexp based lowlevel language. I cannot recall if it compiled directly to C, or was itself a compiler to mach

Re: C programs in Scheme syntax

2020-05-29 Thread Zelphir Kaltstahl
Hi, There is also Schemetran: https://gitlab.com/codetk/schemetran Perhaps that was it? Regards, Zelphir On 29.05.20 05:23, Keith Wright wrote: > I am thinkging about a project that uses Scheme macros > to generate C code. To this end I want to encode C > programs as S-expressions. For examp

Re: C programs in Scheme syntax

2020-05-29 Thread Matt Wette
The other solutions look closer to what you want but     https://savannah.nongnu.org/projects/nyacc has a C parser written in Guile which outputs SXML and a pretty-printer which converts the SXML to C code. On 5/28/20 8:23 PM, Keith Wright wrote: I am thinkging about a project that uses Scheme

Re: C programs in Scheme syntax

2020-05-29 Thread Arne Babenhauserheide
Also have a look at https://github.com/sph-mn/sph-sc Examples: ;; declaration (declare a uint32_t b (array uint8_t 3) c (struct (id int) (name char*)) d (enum (x y z)) e (type uint16_t) f (type (struct (id int) (name char* ;; define with value (define a uint32_t 1) ;; macros (pr

Re: C programs in Scheme syntax

2020-05-28 Thread John Cowan
Check out the Chibi library (chibi show c). in the Chibi repo at lib/chibi/show/c.scm and .sld. It provides combinators that create a C equivalent of the sexp; there is both a macro-based compiler and an interpreter, IIRC. Unfortunately there is no real documentation. There's some cleverness in

C programs in Scheme syntax

2020-05-28 Thread Keith Wright
I am thinkging about a project that uses Scheme macros to generate C code. To this end I want to encode C programs as S-expressions. For example, the C program that is encoded in Ascii as for (j=0;j<12;++j) a[j] = j*pi/6; might be encoded as an S-expression as (for ((= j 0)(< j 12) (++ j)) (=