home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pop / 53 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  8.9 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!news.cs.bham.ac.uk!axs
  2. From: axs@cs.bham.ac.uk (Aaron Sloman)
  3. Newsgroups: comp.lang.pop
  4. Subject: Re: Re: help [more on features of Pop-11]
  5. Summary: a few things missing from Basic
  6. Message-ID: <BxpFv9.Gon@cs.bham.ac.uk>
  7. Date: 14 Nov 92 11:57:08 GMT
  8. References: <1dtqn9INN7kk@hobbes.genrad.com> <116670006@otter.hpl.hp.com>
  9. Sender: news@cs.bham.ac.uk
  10. Organization: School of Computer Science, University of Birmingham, UK
  11. Lines: 162
  12. Nntp-Posting-Host: emotsun
  13.  
  14. sfk@otter.hpl.hp.com (Steve Knight) writes:
  15.  
  16. > Date: 13 Nov 92 17:32:04 GMT
  17. > Organization: Hewlett-Packard Laboratories, Bristol, UK.
  18. > .....
  19. > Question: what is pop?
  20. > ----------------------
  21. > .....
  22. >
  23. > From the computer scientist's viewpoint, the most important qualities of
  24. > Pop are :-
  25. >
  26. >     *   Garbage collection (automatic store management).
  27. >     *   The language is dynamically typed (cf. Lisp).
  28. >     *   Arguments and results are passed and returned via a stack which
  29. >         is open to the user to manipulate in any way.
  30. >     *   Procedures are first class datatypes, can be arbitarily nested,
  31. >         and provide full-lexical scoping.
  32. > .....
  33. Here are a few other important features
  34.  
  35.     * Incremental compilation
  36. Pop-11 is not (usually) interpreted. Individual commands, and
  37. procedure definitions are compiled "on the fly" to machine code and
  38. then are immediately available for fast execution. This means you
  39. don't have to write a file, compile it, then link in the object
  40. code. This makes program development and testing extraordinarily
  41. fast without the speed overhead of an interpreted system. E.g.
  42. compiling or recompiling a hundred lines of code to extend or modify
  43. a program that's already several megabytes in size can take a
  44. fraction of a second on a modern machine (e.g. SPARC, 68040, MIPS),
  45. after which executing or testing occurs immediately. (Old
  46. versions of recompiled procedures are automatically garbage
  47. collected. and indirect procedure calls mean that new versions
  48. automatically replace old ones in previously compiled programs.)
  49. Additional procedures can be compiled at any time during the running
  50. of the program, encouraging very thorough and rapid incremental
  51. testing and debugging. (Some AI systems extend themselves by using
  52. the same incremental compilation mechanism at run-time as users
  53. doing program development.)
  54.  
  55.     * lightweight processes
  56. Mechanisms are provided for creating, running, resuming "processes"
  57. along with timed interrupt facilities so that you can build your own
  58. scheduler inside pop. This means that a single Pop-11 process (in
  59. Poplog) can simulate a mini-operating system. This has been used for
  60. teaching operating system concepts to beginner computer science
  61. students. This mechanism can be "inherited" by other Poplog
  62. languages. E.g. it can be used to implement coroutines in Poplog
  63. prolog. A new process can be constructed out of a procedure plus
  64. some data to start it off, or by taking a snapshot of part of the
  65. current control stack and saving it as a process that can be resumed
  66. later. (Compare call/cc in Scheme)
  67.  
  68.     * extendable syntax and explicit virtual machine
  69. This is hard to summarise briefly, but the key points are as
  70. follows:
  71.  
  72. 1. Like most LISP dialects Pop-11 allows users to define
  73.    "macro" procedures that are invoked at compile time, can read in
  74.    arbitrary amounts of the current compiler text stream, rearrange
  75.    them arbitrarily (using arbitrary user-defined procedures) and then
  76.    put them back on the input stream to be read by the compiler, which,
  77.    then resumes compilation in the normal way (though more macros may
  78.    be triggered as a result). This allows special purpose sub-languages
  79.    to be defined which extend Pop-11. However, all the extensions
  80.    generated in this way must ultimately "translate" into legal Pop-11,
  81.    so it is essentially an abbreviation facility. This is true also of
  82.    Lisp macros. (#define in C provides some of this "macro expansion"
  83.    capability at compile time except that user-defined procedures are
  84.    not available at compile time.)
  85.  
  86. 2. More importantly, Pop-11 also allows users to define new "syntax"
  87.    procedures.  These, like macros, are activated during compilation,
  88.    and, like macros, can cause arbitrary amounts of code to be read in
  89.    and rearranged. However, instead of simply rearranging text in the
  90.    input stream, syntax words can "plant" instructions for the Poplog
  91.    Virtual Machine (PVM see below). These instructions then get
  92.    directly compiled into machine code, without first having to be
  93.    translated into legal Pop-11 as with macros. The PVM is more general
  94.    than Pop-11 itself, in the same sort of way as the "machine
  95.    language" of a modern computer is more general than the various high
  96.    level languages that are translated into it (C, Prolog, Ada, Pascal,
  97.    Lisp, etc.). This means that Pop-11 syntax words can extend the
  98.    language to produce constructs that cannot be translated into "core"
  99.    Pop-11", and to that extent they go beyond Macros (as well as
  100.    avoiding the inefficiency of rebuilding the compiler input stream).
  101.  
  102.    This is how Poplog Lisp, Poplog Prolog, and Poplog ML are
  103.    implemented with their own syntax, using Poplog Pop-11; and no doubt
  104.    many other application-specific languages have been implemented the
  105.    same way by users (e.g. a commercial group working on "intelligent"
  106.    real time control for a chemical plant, found it convenient to
  107.    implement an extension to Pop-11 to encode the rules used by the
  108.    operators in taking decisions.)
  109.  
  110. 3. The Poplog Virtual Machine extends the simple Forth-like
  111.    facilities of Pop-11 (push something onto the stack, pop the top of
  112.    the stack into ..., call procedure X, return from current procedure,
  113.    go to, branch if, etc. etc.) with quite a lot of sophisticated
  114.    constructs including mechanisms for handling abnormal exits,
  115.    interrogating the control chain, trapping procedure exit and entry
  116.    (and running user-specified set-up and re-set procedures), handling
  117.    both dynamic and lexical scoping, handling a stack of prolog
  118.    continuations, runtime creation of new procedures, etc. The PVM
  119.    makes it possible to implement incremental compilers for a variety
  120.    of high level languages, not all with efficiency comparable to
  121.    stand-alone implementations, but still quite tolerably fast, and
  122.    much faster than if they were interpreted. (E.g. you can build a
  123.    prolog interpreter in any Lisp system, but not an incremental prolog
  124.    compiler.) For more on the Poplog VM see
  125.  
  126.     Robert Smith, Aaron Sloman, John Gibson
  127.     `POPLOG's two-level virtual machine support for interactive
  128.     languages' in
  129.     Research Directions in Cognitive Science Volume 5: Artificial
  130.         Intelligence,
  131.     eds D. Sleeman and N. Bernsen, Lawrence Earlbaum Associates, 1992
  132.     (Also Cognitive Science Research Paper 153, School of Cognitive
  133.     and computing sciences University of Sussex, Jan 1990).
  134.  
  135.    The original Pop-2 virtual machine was largely invented by Robin
  136.    Popplestone in Edinburgh (now at University of Massachusetts at
  137.    Amherst, and helping to distribute Poplog in the USA and Canada).
  138.    The main designer and implementor of the current PVM is John Gibson,
  139.    at Sussex University, though various other people contributed ideas,
  140.    including Chris Mellish, who implemented the first Prolog in Poplog.
  141.    Requirements for Common Lisp and for ML caused some extensions to
  142.    the PVM which then allowed Pop-11 itself to be extended (e.g. with
  143.    lexical blocks, dynamic local expressions).
  144.  
  145.    The mechanisms for adding syntactic extensions are used by Pop-11
  146.    itself, to provide useful constructs, e.g. various forms of
  147.    iteration over datastructures. Such extensions can go into the
  148.    "autoloadable" library. Later, they can be built into the main
  149.    system.
  150.  
  151. There are other relatively unusual features of Pop-11, including
  152. properties, user-definable sub-syntax words to extend an existing
  153. syntax form, autoloadable libraries, the treatment of arrays as
  154. procedures (functions), the class_apply construct that allows
  155. user-defined data-types to be treated as procedures, partial
  156. application (analogous to but simpler and more efficient than
  157. lexical closures), and more recently the object-oriented extensions.
  158.  
  159. Unfortunately, the only full and up to date documentation on Pop-11
  160. consists of the online reference manual that is part of Poplog.
  161.  
  162. NOTE: the fact that users can extend the syntax of Pop-11 in all
  163. sorts of ways can totally screw up attempts to apply formal methods
  164. to Pop-11 programs that use these facilities. In my view the
  165. addition of new higher level constructs making it easier to get
  166. programs right and to extend and maintain them outweighs the
  167. theoretically possible but not yet demonstrated benefits of formal
  168. analysis. (Flame on formalists!)
  169.  
  170. Aaron
  171. -- 
  172. Aaron Sloman, School of Computer Science,
  173. The University of Birmingham, B15 2TT, England
  174. EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
  175. Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281
  176.