ez-lang
ez-lang copied to clipboard
EeZee Language - Compiler Engineering Basics
The goal is to implement the method described in Engineering a Compiler, 3rd edition, which is based on papers by Sreedhar and Boissinot.
The copy instructions come before a branch instruction. A conditional branch may refer to a register that is being copied.
Following code should fail to compile ``` func bar(arg: Int)->Int { if (arg) return 42; return 0; } func foo()->Int { return bar(); } ```
At present we have a syntax for declaring arrays with a length and initial value to be used for elements, but this is not actually handled in the language, compiler...
The following code generates bad IR: ``` func sieve(N: Int)->[Int] { // The main Sieve array var ary = new [Int]{len=N,value=0} // The primes less than N var primes =...
Test program: ``` func bug(N: Int) { var p=2 while( p < N ) { if (p) { p = p + 1 } } while ( p < N...
This snippet fails: ``` func foo(x: Int) { var z: Int while (x > 0) { z = 5 if (x == 1) z = z+1 x = x -...
Although there is semantic difference: * var stmt introduces new name * assignment stmt assigns to existing name
This test case: ``` func foo(x: Int, y: Int)->Int { var sum: Int if (x >= y) return 0 sum = 0; while (x < y) { if (x /...
During optimization such as constant propagation, I think we will replace the phi inputs with constants, so the Phi inputs need to be Operands that accept other kind of inputs.