Professional Documents
Culture Documents
Machine
C# Compiler
Senior Project
Proposal
Front-
end
Back-
end
Motivation
§ Evolution of Computer Programming
§ Managed Code vs Unmanaged Code
§ Bulky .NET Framework
§ Operating Systems written in
managed code
Motivation
§ Why Low Level Virtual Machine?
– Source Language independent
– Retargetable code generator
– Supports various architectures
• X86, PowerPC, ARM
– Open source
Low Level Virtual
Machine
§ It is not
– a compiler,
– a virtual machine alike JVM, .NET
Framework
§ It is
– A modular compiler infrastructure
• a collection of (C++) libraries and tools to
help in building compilers, debuggers,
program analyzers etc.
Low Level Virtual
Machine
§ Commonly referred to as LLVM
§ Started as academic project at
University of Illinois on 2002.
§ Current development mainly by
Apple Inc.
§ Projects related to LLVM
– Clang: C/C++ front-end; aims to replace
gcc
– OpenGL engine in Mac OS X 10.5
– used by Adobe Systems Inc., Nvidia, Sun
Scope
§ Keywords- Categories
§ Operators and Special Characters
§ Source Language Features
Scope Categories
§ Types
§ Conditionals
§ Loops
Scope Categories
§ Single Inheritance
§ Encapsulation
§ Overloading Operators
§ Modifiers
§ Type Casting
Keywords
Operators and Special
Characters
Source Language Feature
Summary
§ Single class Inheritance
§ Encapsulation
§ Overloadable Operators
§ Method Overloading/Overriding
§ Properties (Accessors / Mutators)
The Framework
§ Overall Process
§ Scanner
§ Parser
§ Semantic Analyzer
§ Code Generator
§ Assembling and Linking
Overall Process
Overall Process
Scanner
§ Tokenization Process- Identifying the
tokens from the input stream.
§ Skip meaningless characters, white
spaces,
§ Lexical Analysis- Checking for Lexical
Errors
§ Using Coco/R tool the scanner and
parser are generated at the same
time.
Parser
§ Syntax Analysis is performed at this
phase.
§ Coco/R generates a recursive
descent parser.
– Top down parsing method
– Procedural-like functions
– Generally for each production rule, one
procedure is generated.
§ Synchronization Technique
– SYNC symbols are placed in the grammar,
where there’s unlikely to be errors.