问题
Some time ago, I was working on compiler, I've used System.Reflection
to generate code (IL) from my AST. Now, I've an idea for another compiler that I'd like to work on (it will be another pet project, nothing that will be used in production code, at least, not now).
As you know, pet projects have one big advantage over production code: you can experiment and fail. So, I've decided to try to write compiler using Microsoft's CCI.
The only good reference I've found is a sample compiler of basic language (that is a part of CCI on codeplex), but, I'd prefer to have some other resources, more like tutorials, books, articles, where I could get more information other than studying code (which isn't always the best method to learn something, as you see a solution, but you don't know what alternatives you have, or why such code works).
So: Do you have any resources (tutorials, books) about CCI, in context of writing compilers and handling AST?
回答1:
For the start, I'll throw few links, for those, who aren't familiar with CCI:
- CCI-AST project for generating and compiling abstract syntax trees.
- CCI-Metadata project for reading / writing meta data of clr assemblies, supports also reading / writing pdb.
- CCI-Samples project contains small basic compiler, which I was referring to in 1st post.
- Lang.Net presentation about CCI, a little "why and how?"
- VCC - concurrent c compiler, on top of CCI. I haven't dug into it yet, but I expect it to be another big project, without any explanations, not that good for learning constructing compilers from the beginning (beside this, it's mainly written in F#).
来源:https://stackoverflow.com/questions/1380380/microsoft-cci-resources-references-for-writing-compilers