frankpfenning / C0

C0 Language
4 stars 0 forks source link

Standardize mlton versus smlnj compilation #46

Closed robsimmons closed 11 years ago

robsimmons commented 11 years ago

I'd like to modify the Makefile to use a conditional expression to choose between SML and MLton compilation.

So in other words, this would build with the default compiler:

$ make
$ make coin
$ make code 

This would build with SMLNJ:

$ make SMLNJ=true
$ make coin SMLNJ=true
$ make code SMLNJ=true

And this would build with MLton:

$ make MLTON=true
$ make coin MLTON=true
$ make code MLTON=true

Furthermore, I think that with the extremely slow build times resolved, it would make sense to have MLton be the default compiler - if I teach wrappergen how to compile with MLton, then the c0 tools won't even require the SML/NJ compiler. (This is kind of nice because SML/NJ isn't currently available through the ubuntu/debian/macports systems.)

frankpfenning commented 11 years ago

As long as (a) it exits gracefully for impossible combinations, (b) we make sure that we will build under two compilers indefinitely, then I approve of this change.

mlton just isn't very good for development.

robsimmons commented 11 years ago

Ok, I'll play with this later today, leaving NJ as the default since most of the time we use the makefile for development anyway.

robsimmons commented 11 years ago

This is done; I've updated the README. make now makes cc0, coin, code, the runtimes, and the libraries with SML/NJ, and make MLTON=true makes all of these with MLton. The only compiler-specific dependency is that the regression tests only work with MLton; there's really no fundamental reason why this has to be the case, I think, but I'll let somebody else set that up if they want to.

robsimmons commented 11 years ago

This is done; I've updated the README. make now makes cc0, coin, code, the runtimes, and the libraries with SML/NJ, and make MLTON=true makes all of these with MLton. The only compiler-specific dependency is that the regression tests only work with MLton; there's really no fundamental reason why this has to be the case, I think, but I'll let somebody else set that up if they want to.

frankpfenning commented 11 years ago

I think the defaults are wrong, because coin and code do not work when compile with SML/NJ. We should always be able to build a working version of the appropriate binary by saying

make cc0 make coin make code

So the defaults should be either all mlton (which seems to make sense now that it compiles fast), or smlnj for cc0 and mlton for coin and code. Setting all defaults to mlton would make sense, because in development mode I start sml/nj by hand and then CM.make "compiler/sources.cm".

robsimmons commented 11 years ago

Switched defaults in r248, NJ=true now compiles everything with NJ. Coin and code do work with SMLNJ, but they don't work fully with the libraries; there are plenty of situations where NJ compilation, even of coin and code, makes sense.