PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

CIL

CIL

CIL, aka Common Intermediate Language, is a pl created in 2000.

#119on PLDB 22Years Old 1.1kUsers
4Books 4Papers

Try now: Riju

Common Intermediate Language (CIL, pronounced either sil or kil), formerly called Microsoft Intermediate Language (MSIL), is the lowest-level human-readable programming language defined by the Common Language Infrastructure (CLI) specification and is used by the .NET Framework and Mono. Languages which target a CLI-compatible runtime environment compile to CIL, which is assembled into an object code that has a bytecode-style format. CIL is an object-oriented assembly language, and is entirely stack-based. Read more on Wikipedia...


Example from the web:
.assembly Hello {} .assembly extern mscorlib {} .method static void Main() { .entrypoint .maxstack 1 ldstr "Hello, world!" call void [mscorlib]System.Console::WriteLine(string) ret }
Example from Riju:
.assembly main {} .class Main { .method static void Main() cil managed { .entrypoint ldstr "Hello, world!" call void [mscorlib]System.Console::WriteLine(string) ret } }
Example from hello-world:
// ilasm cil.il .assembly HelloWorld {} .method public static void Main() cil managed { .entrypoint .maxstack 1 ldstr "Hello World" call void [mscorlib]System.Console::WriteLine(string) ret }
Example from Wikipedia:
.method assembly static void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) test_pointer_operations(int32 param) cil managed { .vtentry 1 : 1 // Code size 44 (0x2c) .maxstack 2 .locals ([0] int32* ptr, [1] valuetype A* V_1, [2] valuetype A* a, [3] int32 k) // k = 0; IL_0000: ldc.i4.0 IL_0001: stloc.3 // ptr = &k; IL_0002: ldloca.s k // load local's address instruction IL_0004: stloc.0 // *ptr = 1; IL_0005: ldloc.0 IL_0006: ldc.i4.1 IL_0007: stind.i4 // indirection instruction // ptr = &param IL_0008: ldarga.s param // load parameter's address instruction IL_000a: stloc.0 // *ptr = 2 IL_000b: ldloc.0 IL_000c: ldc.i4.2 IL_000d: stind.i4 // a = new A; IL_000e: ldloca.s a IL_0010: call valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall) 'A.{ctor}'(valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst)) IL_0015: pop // ptra = &a; IL_0016: ldloca.s a IL_0018: stloc.1 // ptra->meth(); IL_0019: ldloc.1 IL_001a: dup IL_001b: ldind.i4 // reading the VMT for virtual call IL_001c: ldind.i4 IL_001d: calli unmanaged stdcall void modopt([mscorlib]System.Runtime.CompilerServices.CallConvStdcall)(native int) IL_0022: ret } // end of method 'Global Functions'::test_pointer_operations

Language features

Feature Supported Example Token
Strings
"Hello world"
"
Print() Debugging call void [mscorlib]System.Console::WriteLine
Comments
// A comment
Line Comments
// A comment
//
Semantic Indentation ϴ

Books about CIL on goodreads

title author year reviews ratings rating
CIL Programming: Under the Hood of .Net Jason Bock 2002 0 2 3.50

Books about CIL from ISBNdb

title authors year publisher
CIL Programming: Under the Hood of .NET (Expert's Voice) Bock, Jason 2008 Apress
CIL Programming: Under the Hood of .NET Bock, Jason 2002 Apress
CIL Programming: Under the Hood of .NET Bock, Jason 2013 Apress

Publications about CIL from Semantic Scholar

title authors year citations influentialCitations
CIL + Metadata > Executable Program Giuseppe Attardi and A. Cisternino and Diego Colombo 2004 8 0
Interactive verification of communication software on the basis of CIL H. Krumm and O. Drobnik 1984 7 1
CIL Programming: Under the Hood™ of .NET Jason Bock 2002 5 0
CIL to Java-Bytecode Translation for Static Analysis Leveraging Pietro Ferrara and A. Cortesi and F. Spoto 2018 3 0
visual-basic-dot-net.html · cil.html · antlr.html

View source

PLDB - Build the next great programming language · v2022 · Day 33 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com