[Rd] Patch: context stack size in gram.y

Thomas Dreibholz dreibh at iem.uni-due.de
Wed May 31 15:53:25 CEST 2006

On Wednesday 31 May 2006 15:26, Prof Brian Ripley wrote:
> On Wed, 31 May 2006, Thomas Dreibholz wrote:
> > Hi!
> >
> > Attached to this mail, you find a patch for gram.y setting a #define
> > CONTEXT_STACK_SIZE for the context stack size and replacing the following
> > constants 50 and 49 by CONTEXT_STACK_SIZE and CONTEXT_STACK_SIZE-1. The
> > new #define makes setting the stack size much more easy; I also have
> > increased it to 500, because 50 is too small (we use R to iterate through
> > sets of simulation parameters, which requires a context stack size of
> > around 100).
> I think you will have to explain in detail why you need this, when for a
> decade R users have not reported a need for it.  It is not related to
> iteration in R, rather to the depth of recursion needed to parse R code.

We use R to create input files for OMNeT++ simulations. The simulation 
parameters are defined like this:
param01Set <- c(...)
param02Set <- c(...)
paramXYSet <- c(...)
Most of these sets only contain a single element.

The input file generation, which should be usable for all simulations, works 
as follows:
for(param01 in param01Set) {
 for(param02 in param02Set) {
   for(paramXY in paramXYSet) {
     Generate input file for these parameter settings

The simulation has more than 50 different parameters, so a "contextstack 
overflow" error will be the result. Increasing the context stack size in 
gram.y solves this problem. (Clearly, only using "for" iterations for sets 
consisting of more than one element would solve the problem - but this 
requires a special version of the parameter generation function for every 

Best regards
 Dipl.-Inform. Thomas Dreibholz

 University of Essen,                            Room ES210
 Inst. for Experimental Mathematics              Ellernstraße 29
 Computer Networking Technology Group            D-45326 Essen/Germany
 E-Mail:     dreibh at exp-math.uni-essen.de
 Homepage:   http://www.exp-math.uni-essen.de/~dreibh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20060531/138dbfbd/attachment.bin 

More information about the R-devel mailing list