Sunday, December 5, 2010

Project 5 - Interpreters and Compilers

This assignment asked that I describe an interpreter and compiler for BASIC, Pascal, C and C++. In general, a compiler is “Software that translates a high level language into machine language and tells you if you have used a programming language incorrectly” (Farrel page 668). After compiling, a program is saved that can be run. An interpreter is software that interprets a programming language into machine code while executing. It never creates a program that can be run at a later time, so programs written in interpreted languages need to be interpreted each time.

I researched many different BASIC compliers. There were so many out there! According to thefreecountry.com the term BASIC describes many computer languages. There are many dialects and generations of the BASIC language. The original BASIC was very simple implemented by using an interpreter in many home computers. For the purposes of this assignment I have selected a second generation BASIC dialect, QBASIC. The free QBASIC IDE, the QB64 COMPILER V0.923. The QB64 Compiler had both a compiler and interpreter. It can be downloaded at http://www.qb64.net/forum/index.php?board=2.0. This version was just released on December 1, 2010. Other than finding positive reviews about this compiler, there was no other documentation about QB64 that I could find.

For Pascal, I selected Free Pascal (aka FPK Pascal) a 32 and 64 bit professional Pascal compiler. This program gets great reviews and it is free! Many different user guides in .pdf format can be downloaded along with the software at http://download.cnet.com/Free-Pascal/3010-2069_4-11652728.html?tag=mncol. Since there is a user guide available online, the instructions on how to use the compiler were readily available. According to Free Pascal’s official user guide, the steps to compile are as follows:
“Compiling a program is very simple. Assuming that you have a program source in the file prog.pp,you can compile this with the following command: fpc [options] prog.pp”

Now for C and C++ I sought out a compiler that could compile both of these related languages, was from a reputable source, and preferably free. After researching options and reviews on the CNET website (http://download.cnet.com/), I decided upon the Digital Mars Compiler. The Digital Mars website had the following to say about their program’s compilation process:

“Digital Mars C++ is an extremely fast one-pass compilation system with highly effective register utilization. An optional global optimization facility provides tight and efficient object code. Run the compiler from within the IDDE or more traditionally using dmc from the console command line. The compiler executables can compile either C or C++ files. The preprocessor is integrated in; but for specialized applications a separate standalone preprocessor is also included. As it runs, the compiler reads the source files, executes all preprocessor functions, checks for any syntax errors, optimizes the program, generates machine code, and outputs an object (.obj) file suitable for input to the linker.”

While doing my research, I came across some very helpful resources, one was the CNET downloads page, I enjoyed the concise reviews and thorough information about all the software available for download, and also qbasicnews.com. This website has lots of tutorials and tips on the QBASIC language.

References:
Programming Logic and Design Comprehensive, Joyce Farrell

No comments:

Post a Comment