Semicompiled
A spectrum of intermediate representation examples for compiler writers, with corresponding source code.
Java
Hello world
Data types
Int
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from short
Cast from long
Cast from byte
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Long
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from int
Cast from short
Cast from byte
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Short
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from int
Cast from long
Cast from byte
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Byte
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from int
Cast from short
Cast from long
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Float
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from int
Cast from short
Cast from long
Cast from byte
Cast from double
Add
Subtract
Multiply
Divide
Mod
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Double
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Unbox and unbox
Cast from int
Cast from short
Cast from long
Cast from byte
Cast from float
Add
Subtract
Multiply
Divide
Mod
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Boolean
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Logical and
Logical or
Logical not
Equal
Not equal
String
Declare
Initialize
Read/write
Field read/write
Static field read/write
Literals
Return
Downcast
Equal
Not equal
Array
Declaration
Initialization with size
Initialization with elements
Element assignment
Element read
Generic
Argument
Return
Control flow
Branch
If
If, else
Branched initialization
If, else if
If, else if, else
Loop
While
Continue
Break
Switch
Integer cases
String cases
Default case
Fallthrough
Return
Exception
Throw
Try, finally
Try, finally, break
Try, catch, finally
Try, multiple catch
Try, catch multiple types
Nested-try, catch
Try, nested-catch
Static
Methods
No arguments, no return
Arguments, no return
No arguments, return
Arguments, return
Fields
Static field
Static block
Class
Declaration
Empty class
Class with constructor
Class cross-constructor
Nested class
Local class
Anonymous class
Inheritance
Interface
Methods
Method
Private method
Final method
Inherit method
Final inherit method
Fields
Declaration
Constructor initialization
Non-constructor initialization
Other
Import
Local reuse
First class function
C 99
Hello world
Data types
Int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
And
Or
Unsigned int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Short int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Unsigned short int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Long int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Unsigned long int
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from char
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Char
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from unsigned char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Unsigned char
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from float
Cast from double
Add
Subtract
Multiply
Divide
Mod
Shift left
Shift right
Bitwise and
Bitwise or
Bitwise xor
Bitwise not
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Float
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from double
Add
Subtract
Multiply
Divide
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Double
Global
Static
Local
Literals
Return
Reference
Dereference
Cast from int
Cast from unsigned int
Cast from short int
Cast from unsigned short int
Cast from long int
Cast from unsigned long int
Cast from char
Cast from unsigned char
Cast from float
Add
Subtract
Multiply
Divide
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Int*
Global
Static
Local
Literals
Return
Reference
Dereference
Add
Subtract
Less than
Less than/equal
Greater than
Greater than/equal
Equal
Not equal
Array
Global
Static
Local
Write element
Read element
Struct
Global
Static
Local
Field read
Field write
Bitfield read
Bitfield write
Assignment
Return
Reference
Dereference
Pointer field read
Pointer field write
Functions
No arg, no return
No arg, return
One arg
Two args
Recursive
Control flow
Branch
If
If, else
Branched initialization
If, else if
If, else if, else
Loop
While
Continue
Break
Switch
Integer cases
Default case
Fallthrough
Return