Hey all,
What seems natural to me is to define subroutines in the middle of the code as I walk the parse tree:
You can do that: .sub __main__ bsr _main end .end .sub _main .sub _f print ":)\n" ret .end .sub _g print ";-)\n" ret .end bsr _f bsr _g ret .end
So you have just to emit code, to call your real main at the beginning. You could also have a look at docs/calling_conventions.pod, which currently is being implemented. But if you have your code generation for subs/params/return values in one place, its for sure not complicated to switch calling conventions later.
Incidentally, I spent all day working on pirate, and it now generates (and runs!) code for a bunch of python structures:
Wow.
Sincerely,
Michal J Wallace
leo