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

From: Paul Johnson <pauljohn32_at_gmail.com>
Date: Sat, 26 Mar 2011 17:07:58 -0500

On Wed, Mar 23, 2011 at 6:35 PM, Rob Anderson <rkjandra_at_gmail.com> 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).
>

I hope I am not telling you what you already know. There are working examples of "C Standalone" programs that link with R mathlib. I learned from the examples here

http://www.math.ncu.edu.tw/~chenwc/R_note/index.php?item=standalone

and

http://www.stat.berkeley.edu/classes/s243/rmath.html

I can't say for sure if these give you access to all of the R stuff you want, but you do get access to quite a bit.

PJ

> 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?
>
> Appreciate any help.
>
> Thanks
> RJ
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat 26 Mar 2011 - 22:11:17 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 - 23:50:37 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