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

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!ub!dsinc!netnews.upenn.edu!meded6.med.upenn.edu!user
  2. From:  (Randolph M. Peters)
  3. Newsgroups: comp.lang.forth
  4. Subject: Pocket Forth: question about doer/make and interpret
  5. Message-ID: <98282@netnews.upenn.edu>
  6. Date: 18 Nov 92 22:17:53 GMT
  7. Sender: news@netnews.upenn.edu
  8. Followup-To: comp.lang.forth
  9. Organization: University of Pennsylvania
  10. Lines: 45
  11. Nntp-Posting-Host: meded6.med.upenn.edu
  12.  
  13.  
  14. I am a very satisfied pocket forth user (many thanks to its creator for a
  15. shareware product that is well thought out and enjoyable to use), but I am
  16. having some difficulties with two problems. 
  17.  
  18.      First, I've been trying to create a doer/make construct similar to
  19. that described in the book THINKING FORTH (a truly excellent book for both
  20. programming in general and the forth paradigm in particular). The
  21. obstacles? Well, the alternative code samples (F-83, figForth, etc models)
  22. provided make some assumptions about compilation. Pocket Forth code is
  23. compiled directly to machine language, so words inside a colon definition
  24. are not compiled as addresses (which are taken off in sequence by an
  25. address interpreter) but rather directly as machine language JSR routines.
  26. I am unsure how the return stack is supposed to operate in Pocket Forth if
  27. this is the case. Additionally, there seems to be no easy way to obtain the
  28. pfa of a word  (ie, no body> or pfa> command). 
  29.  
  30.      The second problem involves invoking the standard command interpret
  31. (which is supposed to begin interpreting the contents of the text input
  32. buffer). When I create a word which EXPECTs a line of text into the TIB and
  33. then INTERPRETs it,  it seems to start interpretation partway through the
  34. buffer. There is no user variable provided for IN> (marking the position in
  35. the input stream). Now, according to the glossary provided with the
  36. software, the token "{cr}" (ie, the token consisting of an ascii 13) will
  37. reset the return stack and the input stream. But there's no way to generate
  38. this token, since cr's are intercepted by the event handler. I thought I'd
  39. be able to find the cfa of this token by searching for a pascal-style
  40. string consisting of a 1 in the length byte and ascii 13 in the second
  41. byte, but this doesn't work. 
  42.  
  43.      Again, I greatly enjoy using Pocket Forth and would strongly recommend
  44. it to anyone thinking of using Forth on the Mac. It's a great learning
  45. tool. However, I would appreciate any tips on these two problems. I don't
  46. have an e-mail address, so please post answers to this net. I believe that
  47. a discussion of these problems could be informative to most forthers since
  48. there seems to be a dearth of sample code on this newsnet at present.
  49.  
  50. THanks in advance for your help, 
  51.  
  52.                                      Randolph M. Peters
  53.                                      Medical Clinic, Suite C, 
  54.                                      3rd floor Silverstein Building
  55.                                      Hospital of the University of PA
  56.                                      34th and Spruce Streets, 
  57.                                      Phila, PA 19104
  58.