We have a programming problem we give out at Justin.tv: write a parser to convert arithmetic expressions from infix to prefix (should deal with parens and arbitrary variable names). I wrote a version when I first came up with the problem, but I've lost it. So I thought I'd try writing it again and see how short I could get it.

# parse simple (no parens) arithmetic expressions => prefix expressions
def parse_simple(expr, opers=%w(+ - * /))
  return expr if opers.empty? 
  return parse_simple(expr, opers[1..-1]) unless expr.include?(opers.first)
  "(#{opers.first} " + 
  expr.split(opers.first).map {|sub_expr| parse_simple(sub_expr, opers[1..-1]).strip}.join(" ") +

# remove parens, then parse simple
def parse(expr, exprs = [])
  while expr.gsub!(/\(([^\(\)]+)\)/) {"expr:#{(exprs << parse_simple($1)).size - 1}"}; end
  expr = parse_simple(expr)
  while expr.gsub!(/expr:(\d+)/) {exprs[$1.to_i]}; end

I'm fairly satisfied with it; you could remove some lines through stupid ruby tricks, but I don't see any more concise way to do it. I'd love to see your stab at it though - how short can you get it? Language of choice.