int S(void)
{
  if(lookahead == 'x') {
    match('x');
    return 1;
  }
  else if(lookahead == '(') {
    int n;
    match('(');
    n = L();
    match(')');
    return n;
  }
  else {
    syntax_error();
    return 0;         /* Keep compiler happy */
  }
}


int L(void)
{
  if(lookahead == 'x' || lookahead == '(') {
    int a = S();
    int b = R();
    return a + b;
  }
  else {
    syntax_error();
    return 0;         /* Keep compiler happy */
  }
}


int R(void)
{
  if(lookahead == ',') {
    match(',');
    return L();
  }
  else if(lookahead == ')') {
    return 0;
  }
  else {
    syntax_error();
    return 0;         /* Keep compiler happy */
  }
}