Wednesday, March 26, 2014

Why learn about compilers?

Why learn about compilers? Few people will ever be required to write a compiler for a general-purpose language like C, Pascal or SML. So why do most computer science institutions offer compiler courses and often make these mandatory Some typical reasons are: It is considered a topic that you should know in order to be “well-cultured” in computer science. A good craftsman should know his tools, and compilers are important tools for programmers and computer scientists. The techniques used for constructing a compiler are useful for other purposes...

Compiler Requirements

Compiler Requirements Correctness. Correctness is absolutely paramount. A buggy compiler is next to useless in practice. Since we cannot formally prove the correctness of your compilers, we use extensive testing. This testing is end-to-end, verifying the correctness of the generated code on sample inputs. We also verify that your compiler rejects programs as expected when the input is not well-formed (lexically, syntactically, or with respect to the static semantics), and that the generated code raises an exception as expected if the language...

Definations

Definitions: Translator A device that changes a sentence from one language to another without change of meaning.  Compiler A program that translates between programming languages.  Interpreter A processor that compiles and executes programming language statements one by one in an interleaved manner.  Syntax An alphabet and a set of rules defining spatial relationships between symbols and symbol sets in a language.  Semantics The meanings assigned to symbols and symbol sets in a language.  Pragmatics The...