3 ms·
When I write a program I aspire to impose no arbitrary limits apart from those imposed by the architecture. So I'd like my compiler to be able to handle program
by chrisseaton 11y ago
When I write a program I aspire to impose no arbitrary limits apart from those imposed by the architecture. So I'd like my compiler to be able to handle programs as complex as the user wants, with the only limit being the available virtual memory and disk space. If you use recursion for 'outer loop' stuff, you impose the extra limitation of the size of the stack, which is much smaller than available virtual memory.
I work with partial evaluation, where intermediate representations during compilation can get quite large, and have seen stack overflows in the compiler for real.
It would be nice if stacks were arbitrarily large anyway.
- kazinator 11y agoA program is so syntactically nested that the compiler blows an 8 megabyte stack (default on x86 Linux, easily extended with ulimit) is a silly program. There is no need to support such a thing in a language implementation. Note that if the language supports macros, you can't eliminate recursion from compile time; macro expanders can express recursion. (The same remark applies though: if user-defined macros blow a generous stack that is many megabytes long, oh well!)
- chrisseaton 11y agoIf you are doing some kind of abstraction interpretation or static analysis, you may have many many implementation stack frames for each logical stack frame. Then add in very deep inlining. And as I say I've seen it for real, in a real compiler, with a real program, while doing a real job. I could send the author an email and tell him his program is silly, but I'd rather be able to compile it.