Re: Why is compiled basic slower than C? (Basic is the future)

fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Tue, 18 Aug 1992 10:27:34 GMT

          From comp.compilers

Related articles
[5 earlier articles]
Re: Why is compiled basic slower than C? (Basic is the future) scott@bbx.basis.com (1992-08-13)
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-14)
Re: Why is compiled basic slower than C? (Basic is the future) burley@geech.gnu.ai.mit.edu (1992-08-14)
Re: Why is compiled basic slower than C? (Basic is the future) dbenn@leven.appcomp.utas.edu.au (1992-08-15)
Re: Why is compiled basic slower than C? (Basic is the future) pardo@cs.washington.edu (1992-08-15)
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-17)
Re: Why is compiled basic slower than C? (Basic is the future) fjh@munta.cs.mu.OZ.AU (1992-08-18)
Re: Why is compiled basic slower than C? (Basic is the future) imp@Solbourne.COM (1992-08-18)
Re: Why is compiled basic slower than C? (Basic is the future) burley@geech.gnu.ai.mit.edu (1992-08-18)
Re: Why is compiled basic slower than C? (Basic is the future) pdg@crosfield.co.uk (1992-08-19)
Re: Why is compiled basic slower than C? (Basic is the future) pk@cs.tut.fi (1992-08-21)
Re: Why is compiled basic slower than C? (Basic is the future) robert@metropolis.com (1992-08-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Organization: Computer Science, University of Melbourne, Australia
Date: Tue, 18 Aug 1992 10:27:34 GMT
References: 92-08-042 92-08-095
Keywords: interpreter, performance

>... languages you
>might call `interpreted', like Lisp, Prolog, ML, and Snobol, in fact have
>very good compilers, which make major differences in runtime.


Compiled Prolog is almost invariably a slightly different language from
the original interpreted Prolog. The reason for this is the following:


>burley@geech.gnu.ai.mit.edu (Craig Burley) writes:
> ...There is another major issue regarding interpretation which puts
> both BASIC and C in the "compiled" camp: whether the running
> program has a means to modify itself at run time. LISP, for
> example, belongs in the "interpreted" camp.
>
>This is not really a problem. The amount of Lisp code which actually
>modifies the program written by the programmer is just minuscule. Much
>more code _generates_ pieces of Lisp, typically using the `macro' feature.
>But almost all cases of macro usage are handled straightforwardly in Lisp
>compilers. There are a few cases where Lisp code generates code on the
>fly, then executes it. This is handled by having an interpreter loaded
>along with the compiled code, and assuring that code can work correctly in
>such a mixed environment. In fact, most Lisp implementations _assume_ a
>mixed environment....


(I think that a good definition of interpreted language is one where even
if you compile it, you must load an interpreter or compiler with the
object code.)


Many old Prolog programs modify themselves using assert and retract.
Prolog compilers handle this by using the above techniques, but also by
making a slight change to the language: programmers are required to
declare predicates that will be modified with assert/retract as "dynamic".


Without these declarations, it is very difficult get reasonable efficiency
of the compiled code.
--
Fergus Henderson fjh@munta.cs.mu.OZ.AU
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.