From: Paul Brannan Date: 2007-04-29T10:45:47+09:00 Subject: Re: Infix to Postfix Method On Sun, Apr 29, 2007 at 08:34:33AM +0900, Peter Marsh wrote: > precedence = {nil=>0,40=>0,42 =>2, 43=>1, 45=>1,47=>2} In general it's better not to explicitly specify ASCII values, so I'd write instead: precedence = {nil=>0, ?(=>0, ?*=>2, ?+=>1, ?-=>1, ?/=>2} Note though that on newer versions of ruby, ?x will give you a string containing "x" rather than the ascii value of x. So to be more compatible, instead of writing: > expression.each_byte do |asc| you'll want to write: expression.each_byte do |c| c = c.chr if ?x == "x" and use c wherever you were using asc before. (I feel like there should be a better way to do this, but I haven't found one. Pity there's no String#each_char). Paul