Talk:Compiler/Archive 2

First self-hosting compiler?
I'm wondering if anyone knows of a self-hosting compiler prior to Hart and Levin's 1962 Lisp compiler described in Artificial Intelligence Memo 39, "The New Compiler" (767 kB scanned PDF). The memo describes this compiler as "the first compiler that has ever compiled itself by being executed interpretively." However, I'm not sure if this is to be taken as meaning that it is the first self-hosting compiler ... or just the first one to combine interpretation and compilation in the way that Lisp systems have ever since.

The only languages for which we have cites for earlier compilers are FORTRAN and COBOL; were there (prior to 1962) any FORTRAN compilers written in FORTRAN, or COBOL compilers in COBOL? I find this question interesting in part because it casts light on just how odd is the misconception many people have, that Lisp languages are interpreted ... :) --FOo 02:25, 16 Nov 2004 (UTC)


 * Probably not any compilers written in Fortran or Cobol around 1960, for one thing it would have been hard to code things like symbol tables. Assembly was how one did system programming back then. However, Backus in HoPL mentions knowing about a Corrado Böhm language ca 1953 for which a self-compiler had been published, don't know any more about that. Some of the earliest languages were not that different from assembly, and certainly self-assembling assemblers go back into the early 50s. Stan 04:12, 16 Nov 2004 (UTC)


 * Following some citations suggests this paper, but it's not publicly available to non-ACM-members. Grumble, grumble. I expect it's probably fair to say that Hart and Levin's Lisp is the first recognizable modern language with a self-hosting compiler, since the sample code presented in their memo is within a keyword or two of working in Common Lisp or Scheme. If we're going to say "the FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler, in 1957" then I feel fair calling Lisp in '62 the first self-hosting one. --FOo 05:16, 16 Nov 2004 (UTC)

I have heard that there was one self-hosted Cobol compiler, supposedly it was about 800,000 lines of code. But I don't think there's ever been a self-hosted Fortran compiler, or at least none that was advertised. Now, the Ratfor preprocessor, I believe that was written in Fortran. (I looked it up; according to the article, Ratfor was written in Ratfor, and could translate itself to Fortran). Paul Robinson (Rfc1394) 19:40, 26 March 2007 (UTC)

how is "threaded code compiler" different from any other kind of compiler?
the article currently claims


 * Threaded code compiler (or interpreter), like most implementations of FORTH
 * This kind of compiler can be thought of as a database lookup program. It just replaces given strings in the source with given binary code.

''While this is certainly true for most Forth compilers, how is this any different from any other kind of compiler ? For example, doesn't *every* compiler replace the "while" string in a do{...}while; loop with the appropriate machine-language binary code for test-and-jump ?''


 * The level of this binary code can vary;

Huh?


 * in fact, some FORTH compilers can compile programs that don't even need an operating system.

''I certainly think it's very interesting that some compilers can create programs that don't need an operating system.. Cross-compilers for microcontrollers produce programs that run "on bare metal"; any RTOS for those systems is usually re-compiled and mixed with the application. Visual Basic and Java compilers, on the other hand, create programs that require some sort of operating system. What would you call these two kinds of compiler?.''

I suggest replacing that with:


 * Threaded code compiler (or interpreter), like most implementations of FORTH, generates threaded code.
 * This kind of compiler focuses on producing extremely small output to fit into limited memory systems. Often people make the compiler itself very small, so it also can fit into the target system (as a native compiler). Typically single-pass. Often places output directly into RAM where it can immediately be executed (like a just-in-time compiler) -- this allows programmers to write functions that are executed during the compilation of later functions. (Most other compilers require the entire program to be completely compiled, before any of it is executed).


 * (some good name here) compiler generates "hosted" applications that require some sort of operating system.
 * (some other good name here) compiler generates "freestanding" code that runs "on the bare metal" without any operating system. People who write operating systems use this kind of compiler.

--DavidCary 04:00, 27 Jun 2005 (UTC)

I think the freestanding vs hosted discussion is pretty useless. It is only a gradual difference in how much work you must do to create a freestanding app. (iow if I must fix the RTL?) It seems to me a hosted compiler can become freestanding if the vendor postdelivers a minimal RTL with no OS ties, so a categorisation hosted or not seems only temporarily valid at best.

Figure 1 should be explained
Hi, I am creating an OpenOffice.org source drawing in order to translate the figure to other languages. The draw in spanish and a source file link is going to be put in commons. I realize that the figure is not explained in the article text as the good practice sign to. For example, "target code generator" or "machine code" are not sufficient treat. --GengisKanhg (my talk) 13:32, 27 September 2005 (UTC)

WikiProject Efficiency
WikiProject Efficiency I'm looking at the list of related compiler articles and merging or redirecting the weaker stubs: did 2 already. Cwolfsheep 23:32, 4 June 2006 (UTC)

Bad Link URL
The link to CodePedia needs a www. prefix. It give me a "Host not found" message. I'll fix it. --rchrd 01:54, 11 July 2006 (UTC)

The last sentence in the "Compiled vs Interpreted Languages"
The last sentence in the "Compiled vs Interpreted languages" section is: "To implement these features in a compiled language, programs must usually be shipped with a runtime environment that includes the compiler itself." Shouldn't that be: "... shipped with a runtime environment that includes the interpreter itself?"  Or am I just splitting hairs? -Matt B. 03:14, 17 March 2007 (UTC)


 * No, "compiler" is correct. An example is Steel Bank Common Lisp, or many other Lisp systems. The runtime environment includes a compiler, which programs can use to compose and compile functions.


 * (For clarification, current versions of SBCL also include an interpreter. But the  function is most definitely part of the runtime, and that function is a compiler.) --FOo 04:25, 17 March 2007 (UTC)

Link vandalized
I'll restore the link to my book "Build Your Own .Net Language and Compiler", since it has been recognized by several Amazon reviewers as a useful way for non-computer-scientists to learn compilers at an entry level, and many Wikipedia visitors need this information. Please do not vandalize it again. Thank you. —Preceding unsigned comment added by Special:Contributions/ (talk)


 * You have a clear conflict of interest here and shouldn't add your own book at all.--Atlan (talk) 10:51, 26 June 2007 (UTC)


 * Nonsense. Just because some authors are dishonest and have conflicts of interest don't mean that all are dishonest and conflicted. The question as to whether the book is a useful link is logically independent of my interest in the book. As in the case of the logical fallacy of ad hominem, the question isn't solely "material": mere insulting text doesn't indicate the ad hominem fallacy of invalidly inferring from character, and here, the fact that I am the author doesn't in any way imply that I would add an irrevelant link to a book that isn't about compilers, or that is not useful to people curious about the topic. This utility has been confirmed by Amazon reviewers who have read the book.
 * By your logic, a scholar or field expert would never, on wikipedia or anywhere else, be able to self-cite. This is of course nonsense.
 * I will restore the link. Do not vandalize it again. —Preceding unsigned comment added by Special:Contributions/ (talk)


 * I'm sorry, but due to the self-editing and self-publishing nature of the Wikipedia that is against Wikipedia's policies: see Conflict of interest and No_original_research.WolfKeeper 12:52, 27 June 2007 (UTC)
 * In such situations you should post the link here and other editors can add it if it is judged appropriate.WolfKeeper 12:52, 27 June 2007 (UTC)


 * I posted the link and I said "fair enough" as to your suggestion, and then some vandal removed it. Here is the link, again.
 * (link removed) —Preceding unsigned comment added by Special:Contributions/ (talk)


 * That's a link to buy the book. No one is ever going to add that to the article, because that's against Wikipedia policy for external links. Read this, especially point 4.--Atlan (talk) 10:26, 30 June 2007 (UTC)

Compiled vs interpreted
This maybe warrants a whole sentence to itself to note that the act of interpretation is unavoidable in the course of execution, but certainly not a whole section. The sentence "many people believe there is a distinction between compiled and interpreted languages" lends undue weight in the same was as "many people believe the sun rises every day" does. Chris Cunningham 11:24, 11 July 2007 (UTC)

Of course there is a difference. Those who don't believe that don't know compilers. History2007 (talk) 15:03, 25 November 2008 (UTC)

Phrases such as "many people believe" are classified as weasel words, and should be avoided. SlowJog (talk) 17:23, 29 April 2009 (UTC)

Article Quality
I came across this article by pure chance and think it is laden with errors, half-baked thoughts and misclassified ideas, all gathered at random. Whoever has a claim to authorship here should start a discussion to improve this page, or let us just mark this page as low quality. An example is the whole (missing) discussion on byte-coded systems such as Java, Prolog, Smalltalk etc. The fact that the WAM is referenced in passing maybe ok, given that Prolog is not that hot any more, but the relationship and comparison of Java and the other Byte-coded systems is really missing and mostly haphazrad - in effect incorrect. And the history byte-coded and threaded interpreted things (going back to ancient systems) would help develop a discussion thread (pun intended). I am too busy to work on this page now, but please comment here to see what happens. Thanks. History2007 (talk) 15:03, 25 November 2008 (UTC)


 * PS Regarding the incorrect discussions here on interpreted and compiled systems, think of it this way: If a program is self-modifying, how can an interpreter and compiler work the same way? They can not. History2007 (talk) 15:34, 25 November 2008 (UTC)

Compilation as a means of protecting software intellectual property
The article doesn't seem to mention that compilation and distributing only executables allows the proprietor to conceal implementation details. So compilation can be used as a means of protecting software intellectual property. pgr94 (talk) 19:42, 16 December 2008 (UTC)


 * You are assuming that the distributor of the software has a choice. For many languages compilation is the only option.  Also compiled code can be disassembled, so implementation details are not concealed but have a reduced information content (eg, no comments, assuming that the source had them in the first place). Derek farn (talk) 00:16, 17 December 2008 (UTC)


 * The only option? I don't think so, the distributor can supply source if s/he wishes, and some do.  Compilation produces output that is hard to understand (for humans) and this can be used for business purposes.  Just consider the damage to major software house if the executable was as intelligible as the source.   I think this is an important aspect of compilation and suggest it be mentioned in the article. pgr94 (talk) 13:21, 19 December 2008 (UTC)


 * By only option I meant that the only option for producing an executable is to use a compiler. Source code execution of the kind often supported by implementations of the Basic programming language is rarely available.  With regard to intelligibility, this is really a side effect of compilation and is only a minor issue (but one that could still be mentioned). Derek farn (talk) 22:25, 21 December 2008 (UTC)

Compiler article errors
This article is still pretty low quality and full of errors, and some of my attempts at improving it are getting reverted - hence maintaining the low quality. The very first sentence of the article used to use the word translate which showed a major misunderstanding of the topic. Fortunately that correction has been left alone. But there is no mention of, and direct comparison with translators and interpreters on this page and the term translate is freely used throughout, in confusing contexts. Shall I bother to correct that?

I added a sentence about compiler-compilers and it was reverted. How on earth can you have an article on compilers and not have a sentence about compiler-compilers. There needs to be a discussion of that, and more in depth!

Moreover, this article has totally missed the point about theoretical and practical differences between compilers, interpreters, and translators - as was perhaps evident from the very first sentence. At some point the article used to say that "all languages are interpreted".... a gem of an error. I had a hard time keeping that correction in. There are passing references to byte-code interpreters, but the discussion is amateur at the very best. I deleted a few really incorrect sentences (and thank you for not putting those errors back) but I seem to be running against a wall of lack of overall knowledge. This article is in poor shape, please let it be improved. Thank you. History2007 (talk) 13:37, 27 December 2008 (UTC)

PS: While pondering these errors, and how to fix them, I clicked on Translator (computing) and someone else had correctly pointed out that it was also in poor shape. I think these two articles need to get fixed together and refer to each other. History2007 (talk) 16:30, 27 December 2008 (UTC)

PS2: Reverts again and new errors are introduced! The sentence "The term compiler-compiler is sometimes used to refer to a parser generator, a tool often used to help create a compiler." is incorrect. My friend, I am getting tired of teaching remedial computer science here. Parser generation is one piece of compiler generation. That should be obvious. And please do NOT remove the low quality tags without discussion. Thank you. History2007 (talk) 19:03, 27 December 2008 (UTC)

On classic texts added to further reading
User:Derek farn, without discussion, removed some classical references to Compiler construction which I inserted in the Compiler article. It's not quite out-of-date. He wrote in his editing comment: "Only contained very old and hard to obtain material." They are considered classics and timeless, so I've added them in as historical in case of someone's arguing modernity. I am re-inserting them. Consider just one, the Cocke and Schwartz book. It's been written: "Programming Languages and their Compilers [44], published early in 1970, devoted more than 200 pages to optimization algorithms. It included many of the now familiar techniques such as redundant code elimination and strength reduction, dealt extensively with graphs of control flow and their partitioning into 'intervals', and showed how to split nodes in an irreducible flow graph to obtain a reducible one." The items referenced:


 * Cocke, John; Schwartz, Jacob T., Programming Languages and their Compilers: Preliminary Notes, Courant Institute of Mathematical Sciences technical report, New York University, 1969.
 * Fritzson, Peter A. (editor), Compiler Construction: 5th International Conference, CC '94, Edinburgh, U.K., April 7-9, 1994 : Proceedings, Published by Springer, 1994. ISBN 3540578773
 * Gries, David, Compiler Construction for Digital Computers, New York : Wiley, 1971. ISBN 047132776X
 * McKeeman, William Marshall; Horning, James J.; Wortman, David B., A Compiler Generator, Englewood Cliffs, N.J. : Prentice-Hall, 1970. ISBN 0131550772

The authors are very well known in the field, to boot. And the materials are available in libraries if not online. They are old, but not stale. Cheers. --- (Bob) Wikiklrsc (talk) 20:54, 28 January 2009 (UTC)


 * The article is lacking in-line references and if these further-reading sources could be incorporated to substantiate the text of the article it would be a great improvement. Cheers. pgr94 (talk) 09:20, 29 January 2009 (UTC)


 * Hello. Well User:Derek farn has removed them from the article again and put them into a near-orphaned article which I think you may have been involved in as well. It's academically sad, such important works being removed. They are quite relevant to the topic and are the basis for many modern texts and compiler technologies. Most were pre-sagacious for their time and considered classic to still read and understand today. I could write them into the article but I am reluctant to spend hours writing to have it removed unilaterally by someone else. This is all very off-putting. Thanks, anyway. --- (Bob) Wikiklrsc (talk) 15:04, 29 January 2009 (UTC)
 * Hello Bob. If the books are reliable sources for specific statements in the text then by all means add them as inline references.  That would be good as it would kill two birds with one stone: 1) supplying inline references for unsourced statements and 2) getting important references included (although I can't judge if they are the best sources because I don't know the field well enough).  If the references are not inline then I too think that don't help the reader much because the sources don't connect to the contents of the article and readers won't appreciate their significance.  If you need help with inline references don't hesitate to ask.  Please don't be disheartened.  pgr94 (talk) 16:49, 29 January 2009 (UTC)
 * Many thanks for your comment. Inline references are not always the answer, Gibbon notwithstanding. Sometimes there is an annotated bibliography in scholarly books. Well, there is an academic chicken and egg problem: do the citations write the article or does the article reference the citations? A classic conundrum. Your kindness and suggestions are appreciated. Cheers. --- (Bob) Wikiklrsc (talk) 17:42, 29 January 2009 (UTC)

While the books might be classics they are not of much use to modern day readers of the article. References to these book would be useful in a history of compilers article but they only serve to clutter the compiler article. The fact that a book devoted more than 200 pages to optimization is only of interest if nothing better has been written since, and there are now longer books that discuss many more algorithms in a lot more depth. User:Derek farn 13:01, 29 January 2009 (UTC)
 * Hello. I respectfully disagree with you, having been in the field for decades. You also moved the book and article references into a near-orphaned article on the History of Compilers, which was seemingly awkward. All the more recently published books rely on the critical seminal aspects and breakthroughs of the books I cited. You likely haven't read them, so you don't know. A real disruption has been created, and hours of work on the article by me has been brushed away by you unilaterally. This is not good form. --- (Bob) Wikiklrsc (talk) 15:04, 29 January 2009 (UTC)


 * But, Derek, thanks for starting the ball rolling on the History of compiler writing. I'll be adding to it. Best Wishes. --- (Bob)

Also, User:Derek farn removed carefully placed references and links to a very significant annual international conference on Compiler Construction without discussion writing in his edit comment that they were references to proceedings of one conference, even though the conference is considered quite important and I had looked for the published proceedings with papers and inserted them in the article for perusal. Methinks, User:Derek farn, based on looking at his talk page and others' comments to him, has a penchant and a happy trigger finger for subjective reverts. At the top of the article, there is a banner asking for expert handling in the artcle, and I volunteered. But Derek Farn has gone beyond reasonableness it appears in his speedy and unilateral reversions. There was a better way to have handled this all. It's called co-operation. --- (Bob) Wikiklrsc (talk) 17:42, 29 January 2009 (UTC)


 * Certainly in such field works are seminal or critical. For example Aho, Hopcroft and Ullman. In related areas Horowitz and Sahni, Knuth, etc..  Rich Farmbrough, 19:46 29 January 2009 (UTC).

Compiler testing
Conflict of Interest Declaration:

I've tried to comply with Conflict_of_interest and No_original_research. (No_original_research doesn't apply in general, since my article was published in Software: Practice and Experience, which is peer-reviewed.) I don't think Conflict_of_interest applies. Although I wrote the article when employed by PalmSource, I no longer work for PalmSource, and PalmSource is no longer in the compiler business. I'm covered by a non-disclosure agreement between my former employer and one of the commercial conformance suite vendors I cite, but it's clearly one of the notable products available, and I also mentioned its chief competitor. My citation of it should not be construed as a recommendation.

—FlashSheridan (talk) 05:01, 13 March 2009 (UTC)

Compilers in education
I know of no university courses that teach "Compiler construction and compiler optimization" at all, does anyone else? I believe some universities may offer it as a specialisation at post graduate level but even then to my knowledge most of the theory is based on finite state automata rather than actual compiler construction. —Preceding unsigned comment added by 93.97.20.167 (talk) 19:42, 25 December 2008 (UTC)


 * In my student days, I did take a grad course called Compiler Construction, but that was years ago. Just do a web search and I guess it will show up. History2007 (talk) 12:06, 26 December 2008 (UTC)
 * I was taught an undergraduate course on compiler construction at a leading UK uni in the early 90s. The textbook was "Crafting a compiler" by Fischer and Leblanc.pgr94 (talk) 20:01, 27 December 2008 (UTC)


 * Actually if you are looking for textbooks, Compilers: Principles, Techniques, and Tools is/was a basic book. It gives the basic ideas, and is written by well known people. And afterwards I clicked on it and Jeffrey Ullman is teaching a course with it at Stanford University. Alfred Aho is using it at a course in Columbia University as well. So the topic is not dead, and some of those wrote this Wikipedia page would be probably well served to take one of those two courses, then correct the errors herein. History2007 (talk) 20:20, 27 December 2008 (UTC)


 * It was taught at the University of Miami. Kernel.package (talk) 17:21, 30 June 2009 (UTC)


 * Just thought I would add that, I'm currently studying an undergraduate course on compilers at the University of Manchester. KingSimonIV (talk) 14:54, 6 January 2009 (UTC)

Archive?
Hey everybody... so this talk page is getting pretty long, and only the last 4 sections have comments from 2009. How do you all feel about archiving the old discussions? I can probably figure out how to set up a bot to do it, but I'd like a consensus. Anyone object? Indeterminate (talk) 08:48, 30 July 2009 (UTC)


 * I've gone ahead and manually archived half of it, and set up archiving for the rest. You're right that it was silly still having live topics here from over five years ago. Chris Cunningham (not at work) - talk 10:09, 31 July 2009 (UTC)


 * Thanks, looks good! Indeterminate (talk) 10:19, 31 July 2009 (UTC)

Compilation section has been added
I thought the page needed more focused explanation about compilation so I added a section called 'Compilation'. Lseongjoo (talk) 02:14, 19 April 2010 (UTC)


 * Practically everything you've said in that section is already in the Compiler design section as far as I can see. What's the point? Dmcq (talk) 13:06, 19 April 2010 (UTC)

Compiling tools
Compiling tools redirects to here. I would wish some more about compiling tools, or maybe a separate overview article for compiling tools, f.ex. preprocessors, compiler-compilers, some certain "metaprogramming" and such. Rursus dixit. ( m bork3 !) 08:55, 27 April 2010 (UTC)


 * I agree. It shouldn't redirect. It would be a important article in it's own right. scope_creep 19:38, 4 May 2010 (UTC)

Semantic Analysis
The doesn't seem to be a semantic analysis article anywhere. Does it need to be created. scope_creep 19:38, 4 May 2010 (UTC)

Compiled vs Interpreted Language
It needs to be made clear that this whole concept is incoherent and stems from confusion between implementation and specification. If you say "Interpreted language" you are making a fundamental category error. —Preceding unsigned comment added by 203.222.167.145 (talk) 05:44, 25 February 2010 (UTC)


 * There is no need for it to do anything more than it already does that I can see never mind talking about 'a fundamental category error'. You'd need a citation if you think that needs even more emphasis than it is already given. Dmcq (talk)


 * Actually my friend the IP is partly right and in my view this whole page shows a serious lack of understanding of the key concepts. I fixed a few things a year or so ago, but I feel that fixing the fundamental problems needs ongoing attention. I can fix it, but some would be semi-expert may show up and change it again. And we would need to go through "consensus" to discuss it, i.e. I would need to teach a class on line. This type of topic just may not work in Wikipedi as is. So let me just say to the new readers: "Do NOT rely on this page". Take a class somewhere. History2007 (talk) 10:43, 28 February 2010 (UTC)


 * I see no serious lack of understanding, never mind in italics or fundamental problems. The main bits I can see missing in the article is there is no talk about generating debug data or the constraints from the requirement to handle exceptions or about using libraries or gathering information from a run for optimisation or optimizaton at link time, a number of things like that. Dmcq (talk) 11:20, 28 February 2010 (UTC)


 * You got it. You don't see it: that was my point. Think of this: the current descriptions can never fit self modifying languages, or a whole pile of extensible languages. And the concept of program structure equivalence between the different modes clearly fails here, e.g. read Theory of Program Structures by Greibach from decades ago (Lecture Notes in Computer Science #36) as a starter for how mapping between code schems fails in the discussions here. And this article on compilers does not even mention the term "formal semantics". Hello? Who wrote all this? Anyway, I am not going to teach a class on this right now. Good luck. History2007 (talk) 07:49, 1 March 2010 (UTC)


 * So all these vague and unnecessarily acidic criticisms can be concluded to one somewhat precise point: something in the term "interpreted language" (used by other articles) is a categorical error (maybe something like a set error) that makes self modifying languages fall outside the set of language types {interpreted, compiled}. How? Isn't it just possible that a compiling process and an interpreting process can coexist in a language, and that languages are merely classified as mostly compiled or mostly interpreted? "Compiled" is when as many "as possible" type checks and program structure checks are resolved before running the program, and "interpreting" is when many type checks and all program structure checks are left for runtime checking. Rursus dixit. ( m bork3 !) 08:38, 27 April 2010 (UTC)

Regarding: "Compiled" is when as many "as possible" type checks and program structure checks are resolved before running the program, and "interpreting" is when many type checks and all program structure checks are left for runtime checking." That is not true. You need to first read Greibach's book as I said above to understand transformational issues. History2007 (talk) 01:44, 14 June 2010 (UTC)


 * Thanks but I think it would be much more constructive if you actually stated your summary of the difference rather than pointing to a whole book to read. Dmcq (talk) 11:44, 14 June 2010 (UTC)


 * Ok, ok guys I will give some examples below. History2007 (talk) 12:35, 14 June 2010 (UTC)