anchor.diff:    print 'import sys'
     print ''
     print 'def array(x):'
  -  print '  return [[[x]]]'
  +  print '  arg, is_ref = x'
  +  print '  if is_ref:'
  +  print '    arg = arg[0]'
  +  print '  return [[[arg]]]'
     print ''
     print 'def count(x):'
  -  print '  return [len(x)]'
  +  print '  arg, is_ref = x'
  +  print '  if is_ref:'
  +  print '    arg = arg[0]'
  +  print '  return [len(arg)]'
     print ''
   } : top_statement*
     ;
  
positive.code:   | KW_TRUE { $val = "True" }
    | KW_FALSE { $val = "False" }
    | ^(KW_NEW class_name actual_parameter_list?)
    | voc=variable_or_call { $val = '\%s[0]' \% $voc.tmp }
    | ^(Pre voc=variable_or_call incdec_op
      {
        self.print_line('\%s[0] = \%s[0] \%s 1' \% ($voc.tmp, 
                          $voc.tmp, $incdec_op.op))
        $val = '\%s[0]' \% $voc.tmp
      })
    | ^(Post voc=variable_or_call incdec_op
      {
        $val = self.get_temp()
  
negative.code:   ;
  
  actual_parameter_list returns [params_list]
    : { params = [] } (^(Parameter ap=actual_parameter { params.append($ap.val) }))+
      { $params_list = ','.join(params) }
    ;
  
  actual_parameter returns [val]
    : lvalue { $val = '(\%s, True)' \% $lvalue.lval } 
    | rvalue { $val = '(\%s, False)' \% $rvalue.val }
    ;
  
  index[vector] returns [idx]
  