home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1401 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.5 KB  |  54 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Why is compiled basic slower than C? (Basic is the future)
  5. Reply-To: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  6. Organization: Computer Science, University of Melbourne, Australia
  7. Date: Tue, 18 Aug 1992 10:27:34 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-08-100@comp.compilers>
  10. References: <92-08-042@comp.compilers> <92-08-095@comp.compilers>
  11. Keywords: interpreter, performance
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 39
  14.  
  15. >... languages you
  16. >might call `interpreted', like Lisp, Prolog, ML, and Snobol, in fact have
  17. >very good compilers, which make major differences in runtime.
  18.  
  19. Compiled Prolog is almost invariably a slightly different language from
  20. the original interpreted Prolog. The reason for this is the following:
  21.  
  22. >burley@geech.gnu.ai.mit.edu (Craig Burley) writes:
  23. >   ...There is another major issue regarding interpretation which puts
  24. >   both BASIC and C in the "compiled" camp: whether the running
  25. >   program has a means to modify itself at run time.  LISP, for
  26. >   example, belongs in the "interpreted" camp.
  27. >
  28. >This is not really a problem.  The amount of Lisp code which actually
  29. >modifies the program written by the programmer is just minuscule.  Much
  30. >more code _generates_ pieces of Lisp, typically using the `macro' feature.
  31. >But almost all cases of macro usage are handled straightforwardly in Lisp
  32. >compilers.  There are a few cases where Lisp code generates code on the
  33. >fly, then executes it.  This is handled by having an interpreter loaded
  34. >along with the compiled code, and assuring that code can work correctly in
  35. >such a mixed environment.  In fact, most Lisp implementations _assume_ a
  36. >mixed environment....
  37.  
  38. (I think that a good definition of interpreted language is one where even
  39. if you compile it, you must load an interpreter or compiler with the
  40. object code.)
  41.  
  42. Many old Prolog programs modify themselves using assert and retract.
  43. Prolog compilers handle this by using the above techniques, but also by
  44. making a slight change to the language: programmers are required to
  45. declare predicates that will be modified with assert/retract as "dynamic".
  46.  
  47. Without these declarations, it is very difficult get reasonable efficiency
  48. of the compiled code.
  49. -- 
  50. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  51. -- 
  52. Send compilers articles to compilers@iecc.cambridge.ma.us or
  53. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  54.