XeonBD Official Blog

27Feb/100

What is a compiler?

A compiler is a computer program (or set of programs) that transforms source code written in a computer language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable  program.

The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code). A program that translates from a low level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a language translator, source to source translator, or language converter. A language rewriter is usually a program that translates the form of expressions without a change of language.

A compiler is likely to perform many or all of the following operations: lexical analysis, preprocessing, parsing, semantic analysis, code generation, and code optimization.

Program faults caused by incorrect compiler behavior can be very difficult to track down and work around and compiler implementors invest a lot of time ensuring the correctness of their software.

The term compiler-compiler is sometimes used to refer to a parser generator, a tool often used to help create the lexer and parser.

27Feb/100

Reserved Words

Reserved Words

The identifiers listed below are reserved C keywords. You shouldn't use them for any other purpose in a C program. They are allowed, of course, within double quotation marks.

Reserved C keywords:

Keyword Description
asm Keyword that denotes inline assembly language code.
auto The default storage class.
break Command that exits for, while, switch, and do...while statements unconditionally.
case Command used within the switch statement.
char The simplest C data type.
const Data modifier that prevents a variable from being changed. See volatile.
continue Command that resets a for, while, or do...while statement to the next iteration.
default Command used within the switch statement to catch any instances not specified with a case statement.
do Looping command used in conjunction with the while statement. The loop will always execute at least once.
double Data type that can hold double-precision floating-point values.
else Statement signaling alternative statements to be executed when an if statement evaluates to FALSE.
enum Data type that allows variables to be declared that accept only certain values.
extern Data modifier indicating that a variable will be declared in another area of the program.
float Data type used for floating-point numbers.
for Looping command that contains initialization, incrementation, and conditional sections.
goto Command that causes a jump to a predefined label.
if Command used to change program flow based on a TRUE/FALSE decision.
int Data type used to hold integer values.
long Data type used to hold larger integer values than int.
register Storage modifier that specifies that a variable should be stored in a register if possible.
return Command that causes program flow to exit from the current function and return to the calling function. It can also be used to return a single value.
short Data type used to hold integers. It isn't commonly used, and it's the same size as an int on most computers.
signed Modifier used to signify that a variable can have both positive and negative values. See unsigned.
sizeof Operator that returns the size of the item in bytes.
static Modifier used to signify that the compiler should retain the variable's value.
struct Keyword used to combine C variables of any data type into a group.
switch Command used to change program flow in a multitude of directions. Used in conjunction with the case statement.
typedef Modifier used to create new names for existing variable and function types.
union Keyword used to allow multiple variables to share the same memory space.
unsigned Modifier used to signify that a variable will contain only positive values. See signed.
void Keyword used to signify either that a function doesn't return anything or that a pointer being used is considered generic or able to point to any data type.
volatile Modifier that signifies that a variable can be changed. See const.
while Looping statement that executes a section of code as long as a condition remains TRUE.