Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> wrote:That's not the complexity I had in mind. The 100-200MB sizes of LLVM-based compilers are not because they use hash-tables over linear search.On 10/11/2024 06:00, Waldek Hebisch wrote:More complicated does not mean slower. Binary search or hash tablesBart <bc@freeuk.com> wrote:>>I'd would consider a much elaborate one putting the onus on external>
tools, and still having an unpredictable result to be the poor of the two.
>
You want to create a language that is easily compilable, no matter how
complex the input.
Normally time spent _using_ compiler should be bigger than time
spending writing compiler. If compiler gets enough use, it
justifies some complexity.
That doesn't add up: the more the compiler gets used, the slower it
should get?!
are more complicated than linear search, but for larger data may
be much faster.
More generaly, I want to minimize time spent by the programmer,What's the context of this 0.1 seconds? Do you consider it long or short?
that is _sum over all iterations leading to correct program_ of
compile time and "think time". Compiler that compiles slower,
but allows less iterations due to better diagnostics may win.
Also, humans perceive 0.1s delay almost like no delay at all.
So it does not matter if single compilation step is 0.1s or
0.1ms. Modern computers can do a lot of work in 0.1s.
Yes. This may lead to some complexity. Simple approach is toI consider compilation: turning textual source code into a form that can be run, typically binary native code, to be a completely routine task that should be as simple and as quick as flicking a light switch.
avoid obviously useless recompilation ('make' is doing this).
More complicated approach may keep some intermediate data and
try to "validate" them first. If previous analysis is valid,
then it can be reused. If something significant changes, than
it needs to be re-done. But many changes only have very local
effect, so at least theoretically re-using analyses could
save substantial time.
The example came from C. Even if written as a switch, C switches do not return values (and also are hard to even analyse as to which branch is which).Since now that last statement is the '0' value (any int value wil do).Currently in typed language that I use literal translation of
What should my compiler report instead? What analysis should it be
doing? What would that save me from typing?
the example hits a hole in checks, that is the code is accepted.
Concerning needed analyses: one thing needed is representation of
type, either Pascal range type or enumeration type (the example
is _very_ unatural because in modern programming magic numbers
are avoided and there would be some symbolic representation
adding meaning to the numbers). Second, compiler must recognize
that this is a "multiway switch" and collect conditions.
OnceThe types are tyically plain integers, with ranges from 2**8 to 2**64. The ranges associated with application needs will be more arbitrary.
you have such representation (which may be desirable for other
reasons) it is easy to determine set of handled values. More
precisely, in this example we just have small number of discrete
values. More ambitious compiler may have list of ranges.
If type also specifies list of values or list of ranges, then
it is easy to check if all values of the type are handled.
40 minutes for 400K lines? That's 160 lines per second; how old is this machine? Is the compiler written in Python?You can't do this stuff with the compilers David Brown uses; I'mTo recompile the typed system I use (about 0.4M lines) on new fast
guessing you can't do it with your prefered ones either.
machine I need about 53s. But that is kind of cheating:
- this time is for parallel build using 20 logical cores
- the compiler is not in the language it compiles (but in untyped
vesion of it)
- actuall compilation of the compiler is small part of total
compile time
On slow machine compile time can be as large as 40 minutes.
An untyped system that I use has about 0.5M lines and recompilesSo 4K to 30Klps.
itself in 16s on the same machine. This one uses single core.
On slow machine compile time may be closer to 2 minutes.
Again, compiler compile time is only a part of build time.Which is not going to be part of a routine build.
Actualy, one time-intensive part is creating index for included
documentation.
Another is C compilation for a library fileMy language tools work on a whole program, where a 'program' is a single EXE or DLL file (or a single OBJ file in some cases).
(system has image-processing functions and low-level part of
image processing is done in C). Recomplation starts from
minimal version of the system, rebuilding this minimal
version takes 3.3s.
Anyway, I do not need cascaded recompilation than you present.This sounds like a REPL system. There, each line is a new part of the program which is processed, executed and discarded. In that regard, it is not really what I am talking about, which is AOT compilation of a program represented by a bunch of source files.
Both system above have incermental compilation, the second one
at statement/function level: it offers interactive prompt
which takes a statement from the user, compiles it and immediately
executes. Such statement may define a function or perform compilation.
Even on _very_ slow machine there is no noticable delay due to
compilation, unless you feed the system with some oversized statement
or function (presumably from a file).
Les messages affichés proviennent d'usenet.