本文介绍了Microsoft CCI - 资源,编写编译器的参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间,我正在编译器,我使用 System.Reflection 从我的AST生成代码(IL)。现在,我有一个想要的另一个编译器,我想工作(它将是另一个宠物项目,没有什么将被用于生产代码,至少,现在)。



如你所知,宠物项目比生产代码有一个很大的优势:你可以实验和失败。因此,我决定尝试使用编写编译器。



我发现的唯一好的参考是一个基本语言的示例编译器(这是CCI在codeplex上的一部分),但我更喜欢有一些其他资源,更像教程,书籍,文章,我可以得到更多的信息,而不是学习代码(这不总是最好的方法来学习的东西,因为你看到一个解决方案,但你不知道你的替代品,或为什么这样的代码工作)。



所以:在编写编译器和处理AST的上下文中,你有关于CCI的任何资源(教程,书)吗?

解决方案

首先,我会为那些不熟悉CCI的人提供几个链接:


  1. 项目,用于生成和编译抽象语法树。

  2. 项目,用于读取/写入clr的元数据程序集,支持也读/写pdb。

  3. 项目包含小型基本编译器,我是在第一篇文章中提到。

  4. 介绍CCI,有点为什么和如何?

  5. - 并发C编译器,在CCI之上。我还没有挖掘它,但我期望它是另一个大项目,没有任何解释,不是从一开始就学习构建编译器(除此之外,它主要是用F#编写)。


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?

解决方案

For the start, I'll throw few links, for those, who aren't familiar with CCI:

  1. CCI-AST project for generating and compiling abstract syntax trees.
  2. CCI-Metadata project for reading / writing meta data of clr assemblies, supports also reading / writing pdb.
  3. CCI-Samples project contains small basic compiler, which I was referring to in 1st post.
  4. Lang.Net presentation about CCI, a little "why and how?"
  5. 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#).

这篇关于Microsoft CCI - 资源,编写编译器的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 07:46