User blog comment:Hyp cos/R function II/@comment-2033667-20150407161050

Take 3 (I've bolded the changes for convenience):


 * A term is an ordered list of one or more numeric terms or bracketed terms.


 * A numeric term is simply a nonnegative integer.


 * A bracketed term consists of a left brace "{", followed by a term, followed by a superscript "+m" where m is a nonnegative integer, and finally a right brace "}". Given a bracketed term B, we will call the term between the braces the contents of B, and the value of m its m-value.


 * A bracketed term is a separator iff its m-value is positive, and a nonseparator otherwise.


 * A numeric term is considered well-formed. A bracketed term is well-formed iff its contents are well-formed and if it is a separator, its contents must begin with a nonseparator or numeric term. A (general) term is considered well-formed iff all its elements are well-formed, and every element that is a separator is followed by a nonseparator or numeric term.


 * A valid R-expression, then, is a well-formed term. The R-function is denoted nRS where n is a positive integer and S is a valid R-expression.

Is this correct?

I highly recommend that you change the syntax definition to this format. I find this format to be much, much easier to understand.