def p_variable(p):
 if (len(p) == 2):
  p[0] = (p[1], None, None)
 elif (len(p) == 5):
  p[0] = (p[1], p[3], None)
 else:
  p[0] = (p[1], p[3], p[5])

def p_variable ( p ) : if ( len ( p ) == 2 ) : p [ 0 ] = ( p [ 1 ] , None , None ) elif ( len ( p ) == 5 ) : p [ 0 ] = ( p [ 1 ] , p [ 3 ] , None ) else : p [ 0 ] = ( p [ 1 ] , p [ 3 ] , p [ 5 ] )
variable : id | id lparen expr rparen | id lparen expr comma expr rparen .