So I worked up a few examples using a simplified version of CIL and have been working on a compiler to take that simplified CIL (lets call it.. SIL? haha) and compile it into CIL.
SIL so far in my design just makes it so that you dont have to set .maxstack, adds a MOV instruction, you use a the same instruction for pushing/popping off the stack no matter what it is, and it slims down on method calling.
Heres an example of SIL and then the equivalent CIL:
int32 amov a 50 //now you dont have to push 50 on the stack and then pop it into ald "Hello"call System.Console::Writeret
.locals init (int32 a) ldc.i4 50 stloc a ldstr "Hello" call void [mscorlib]System.Console::Write(string) ret
The compiler is very crude and hacked together at the moment but it does do some things. Next thing I want to do is clean up the compiler code and organize it into classes and such.