[R] A slight weird diversion

Zed Shaw zedshaw at zedshaw.com
Wed Jun 18 16:46:57 CEST 2003


Hi Folks,

This is a totally off-topic diversion that I thought people might find 
fun.

I've been working on a small parser framework that I'm integrating into 
Obversive to provide code analysis of R scripts and stuff.  It is still 
a work in progress, but the parser currently can parse R code and 
produce an XML output file representing the Abstract Syntax Tree.

I thought it would be kind of fun to take the results and throw the XML 
into Exist (an XML database) so that you can search the structure of an 
R script.  I have a sample up at my site at:

http://www.zedshaw.com:8888/simple/xquery.xsp

Where you can search for things in a chunk of the R test suite using the 
XPath and XQuery syntax.  So, you can search for all function calls 
inside of for loops with:  //FOR//CALL, or find all calls to c() with 
//CALL[ID at text="c"].

Have fun with it.  It's nothing serious, but I may turn it into a code 
comprehension tool later down the line.

Zed




More information about the R-help mailing list