{"id":169,"date":"2006-01-11T16:44:33","date_gmt":"2006-01-11T05:44:33","guid":{"rendered":"http:\/\/www.somethinkodd.com\/oddthinking\/2006\/01\/11\/rational-1000-staged-compilation\/"},"modified":"2006-01-12T19:01:39","modified_gmt":"2006-01-12T08:01:39","slug":"rational-1000-staged-compilation","status":"publish","type":"post","link":"https:\/\/www.somethinkodd.com\/oddthinking\/2006\/01\/11\/rational-1000-staged-compilation\/","title":{"rendered":"Rational 1000: Staged Compilation"},"content":{"rendered":"<p><!-- UnMarkedDown_2_01139627702--><\/p>\n<p><div class=\"aside\">This is one of a <a href=\"http:\/\/www.somethinkodd.com\/oddthinking\/category\/rat1000\/\">short series<\/a> of nostalgic reminiscences about the Rational 1000.<\/div>\n<\/p>\n<p>One of the more interesting concepts on a Rational 1000 was the way it pushed your code through stages on the way to compilation.<\/p>\n<h3>Stage 1: Raw Text<\/h3>\n<p>In the first stage, it was raw text. Not much to say really.<\/p>\n<h3>Stage 2: Formatted Text<\/h3>\n<p>Periodically (generally several times a minute!), while writing code, you would hit the Format key.  The Format key would format your code, according to the project-standard.<\/p>\n<p><div class=\"aside\">To the compiler geeks: behind the scenes it would build a concrete syntax tree, and then pretty-print it. From what I could see it was a pure tree (no semantic links or context).<\/div>\n<\/p>\n<p>Generally, the formatter&#8217;s parser was very forgiving. There was very little that would stop it in its tracks. If it encountered an error (like an <code>if<\/code> with no <code>then<\/code>, it would automatically include the missing parts of the statement, leaving placeholders for you to fill in your code. You could even jump between, and overtype, the placeholders quickly. Ada is a verbose language; the Format key was a key time-saver for a lazy typist.<\/p>\n<p>What&#8217;s more, at least half of the wasteful arguments about coding style instantly disappeared. The formatter was common across the project, and running it was a necessary step to getting code to compile. It was <em>impossible<\/em> to break a lot of the coding standards that coding reviews still get bogged down on today.<\/p>\n<p>If I recall correctly, it even <a href=\"http:\/\/www.somethinkodd.com\/oddthinking\/2005\/10\/26\/the-world-of-case-sensitivity\/\">smashed-case <\/a> to follow a fixed style.<\/p>\n<p><div class=\"aside\">I have some other ideas here about avoiding coding-style arguments, but I will discuss them later.<\/div>\n<\/p>\n<h3>Stage 3: Semanticized Code<\/h3>\n<p>The next button was the Semanticize button. I never liked the term &#8220;semanticize&#8221; but I learned to live with it.<\/p>\n<p>The Semanticize button did an implicit Format (if it was required). It then did a full parse, checking that the code was semantically correct, and highlighting any errors.<\/p>\n<p>Ada is a bondage-and-discipline language. It is strongly typed, by just about <a href=\"http:\/\/en.wikipedia.org\/wiki\/Strong_typing\" title=\"Wikipedia definition of Strong_typing\" class=\"wikipedia\">every definition<\/a>. Developers would spend plenty of time in this phase, until the parser gave the go ahead and lifted the velvet rope to let the code past.<\/p>\n<p>Once the code was semanticized, some other features would become available.<\/p>\n<p>Command completion was a key one, and one that I missed for many years after leaving this project. That is, you could type the beginning of an identifier name, and hit the Complete button to get a list of choices of matching identifiers. You could type the name of a package, and hit Complete to get a list of choices of identifiers in that package. You could type the name of a function, and hit Complete to have placeholders appear for each of the parameters. <\/p>\n<p><div class=\"aside\">Ada supports named association of parameters. That is, you can write <code>copy(from=> sourceFile, to=>destinationFile);<\/code> or <code>copy(to=>destinationFile, from=>sourceFile);<\/code> without anyone getting confused.  I think is a Good Thing<sup><small>TM<\/small><\/sup> &#8211; i.e. having the option supported is great. It was particular useful here in providing hints to the developer about how to fill in the parameters.<\/div>\n<\/p>\n<p>The only problem with the Complete command was that it was slooooow! It would sometimes take over 30 seconds to complete. I often said at the time that the Complete command would be great if it was ten times faster.  I would probably demand 500 times faster these days.<\/p>\n<h3>Stage 3: Installed Code<\/h3>\n<p>The parse graph tree created by the Semanticize button was both temporary and one-sided.<\/p>\n<p>The next button in the sequence was the Install button.<\/p>\n<p>The Install button did an implicit Semanticize (if it was required). It then stored the parse graph tree to permanent storage. <\/p>\n<p>I think it also modified the parse-trees of other installed code to link back to this one. That way, for example, you could see what code referenced a particular definition very quickly. By quickly here, I am probably talking about only a 30 second delay!<\/p>\n<p>Once code was in the installed state, other code could start to reference it. For example, the Semanticize function or the Complete function would only find referenced definitions if they were in the Installed state (or greater).<\/p>\n<p><div class=\"aside\">Once in the Installed state, the parse tree (in the form of a <a href=\"http:\/\/foldoc.org\/foldoc.cgi?query=DIANA\">DIANA<\/a> tree) was also available for meta-programming tools to manipulate.<\/div>\n<\/p>\n<p>Installing marked the text as read-only. You would have to &#8220;uninstall&#8221; it (also known as Demote or Edit) to make further changes. Any code that depended on it would also need to be uninstalled.<\/p>\n<h3>Stage 4: Generated Code<\/h3>\n<p>The final stage was to generate code.<\/p>\n<p>The Generate Code button did an implicit Install (if it was required). It then produced the object code for the appropriate target platform. <\/p>\n<p>For the cross-compiling that we did, this was terribly slow. (We didn&#8217;t do clean build of the project each night &#8211; it took <em>days<\/em> to compile the whole project from scratch.) Doing early testing directly on the Rational 1000 was always preferable for many reasons; avoiding unnecessary cross-compiles was a key one.<\/p>\n<p><div class=\"aside\">Ada didn&#8217;t have an explicit linking phase. I don&#8217;t recall the details of how you would mark a function main program to produce an executable, but it wasn&#8217;t actually required when you were compiling natively to the Rational 1000. It could execute any arbitrary function from the &#8220;command line&#8221;.<\/div>\n<\/p>\n<h3>Conclusions<\/h3>\n<p>This has mainly been a description of how an IDE worked 14 years ago. <\/p>\n<p>I&#8217;ve expressed a few minor points of view here and there (e.g. praising the benefits of a project-standard pretty-printer, and named association of parameters).<\/p>\n<p>My stronger opinions are actually on the benefits of a Complete button (which didn&#8217;t appear in a reliable form in other, popular IDEs for many years later), and the usage of the concrete syntax tree, rather than text, as the primary artifact of the IDE. I&#8217;ll probably blog more about the latter, later.<\/p>\n<p><div class=\"aside\">Note: This essay has largely been from memory from over 11 years ago when I last used a Rational 1000. It is somewhat likely that I have made some errors in the details &#8211; especially in the behind-the-scenes work by the compiler &#8211; but I think the overall flow and concepts are intact.<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the more interesting concepts on a Rational 1000 was the way it pushed your code through stages on the way to compilation.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[42],"tags":[],"class_list":["post-169","post","type-post","status-publish","format-standard","hentry","category-rat1000"],"_links":{"self":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":0,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}