Making a language, need a good backend

左心房为你撑大大i 提交于 2019-12-03 16:15:58

Have you considered writing a frontend for GCC? I mention this for completeness’ sake only – as far as I know the backend interface is quite complicated and the codebase is huge and hard to comprehend.

On the other hand, GCC is a mature product with many expert programmers working on it. At the very least, it probably provides the most solid basis of all the alternatives.

Personally, I would prefer LLVM (exciting architecture) or .NET’s IL: very, very easy to use, has great tool support (Reflector, Cecil, Reflexil and last but not least, the .NET reflection API) and two very efficient implementations (namely Microsoft’s canonical implementation and Mono).

But I can’t claim expertise in any of the architectures so take this answer with a grain of salt.

In that case LLVM is probably a better choice.

LLVM has Windows support, it just takes some time to compile

C++ won't give you much, use C instead. But if you want you language to be used in the Web, use .NET or Java, sure they slow to load but when they are, they as fast as C.

For SmartEiffel we use C as a back-end.

Tcc is a very good option for development- though not for final release (the produced object is equivalent to gcc -O0)

Another to add to the list: Slava recently implemented Smalltalk on a Factor backend. I haven't tried this myself, but I have the feeling it would offer more of the features you want from the higher-level ones with more like the size/performance from the lower-level ones.

TCC is the best choice. It is portable and it has a library so it can easily be used as a backend which is called libtcc. The executables are smaller than gcc and it is ANSI C.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!