Reggae [was Building C++ modules]

Jacob Carlborg doob at me.com
Tue Aug 13 09:13:50 UTC 2019


On 2019-08-12 11:47, Atila Neves wrote:

> That's a good question. The thing is I basically want to rewrite reggae 
> from scratch, and, worse than that, am trying to figure out how to best 
> leverage the work done in this paper:
> 
> https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=2ahUKEwjmtM7hhf3jAhXr0qYKHZRUCoYQFjAAegQIABAC&url=https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fresearch%2Fuploads%2Fprod%2F2018%2F03%2Fbuild-systems-final.pdf&usg=AOvVaw2j71hXjOoEQLNNjvEOp_RQ 
> 
> 
> (Build Systems à la carte by Microsoft Research, in which they show how 
> to compose different types of build systems in Haskell)
> 
> It's clear to me that the current way of building software is broken in 
> the sense that we almost always do more work than needed. My vision for 
> the future is a build system so smart that it only rebuilds mod1.d if 
> mod0.d was modified in such a way that it actually needs to. For 
> instance, if the signatures of any functions imported are changed. I 
> think that paper is a step in the right direction by abstracting away 
> how changes are computed.

I suggest you look into incremental compilation, if you haven't done 
that already. I'm not talking about recompiling a whole file and relink. 
I'm talking incremental lexing, parsing, semantic analyzing and code 
generation. That is, recompile only those characters that have changed 
in a source file and what depends on it.

For example: "void foo()". If "foo" is changed to "bar" then the 
compiler only needs to lex those three characters: "bar". Then run the 
rest of the compiler only on AST nodes that is dependent on the "bar" token.

The Eclipse Java compiler (JDT) has a pretty interesting concept. It 
allows to compile and run invalid code. I'm guessing a bit here, but I 
assume if a function has a valid signature and the body is syntactically 
valid but semantically it contains errors. The compiler will replace the 
body of the function with a runtime error. If that function is never 
called at runtime there is no problem. Similar to how templates work in D.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list