Questions tagged [intermediate-language]

An intermediate language, in compiler design, is a low-level language that typically resembles an idealized assembly language, often a textual representation of bytecode for a virtual machine. For .NET's CIL, use the [cil] tag.

An intermediate language, in compiler design, is a translation stage after the syntax tree and before the machine code. The term is usually used for final stages of the translation, after high-level optimizations have been performed, but at a stage when the translation is still independent of the target machine.

In particular, “intermediate language” often means a low-level, assembly-like language for a virtual machine such as the JVM, .NET, Prolog's WAM, etc.

For example, the .NET Common Intermediate Language is the assembly language for the virtual machine that is the target of and other compilers.

144 questions
0
votes
0 answers

Casting errors with conversion operators

I am getting an Invalid Cast Exception when doing Bar = IFoo but not when Bar = Foo even though that during run time the IFoo object is of Type Foo. The issue here is that the assemblies that work with the Bar Class should not not know about the Foo…
user6901794
0
votes
1 answer

Backpatch to flow-of-control of FOR LOOP

I am looking for Backpatching in FOR-LOOP. I know this approach at IF-THEN-ELSE is in this way: IF '(' expr M ')' stmt N ELSE L stmt L { backpatch($4, $9 - $4); backpatch($7, $11 - $7); } You can use these markers in your answer: FOR '(' expr…
0
votes
1 answer

Performance and compilation of null propagation operator

This is specifically referring to some C# properties I want to rewrite. Example of one of the original properties: public double? PartQuantity { get { if( MaintenanceRequestPart != null ) return…
Jmaurier
  • 767
  • 2
  • 10
  • 28
0
votes
1 answer

Add InstNamer pass in llvm as a required pass

I am performing an optimization in llvm that requires the InstNamer pass to be run before my optimization. Currently, I am running it by manually passing "-instnamer" to opt. Is there a way I can add InstNamer as a required pass in the code? I…
0
votes
0 answers

Are the placeholders of Generics compiled as an actual data type?

My question relates to how exactly Generics (in C#) are compiled. Code sample public class MyClass { public void MyMethod(Foo test) { } } Questions Would the Foo type in MyMethod be compiled as a concrete type? I would imagine…
Brummy
  • 183
  • 1
  • 11
0
votes
1 answer

In terms of pseudo-code, what does the MoveNext in an IAsyncStateMachine in MIL do?

I'm trying to understand the state machine that is created when using async-await. I take the simple piece of C# code using System; using System.Net; using System.Threading.Tasks; public class C { public static async Task
0
votes
1 answer

Single Pass Compiler Intermediate Representation?

I've been reading through the dragon book and I'm wondering about single pass compilers, so correct me if I am mistaken but as a compiler goes through analysis it generates a more and more accurate intermediate representation, or maybe accurate…
Trevor Hart
  • 993
  • 7
  • 26
0
votes
3 answers

Is it misleading to say that intermediate code runs in a virtual machine

If I am correct in understanding what I've read a virtual machine is essentially a compiler for intermediate code. But it is never said that Delphi (as an example of unmanaged code) runs in its compiler. Would it be less confusing to just describe a…
0
votes
2 answers

WPF click event triggering twice under specific build enviroment

We are facing a strange problem. We have a user control written in WPF and we have added a click event handler in the xaml file. On local system it works as expected. But when the build is generated on the server (where we have the code repository),…
mishal153
  • 1,498
  • 3
  • 26
  • 37
0
votes
1 answer

How to pass value when subscribing to event and obtain it when the event is triggered (DynamicMethod usage problems)

The task is to create event handlers in runtime. I need the one method to be called with different parameter value for different events. The events and their number are only known in runtime. So I'm trying to generate dynamic methods, each of which…
Yegor
  • 2,514
  • 2
  • 19
  • 27
0
votes
2 answers

ildasm and dynamic exe files

I am trying to create an application can modify properties in IL to create a slightly different executable. E.g Client A runs app and a label on the WinForm label Reads "Client A:". Client B runs the app and Label Says "Client B". Easy I know using…
TonyNeallon
  • 6,607
  • 12
  • 42
  • 49
0
votes
0 answers

What does an addition operation look like in intermediate code/three address code?

If I write a function as follows int sum(int i) { if(!i) return 0; return sum(i--) + i; //this line } How does the compiler represent the return statement in terms of three address code/intermediate code? Does 1) return i-- + sum(i) differ…
Dubby
  • 1,154
  • 3
  • 16
  • 31
0
votes
1 answer

Javascript object representation format

In compiler IR representation, we know that function type can be represented using Cartesian Product. For example: function my_func(a, b) { return c; } the function type can be denoted as: (int × double)->int (note that here I assume that all…
0
votes
1 answer

Intermediate Code Generation for my Fortran compiler: DAG or quadruples

I'm writing a mini Fortran compiler using Flex and Bison. Up to now I've finished the lexical and syntax analysis. I'm in the semantic analysis in type checking and I must now choose an IR. My target machine is MIPS. So I want final code generation…
0
votes
0 answers

Semantic Analysis For Simple Compile-To-C Language

So I'm working on creating a simple, compile-to-C language that has syntax similar to Python. Here is some sample source code: # All comments start with pound signs # Integer declaration speed = 4 motor = 69.5 text = "hey + guys!" junk = 5 …
turnt
  • 3,235
  • 5
  • 23
  • 39
1 2 3
9
10