Phoenix (compiler framework)
Encyclopedia
Phoenix framework, being developed at Microsoft Research
Microsoft Research
Microsoft Research is the research division of Microsoft created in 1991 for developing various computer science ideas and integrating them into Microsoft products. It currently employs Turing Award winners C.A.R. Hoare, Butler Lampson, and Charles P...

, is a framework for developing compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

s as well as program analysis, testing and optimization tools, to be used as the back-end for future compiler technologies from Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

. It is also available as an SDK
Software development kit
A software development kit is typically a set of software development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar platform.It may be something as simple...

, a pre-release build of which has been made accessible, to create compilers and code analysis tools using the Phoenix framework.

Overview

Phoenix defines an intermediate representation (IR) for programs, using AST
Abstract syntax tree
In computer science, an abstract syntax tree , or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code. The syntax is 'abstract' in the sense that it...

s, control flow graph
Control flow graph
A control flow graph in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution.- Overview :...

s, and an exception handling model. For any program to be handled by Phoenix, it needs to be converted to this representation. The specification for these file type-specific converters, called file readers in Phoenix terminology, is also specified. Phoenix comes included with readers for Portable Executable
Portable Executable
The Portable Executable format is a file format for executables, object code and DLLs, used in 32-bit and 64-bit versions of Windows operating systems. The term "portable" refers to the format's versatility in numerous environments of operating system software architecture...

 binary files, CIL
Common Intermediate Language
Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and is used by the .NET Framework and Mono...

 and the output of the Visual C++
Visual C++
Microsoft Visual C++ is a commercial , integrated development environment product from Microsoft for the C, C++, and C++/CLI programming languages...

 front-end. Readers for other languages can be written using the Phoenix SDK, though separate tools such as lex and yacc
Yacc
The computer program yacc is a parser generator developed by Stephen C. Johnson at AT&T for the Unix operating system. The name is an acronym for "Yet Another Compiler Compiler." It generates a parser based on an analytic grammar written in a notation similar to BNF.Yacc used to be available as...

 need to be used to write the lexer
Lexical analysis
In computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens. A program or function which performs lexical analysis is called a lexical analyzer, lexer or scanner...

 and parser, respectively.

Once the program has been converted to the IR, the analysis and optimization tools can operate on that form. Phoenix includes a selection of tools - including block counting, memory analysis, code coverage
Code coverage
Code coverage is a measure used in software testing. It describes the degree to which the source code of a program has been tested. It is a form of testing that inspects the code directly and is therefore a form of white box testing....

, code analysis and optimization
Compiler optimization
Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the amount of memory occupied...

. The Phoenix SDK can be used to write and plug-in other tools as well. Code generation is handled by providing architecture-specific (either physical architecture of the processor or a virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 architecture) file writers. Phoenix provides the c2.exe compiler backend, which it shares with Visual C++, to handle analysis, optimization and code generation for the x86 architecture. Writers for other architectures must be provided separately.

As a result of the modular architecture, any component can be replaced without affecting the rest of the system. For example, to target the compiler to a different architecture, only the file writer specific to the architecture needs to be changed, keeping the rest of the stack unchanged. To create a compiler for a new language, only the readers need to be provided.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK