Good day. I apologize for the earlier question from homework, I just don’t understand at all how to approach it, the question is theoretically:

I studied a little Swift language, in the theoretical part a question is asked about the "length" of its compiler, measured in the number of lines, characters or total size.

Who can can explain to me where this information to dig out, in what bowels? There is a link to the source , but I have no idea that from this heap of files there is a compiler and even more so how to measure it? Stupid question, but still, please help.

You also need to find a compiler of another language, in what language it was written and also its size, for comparison.

  • 2
    Well, it would be reasonable to assume that from this pile of files everything is a compiler. - VladD
  • If you use the script from the question about counting lines , you can get the figure: 1381170 - Grundy
  • one
    @VladD, well, there are still more tests, benchmark, docks and a lot of other things :) - Grundy
  • Grundy, I'm a little confused with the script, you need to tinker with your powershell to make it work. You can prompt to the Perl 5 account by following this link, for example: github.com/Perl/perl5 The same question, how many lines, I will be grateful. - Avenger
  • one
    @Grundy: Well, yes. But the documentation is part of the compiler . And tests too! The project without tests - incubator bugs. - VladD

1 answer 1

but I have no idea that from this heap of files there is a compiler and even more so how to measure it

Yes, to search for such information on source codes is not a simple matter. But, @Avenger, this question is difficult at first glance. But as they say "in the correctly asked question - contains 50% of the answer." We look at the question "compiler code size". We draw attention to the fact that the code of a particular programming language is not indicated, it is not indicated that it is necessary to search in the source code! So boldly use this loophole.

And then it becomes simple

  • looking for statically-linked modules of compilers under consideration
  • disassemble them, we get an assembler code

Number of lines and listing size - received. To get the number of characters, we use the nm utility (from the binutils package ) again - over the executable files of the selected compilers. Here you will have to self-smoke a manual for the necessary keys that will allow you to create the necessary stats by the characters.

  • Fine. Where to find these modules, are there ready sources on an example? The rest is clear. But yes, there is one requirement regarding Swift, and at the expense of a second language, you can take any, just to get information. - Avenger
  • I would do this: I installed some “master” Linux distro in a virtual machine, for example, Manjaro ( manjaro.ru ), then I climbed the compilers of interest on the websites. If there are already binary builds, I would download them; if not, I would collect them from source. Well, of course, it makes sense to look in advance and in the own repositories of linux - and there may be something interesting. - Majestio
  • In principle, there are also pre-installed VMs for the guest Mac OS X on the torrents. If it is of course more native than the linux. - Majestio