RISC OS Asm and BASIC Fun : Tutorials.Compiler.Part1
PREV:Overview Return to Tutorials NEXT:Part2
Tutorials.Compiler.Part1
An Introduction to Recursive Descent Compilers.

What is a compiler
A compiler is a program that takes source code for a program written in the programming language it understands and produces executable object code, that runs native on the target CPU and Operating System.

In order to do its job a compiler works in multiple parts, the lexer to ignore comments extra spaces and retrieve the next token (more on that later), the parser to determine what needs to be done in what order, and some form of code generation, driven by the parser, which is often split into multiple steps. Each of these steps are done as the compiler steps through the program.

Some compilers add another step at the beginning by having a pre-processor, this is not needed for our particular target.

After the compiler does its work it is common place for another program to process the code produced to improve the optimisation of the produced code. This is usually done with a compiler that emits assembly language code, not with a compiler that directly produces executable code.


What is a Recursive Descent Compiler:
A Recursive descent compiler is a compiler that uses a recursive descent parser for handling priority of operators in expressions correctly.

I am in the process of rewriting this section to be more readable than my last attempt, sorry about that for anyone that may still be trying to understand what I had written here before.