[m-dev.] Bootstrapping in the Java backend?

Paul Bone paul at bone.id.au
Wed Apr 17 22:53:19 AEST 2013


On Wed, Apr 17, 2013 at 07:33:24PM +1000, Julien Fischer wrote:
> Hi,
> 
> On Wed, Apr 17, 2013 at 5:55 PM, Paul Bone <paul at bone.id.au> wrote:

I'm glad there's no actual java backend problem.  I think I've already
solved the other problems you raise.

> > I've added a new Mercury program to util/ called mfilterjavac
> 
> You cannot have Mercury programs in that directory.  There's no way
> it could be compiled with the source distribution.  The contents of the util
> directory are the first thing that is built (i.e. before the standard
> library, which
> we we would need to link any Mercury program against).

I made it work by altering the way things are built in the main Makefile,
This can still build the C programs in util before the runtime, but build
the Mercury programs in util (just mfilterjavac) after the runtime and
standard library.

> It re-write javac's output to fix error locations in .java files to put to
> > the correct
> > line in the original .m file (for foreign code).  Because the java backend
> > now uses this program, but the program is written in Mercury have I created
> > a bootstrap problem?
> 
> 
> You've created a problem by putting Mercury code in the util directory.
> In any case, the Mercury compiler itself should have an option to disable
> filtering of javac output through mfilterjavac.
>

Yes, there's an --mfitlerjavac option that takes a string, it defaults to
mfilterjavac.

>  Or is this okay becase we will always build the system for C first?
> >
> 
> No, see above.  Is there any reason that mfilterjavac cannot be implemented
> in C, as per mfiltercc.

Because Mercury is a better programming language than C.  I really enjoyed
writing that sentance.  While it _could_ be written in C, I'd rather not.


-- 
Paul Bone
http://www.bone.id.au



More information about the developers mailing list