On Sun, 17 Dec 2006, Brian Hurt wrote: > - Use C--. You still have to implement your runtime, but you're basically > going to have to do that anyways. You get decent optimization, you get to > write your compiler in the language you want to, and functional languages > are first class languages.
Another option that you didn't, but Norman, did, mention: LLVM (http://llvm.org/). While Norman characterized LLVM as being for JIT compilation only, it supports static compilation really well and provides support some aggressive compilation models (link time optimization, runtime optimization, install time optimization, etc) in addition to simple static compilation. LLVM is written in C++, but, like C--, it provides first-class support for intermediate representation written as a text file (described here: http://llvm.org/docs/LangRef.html), which allows you to write your compiler in the language that makes the most sense for you. In addition to the feature set of C--, LLVM provides several useful pieces of infrastructure: a C/C++/ObjC front-end based on GCC 4, JIT support, aggressive scalar, vector (SIMD), data layout, and interprocedural optimizations, support for X86/X86-64/PPC32/PPC64/Sparc/IA-64/Alpha and others, far better codegen than C--, etc. Further, LLVM has a vibrant community, active development, large organizations using and contributing to it (e.g. Apple), and it is an 'industrial strength' tool, so you don't spend the majority of your time fighting or working around our bugs :). Like C--, LLVM doesn't provide with a runtime (beyond libc :) ), which can be a good thing or a bad thing depending on your language (forcing you to use a specific runtime is bad IMHO). I would like to see someone develop a runtime to support common functional languages out of the box better (which language designers could optionally use), but no-one has done so yet. OTOH, C-- does have some features that LLVM does not yet have first class support for. LLVM does not currently support for generating efficient code that detects integer arithmetic overflow, doesn't expose the rounding mode of the machine for FP computation, and does not yet support multiple return values, for example. While it is missing some minor features, one of the most important features of LLVM is that it is relatively easy to extend and modify. For example, right now LLVM's integer type system consists of signed and unsigned integers of 1/8/16/32 and 64-bits. Soon, signedness will be eliminated (giving us the equivalent of C--'s bits8/bits16/bits32/bits64 integer types) and after that, we plan to generalize the integer types to allow any width (e.g. bits11). This is intended to provide better support for people using LLVM for hardware synthesis, but is also useful for precisely constrainted types like those in Ada (i.e. it communicates value ranges to the optimizer better). > I think the three new things I'd like to see out of C-- are (in rough > order of priority): > 1) x86-64 support > 2) the ability to move/copy a stack frame from one stack to another, and > 3) Some form of inline assembler without having to go to C (necessary for > writting threading primitives in C--) LLVM provides #1 and #3 'out of the box'. #2 requires runtime interaction, which would be developed as part of the runtime aspect. For me, one disappointment of the LLVM project so far is that we have not been very successful engaging the functional language community. We have people that use LLVM as "just another C/C++/Objc compiler", we have people that reuse the extant front-ends and optimizer to target their crazy new architectures, and we have mostly-imperative language people (e.g. python) using LLVM as an optimizer and code generator. If we had a few knowledgable people who wanted to see support for functional languages excel, I believe LLVM could become the premier host for the functional community. If you are considering developing aggressive new languages, I strongly recommend you check out LLVM. The llvmdev mailing list (http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev) is a great place to ask questions. -Chris -- http://nondot.org/sabre/ http://llvm.org/ _______________________________________________ Cminusminus mailing list Cminusminus@cminusminus.org https://cminusminus.org/mailman/listinfo/cminusminus