Medium-level Programming Language Website Links For
Programming
 

Information About

Medium-level Programming Language




Such a language is not specific to any architecture, but for any typical architecture, translation of all its constructs to machine code is straightforward, and very little gets done "behind the scenes".

Middle-level languages are machine-independent, but unlike the High-level Languages this is not achieved by providing a common machine-independent environment. Typically the environment provided on different architectures is not exactly the same, being a compromise between similarity to other implementations (easier porting) and better fit for the architecture (better performance). For example the size of the int type in C differs between platforms: on some 64-bit machines int is 64-bit, while on others it's 32-bit, for better compatibility with the bulk of software written for 32-bit machines.

Because the program will behave in a different way depending on which architecture it's being run, it must be coded with extra care. Typically the programmer must invest some time on each platform the program is intended to run to ensure the program behaves correctly there.

Medium-level languages typically do not include features that some find useful, such as:


PERFORMANCE


Medium-level languages usually allow the creation of the fastest machine-independent code, but coding it may take significantly more time and effort than high-level languages. This however greatly depends on how well the provided abstractions match the architecture.

As for a typical example, let's consider the innermost loop of simple Matrix Multiplication algorithm:

for(i=0; i for(j=0; j for (k=0; k
  • N" class="copylinks" target="_blank">+ k += b + j --- c + k ;


  • N" class="copylinks" target="_blank">+ j only once, and the compiler should optimize it.


  • N" class="copylinks" target="_blank">+ k wouldn't change the value of b + j between iterations. Code generated by a C compiler would therefore generate N^3 reads from b instead of N^2, significantly slowing down the program.