Is there a stackless and heapless programming language?

408 views Asked by At

Is there a statically compiled programming language that is both stackless and heapless?

For data, such a language would not have a concept of memory allocation. Instead, the memory requirements of the program would be known completely at compile-time.

For code, there would not be a concept of call stack. There could be functions, but they'd be inlined at every call site.

I am specifically interested by portable languages with some form of implementation or a compiler that produces native binaries.

1

There are 1 answers

1
AudioBubble On

Pure x86 machine language fits your stackless and heapless constraints(within real mode constraints). Portability is not possible, unless the compiler has access to every memory location for all hardware IO(memory locations) that are Fixed for all supported platforms(this condition excludes all dynamic interfaces including PlugandPlay, USB, and PCI/PCIE busses)

It is completely possible to create such a structure within severe hardware limits(every device must be compiled in and allocated at boot, as in older computers like the c64 or Apple II) but all functionality must be pre-compiled into the OS, as in every program possible that is to run on the platform.

This is not a general computing platform anymore. Program a micro-controller, GPU, or ASIC to solve the task instead.