Skip to main content
Question Protected by gnat
Became Hot Network Question
added 57 characters in body
Source Link
glades
  • 419
  • 4
  • 10

I'm wondering if it was theoretically possible for a compiler to determine maximum stack depth at compile time if a limitation was placed on the program. The limitation being that you can't use recursion or cyclic calls. With cyclic calls I don't mean loops but function calls (a -> b, b -> a). The program flow would then have to follow an directed acyclic graph basically.

Under these circumstances, can every program still be written or are there programs that can only work without above limitations?

I'm wondering if it was theoretically possible for a compiler to determine maximum stack depth at compile time if a limitation was placed on the program. The limitation being that you can't use recursion or cyclic calls (a -> b, b -> a). The program flow would then have to follow an directed acyclic graph basically.

Under these circumstances, can every program still be written or are there programs that can only work without above limitations?

I'm wondering if it was theoretically possible for a compiler to determine maximum stack depth at compile time if a limitation was placed on the program. The limitation being that you can't use recursion or cyclic calls. With cyclic calls I don't mean loops but function calls (a -> b, b -> a). The program flow would then have to follow an directed acyclic graph basically.

Under these circumstances, can every program still be written or are there programs that can only work without above limitations?

Source Link
glades
  • 419
  • 4
  • 10

can every program still be written without recursion or cyclic calls?

I'm wondering if it was theoretically possible for a compiler to determine maximum stack depth at compile time if a limitation was placed on the program. The limitation being that you can't use recursion or cyclic calls (a -> b, b -> a). The program flow would then have to follow an directed acyclic graph basically.

Under these circumstances, can every program still be written or are there programs that can only work without above limitations?