Solution: grammar: R A | '[' ']' | '[' R { ',' R } ']'

parser:

boolean R(inputStream in) 
  { 
  if( in.peek() == '[' ) 
    { 
    in.get(); 
    if( in.peek() == ']' ) 
      return true; // R  '[' ']' 
    in.get(); 

    if( R(in) ) 
      { // R  '[' R 
      while( in.peek() == ',' ) 
        { 
        in.get(); 
        if( !R(in) ) 
        return false; // failed after R  '[' R { ',' 'R' } ',' 
        } 
      if( in.get() != ']' ) 
        return false; // failed after R  '[' R { ',' 'R' } 
      else 
        return true; // R  '[' R { ',' 'R' } ']' 
      } 
    else 
      return false; // failed after R  '[' 
    } 
  else 
    return A(in); // R  A 
}