That depends. Do you want to push the string, or a pointer to a string? If it's the former, you have a problem, because the string will have variable length, unlike a pointer or a number. If it's the latter, you have to consider memory management aside from your stack.
Stack Machine with Strings
-
19-06-2023 - |
문제
I'm making a stack based virtual machine in RPython using the PyPy toolchain to convert the RPython to C. So far I have 4 instructions.
- EOP - End of Program
- EOI - End of Instruction
- PUSH - Push item onto the stack
- PRINT - Print the top of the stack
My question is, how do you push a String to the top of the stack. Is it the same as when you push a number to the top of the stack or do I have to do something else when working with strings?
해결책
제휴하지 않습니다 StackOverflow