   Please help with my compiler!
  hi, i have written a compiler which can compile c-like syntax to virtual machine code.the problem is, if i call a function which in turn calls another function, the stack does not what i want (but only if the functions have params).have a look at this code:  void __y (int a){    print(a);  // output the value 10 to console}void __x (){    __y(10);  }void __main(){    __x();}this compiles downto my own virtual machine code:   __y:0:pushbp1:movbp, sp2:subsp, 43:print[bp+8]4:addsp, 45:ret__x:6:pushbp7:movbp, sp8:subsp, 09:push1010:call0(__y)11:addsp, 012:ret__main:13:pushbp14:movbp, sp15:subsp, 016:call6(__x)17:addsp, 018:halti cannot track what´s goind wrong... even with debugging. the stack is valid while in function __y, __y correctly prints the value 10... but then, ret first pops the stack top into ebp... but ebp now contains the constant 10, which is actually the argument to that function. next i pop the return address, which is now actually ebp and - of course - invalid.... i hope someone has an idea and can imagine how my code works..... that would be very great!!!thanksGammastrahler[edited by - Gammastrahler on February 12, 2004 9:15:57 AM]