Sunday 27 April 2008

Compilers

A compiler is a high level language translator that combines the
programming ease of an interpreter with greater speed. This is
accomplished by translating the program (on a host machine such as a
desktop PC) directly into machine language. The machine language
program is then burned onto an EPROM or downloaded directly to the
microcontroller. The microcontroller then executes the translated
program directly, without having to interpret first.


The most popular microcontroller compilers are C and BASIC. PL/M,
from Intel, also has some popular support due to that company's
extensive use of that language.

Due to both its popularity and its slow speed, it was only logical
that BASIC would appear as a compiled language. A few companies
supply a BASIC compiler for several of the more popular
microcontrollers. Execution speed is drastically increased over
interpreted BASIC since the microcontroller is freed from the task of
interpreting the statements as the program runs.

While interpreted Forth approaches (and sometimes surpasses) the
speed of many compilers, compiled Forth screams along. Today there
are many high performance optimizing native code Forth compilers, and
there are also lots of very cheap or free public domain Forths. Some
of them like Tom Almy's ForthCMP produces optimized native code with
less overhead and better performance than just about anything else
out there. Of course it still has compactness and more elegant
factoring of functionality than in most languages.

C is now the language of choice for the entire universe. C is used
on computers from the tiny microcontroller up to the largest Cray
supercomputer. Although a C program can be a bit tedious at times to
read (due to the terse programming style followed by many C
programmers), it is a powerful and flexible development tool.
Although a high level language, it also gives the developer access to
the underlying machine. There are several very good and cheap C
compilers available for the more popular microcontrollers. It is
widely used, available, supported, and produces fairly efficient code
(fast and compact).

No comments: