home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / compiler / 1442 next >
Encoding:
Internet Message Format  |  1992-08-23  |  2.1 KB

  1. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
  2. From: dworkin@merlin.rootgroup.com (Dieter Muller)
  3. Newsgroups: comp.compilers
  4. Subject: Re: What kind of grammar does kermit "DEC style" parser use?
  5. Keywords: parse
  6. Message-ID: <92-08-142@comp.compilers>
  7. Date: 23 Aug 92 05:27:50 GMT
  8. References: <92-08-139@comp.compilers>
  9. Sender: compilers-sender@iecc.cambridge.ma.us
  10. Reply-To: Dieter Muller <dworkin@merlin.rootgroup.com>
  11. Organization: Compilers Central
  12. Lines: 39
  13. Approved: compilers@iecc.cambridge.ma.us
  14.  
  15. magras@cps.msu.edu writes:
  16. >The subject line pretty much says it all. What kind of grammar
  17. >drives the so-called "DEC style" parser used by most kermit
  18. >programs? (e.g. "set parameter ?", info displayed, then "set
  19. >parameter" appears on command line with cursor after it)
  20. >Grammars used by particular implementation(s) would be
  21. >appreciated, suggestions on how to do it with less than 4K to
  22. >allocate to it also helpful.
  23.  
  24. It is based on a stripped-down version of the CCMD library, which is a
  25. C implementation of the TOPS-20 COMND% JSYS call.
  26.  
  27. The moderator comments:
  28. >I'd expect Kermit's parsers probably use a hard coded driver
  29. >running from hand-written tables.
  30.  
  31. This is indeed the case.  Basically, the program becomes a state machine,
  32. with all sorts of longjmp()s playing havoc with your control flow.
  33. Although you don't have to, what I usually end up doing is having a
  34. function for each element of each command.  This allows joining multiple
  35. commands that have a common sub-grammar.
  36.  
  37. Thus, the following command language implemented via CCMD could have 5
  38. functions defining the grammar:
  39.  
  40.     set <parameter> <value>
  41.     show { <null> | <parameter> }
  42.  
  43. Or you could get by with four, by matching the <null> in the function
  44. handling `show'.
  45.  
  46. My suggestion would be to get one of the microcomputer versions of kermit
  47. from watsun.cc.columbia.edu and modify it as needed.
  48.  
  49.     Dworkin
  50. dworkin@rootgroup.com     DoD #2525 (303) 678-5519
  51. -- 
  52. Send compilers articles to compilers@iecc.cambridge.ma.us or
  53. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  54.