[R] Formal definitions of R-language.

Thomas Lumley tlumley at u.washington.edu
Thu Jul 17 15:59:32 CEST 2003

On Thu, 17 Jul 2003, M.Kondrin wrote:

> Douglas Trainor wrote:
> >
> > Tell the "CS-guys" to grab the source code and chew on the LALR
> > context-free grammar stuff in the file "gram.y" as in:
> >
> >    R-1.7.1/src/main/gram.y
> >
> > "R Language Definition" lives at:
> >
> >    http://cran.r-project.org/doc/manuals/R-lang.pdf
> >
> >
> Thanks for your answers!

I don't think the grammar will actually answer their questions -- it
doesn't specify a lot of the things you (they) are interested in.

R doesn't really conform to purist classifications of languages (I tell
C++ programmers that they would be happier if they think of the old method
system as providing operator overloading rather objects). Luke Tierney
would probably be the best person to reply but here's a stab at what they

R has dynamic typing, and static lexical scoping.  Functions are
first-class objects but assignments to change variables are allowed and
widely used.  It has lazy evaluation of arguments. It has a non-copying
garbage collector but does not have continuations or tail recursion
optimisation.  Operations that would naturally be written using dynamic
scope or macros are faked by constructing expressions and evaluating them
in other than the default environment.

There are two object systems.  Both provide polymorphism and (multiple)
inheritance but do not restrict access to the internal structure of

Documentation for some things (methods, namespaces, the garbage collector)
is at http://developer.r-project.org


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list