July 18, 2004

Functiony goodness

Well, the translator can now handle functions without parameters. Whee! That means:
def bar():
  a = 3
  print "Foo"
  print a

a = 2
b = 3
if a:
  print a, b
  c = a + b
  print c
  a.foo = c
  d = a.foo
  print d
  bar()
prints
2 3
5
5
Foo
3
as it ought to. (Well, OK, except for the whole "a.foo is an error" thing...)

I've uploaded the updated translator. After lunch, it's time for positional and keyword parameters. This may be slow, since I'm doing hash lookups for all the locals, where Python uses array lookups for the LOAD_FAST/STORE_FAST ops. I ought to translate over to using an OrderedHash for the local store and using array access there too.

Update 1: Well, turns out positionals are pretty easy too. That's up and done, so you can pass parameters to functions. Cool. Posted by Dan at July 18, 2004 11:36 AM | TrackBack (0)

Comments

cruise airline tickets travel sites new orleans hotels opryland hotel pet friendly hotels discount cruise travel packages cheap hotels atlantic city hotels london hotels marriott hotels new orleans hotels world series tickets disney world tickets travel nursing las vegas hotel new york hotels norwegian cruise lines cruise lines hotel princess cruises travel hainan island cruise ticket master hotel discounts football tickets travel insurance last minute travel travel directions celebrity cruises choice hotels cheap travel cheap cruises opryland hotel hilton hotel disney cruise hotel reservations carnival cruises hotel mallorca last minute travel deals discount travel travel hainan island orlando hotels disney cruise hotel california hilton hotel penn state football tickets airline discount tickets travel deals discount cruises travel websites caribbean cruises cruise lines hilton hotels penn state football tickets hotels mallorca movie tickets plane tickets travel sites airline tickets carnival cruises pet friendly hotels plane tickets travel channel air tickets travel nurses cheap cruises discount cruise cheap travel nascar tickets cruise lines discount cruises airplane tickets atlantic city hotels time travel cheap travel princess cruises celebrity cruises travel agencies hotel cheap tickets paris hotels best western hotels cruise lines las vegas hotels las vegas hotel norwegian cruise lines caribbean cruises air tickets cruises orlando hotels train tickets last minute travel deals cruise lines cheap plane tickets airline discount tickets travel nurse cruise lines pet friendly hotels travel travel packages carnival cruise line cruise ships cruises cruise ships cruise lines carnival cruise travel directions travel nursing airplane tickets airline discount tickets air tickets new york city hotels cheap airline tickets celebrity cruises travel deals last minute travel cheap airline tickets travel agencies cheap airline tickets princess cruises new york hotels plane tickets

Posted by: choice hotels at April 23, 2005 08:27 PM