I want to write my own JIT compiler for CIL and I don't want use library to generate compiler. Do you have any tutorial, ebook or example?
            Asked
            
        
        
            Active
            
        
            Viewed 738 times
        
    1
            
            
        - 
                    MSIL opcodes are super well documented on MSDN - just read up on all of them and figure out a way to either translate it into assembly, translate it into another language that you can compile, or just interpret it on the fly! You will need to write a garbage collector though. – Mike Marynowski Jun 24 '13 at 15:20
2 Answers
0
            
            
        Here ya go, this should be a pretty good resource.
Some of them are ruby-specific, but there are plenty that aren't, as well.
 
    
    
        Community
        
- 1
- 1
 
    
    
        Phillip Schmidt
        
- 8,805
- 3
- 43
- 67
- 
                    Many of those don't apply here at all, or are only tangibly related. That question is about writing a compiler for a casual programming language - which implies parsing source code, handling things like precedence, juggling ASTs, and finally creating some code, most likely bytecode or even a high-level language - *perhaps* assembler code. A JIT-compiler for CIL would have a vastly simpler frontend, but would have a lot of work encoding machine instructions, managing memory for them, convincing the OS to execute it, replacing already-compile code, etc. – May 30 '12 at 18:36
- 
                    like i said, not all of them are going to apply, but there are quite a few that will. Particularly Dragon Book -- I haven't read it myself, but I've heard good things about it. – Phillip Schmidt May 30 '12 at 18:42
- 
                    and there are several others that would help too -- Compiler Basics, Compiler Construction, Compiler Design and Construction, Want to Write a Compiler?, etc. All of these should be of help – Phillip Schmidt May 30 '12 at 18:43
- 
                    Yes, it's not too bad - I didn't downvote for a reason. But I wouldn't consider it a perfect fit, as optimizing relatively low-level bytecode isn't quite the same as converting a high-level language into, for instance, C. – May 30 '12 at 18:47
 
    