home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pop / 165 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  4.1 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!bhamcs!axs
  2. From: axs@cs.bham.ac.uk (Aaron Sloman)
  3. Newsgroups: comp.lang.pop
  4. Subject: Re: List and Vector Syntax (long)
  5. Message-ID: <Bzo890.AA4@cs.bham.ac.uk>
  6. Date: 22 Dec 92 17:22:12 GMT
  7. References: <116670035@otter.hpl.hp.com> <1goe30INN3ut@agate.berkeley.edu>
  8. Sender: news@cs.bham.ac.uk
  9. Organization: School of Computer Science, University of Birmingham, UK
  10. Lines: 111
  11. Nntp-Posting-Host: emotsun
  12.  
  13. bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes:
  14.  
  15. > Date: 16 Dec 92 23:28:32 GMT
  16. > Organization: University of California, Berkeley
  17. >
  18. > I'm a non-Pop-programmer following this discussion with interest.
  19. > If I'm understanding right, it's proposed that the notation
  20. >     "strawberry fields forever"
  21. > should mean three separate quoted words.
  22. >
  23. > Is there a way to include a space character in a word?  This looks
  24. > like a potential ambiguity to me.  In Lisp we'd say
  25. >
  26. >     '(strawberry fields forever)            3 words
  27. >     "strawberry fields forever"            1 string
  28. >
  29. > to distinguish these cases.
  30.  
  31. In pop-11 you can, at present, create a quoted word by putting
  32. the word-quote symbol around a string, so
  33.  
  34.     'the cat'       1 string
  35.     "the cat"       Illegal syntax
  36.     "'the cat'"     1 word with the same characters as the string
  37.                     also achieved by consword('the cat'), except the
  38.                     former creates the word and puts it in the
  39.                     dictionary at compile time, the latter at
  40.                     run time.
  41.  
  42. Note that the Pop-11 lexical analyser will separate out some
  43. character sequences into separate words. E.g.
  44.  
  45.     x+5*f(x,y)
  46.  
  47. is exactly equivalent to
  48.  
  49.     x + 5 * f ( x , y )
  50.  
  51. and some sequences of characters cannot be combined in a legal
  52. quoted word, so that the following will produce an error:
  53.     "f(x,y)"
  54.  
  55. Strings, by contrast, using single quotes ' .... ' can contain
  56. arbitrary sequences of characters. This was the basis of my
  57. proposing a few years ago that the Pop-11 syntax be extended to
  58. allow a quoted word in the format
  59.     "'<arbitrary characters>'"
  60.  
  61. since previously that would not have been legal Pop-11, and it has a
  62. natural interpretation. Thus
  63.  
  64.     "'f(x,y)'"
  65.  
  66. is now a single quoted word with the six characters: f ( x , y )
  67.  
  68. I've just realised that this facility could be screwed up by the
  69. suggestion from Steve Knight and Chris Dollin to allow multiple
  70. quoted words by using
  71.  
  72.     "the cat on the mat"
  73. to put five words on the stack, i.e. equivalent to
  74.  
  75.     "the", "cat", "on", "the", "mat"
  76.  
  77. if their multiple quote syntax is to work by analogy with the
  78. current Pop-11 convention for quotation in list and vector
  79. expressions.
  80.  
  81. At present these allow strings and numbers to represent themselves.
  82.  
  83. Thus
  84.  
  85.     [the cat 'on the' 3 mats 6.5]
  86.  
  87. is a list containing two words, a string, an integer a word and a
  88. decimal number (float). This is very convenient instead of having to
  89. unquote the contexts containing non-words, e.g.
  90.  
  91.     [the cat % 'on the', 3 % mats % 6.5 %]
  92.  
  93. If the proposed new "multiple quotation" syntax were to be really
  94. convenient it would be necessary to allow strings and numbers within
  95. such multiple quotes to be interpreted as strings and numbers, not
  96. as words with the string quote character, or words containing only
  97. numeric characters.
  98.  
  99. In that case we would need some *other* syntax to make it convenient
  100. to create words containing spaces and other arbitrary symbols. If,
  101. instead of using " .... " for multiple quotes we used % .... % as
  102. suggested in my previous replies to Steve and Chris, this problem
  103. would not exist
  104.  
  105.     % the cat 'the cat' 55 %  -- two quoted words a string an integer
  106.  
  107.     "'the cat'"               -- one quoted word including a space
  108.  
  109. Of course including a word with arbitrary characters in a multiple
  110. quote would not be possible, just as it is not possible now within
  111. a list, unless you put it inside an unquoted context, then use the
  112. format "'...'".
  113.  
  114. Taking account of all requirements when designing a general purpose
  115. language is HARD!
  116.  
  117. Aaron
  118. ---
  119. -- 
  120. Aaron Sloman, School of Computer Science,
  121. The University of Birmingham, B15 2TT, England
  122. EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
  123. Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281
  124.