Re: [Rd] Standalone C++ application for processing R parser output(SEXP)

From: Rob Anderson <rkjandra_at_gmail.com>
Date: Sat, 26 Mar 2011 01:28:55 -0400

Thanks a lot guys. I'll try out what you suggested.

Thanks,
RJ

On Thu, Mar 24, 2011 at 8:46 AM, Dirk Eddelbuettel <edd_at_debian.org> wrote:

>
> On 24 March 2011 at 08:08, Duncan Murdoch wrote:
> | On 11-03-23 7:35 PM, Rob Anderson wrote:
> | > Hi All,
> | >
> | > I am trying to write a source-to-source compiler for R. I am trying to
> | > leverage the R parser code for the purpose. I am trying to transform
> the
> | > SEXP returned from the parser into an AST for our own Ruby embedded
> Domain
> | > specific language.
> | >
> | > I tried using R CMD SHBIN to compile a C function that parses arbitrary
> R
> | > expressions. But I think, the generated .so file can be used from
> within R
> | > and not be called from other C or Ruby programs(I get linker errors).
> | >
> | > My Idea is to use the SEXP processing functions/MACROS (CAR, CDR,
> CADR,
> | > etc..) from within C code and transform it to our AST format. I tried
> | > linking to libR.a and other lib*.so's when I compile the C code using
> gcc
> | > but, it doesn't work.
> | >
> | > I read that R exposes only small number of functions for
> library/package
> | > writers and the compiled *.so can only from within R.
> | >
> | > Any ideas on what is wrong, or how I can go about it?
> |
> | I think you need to think of your program as a new front end for R, even
> | if you're only using a few R functions. See Chapter 8 in the Writing R
> | Extensions manual.
>
> Maybe also have a look at the parser package by Romain at
>
> https://r-forge.r-project.org/R/?group_id=384
>
> (and scroll down sufficiently on that page) which has the description
>
> parser - Detailed R source code parser
>
> detailed source code parser, based on the standard R parser but
> organizing the information differently
>
> which strikes me as close enough to what you describe. That said, Romain
> did
> this for highlight so it may not be relevant.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd@debian.org | http://dirk.eddelbuettel.com
>

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 26 Mar 2011 - 13:17:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 26 Mar 2011 - 18:20:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive