def p_expression_name(p):
 try:
  p[0] = names[p[1]]
 except LookupError:
  print ("Undefined name '%s'" % p[1])
  p[0] = 0

def p_expression_name ( p ) : try : p [ 0 ] = names [ p [ 1 ] ] except LookupError : print ( "Undefined name '%s'" % p [ 1 ] ) p [ 0 ] = 0
expression : name .