Re: What kind of grammar does kermit "DEC style" parser use?

Dieter Muller <dworkin@merlin.rootgroup.com>
Sun, 23 Aug 1992 05:27:50 GMT

          From comp.compilers

Related articles
What kind of grammar does kermit "DEC style" parser use? magras@cps.msu.edu (1992-08-22)
Re: What kind of grammar does kermit "DEC style" parser use? dworkin@merlin.rootgroup.com (Dieter Muller) (1992-08-23)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Dieter Muller <dworkin@merlin.rootgroup.com>
Organization: Compilers Central
Date: Sun, 23 Aug 1992 05:27:50 GMT
Keywords: parse
References: 92-08-139

magras@cps.msu.edu writes:
>The subject line pretty much says it all. What kind of grammar
>drives the so-called "DEC style" parser used by most kermit
>programs? (e.g. "set parameter ?", info displayed, then "set
>parameter" appears on command line with cursor after it)
>Grammars used by particular implementation(s) would be
>appreciated, suggestions on how to do it with less than 4K to
>allocate to it also helpful.


It is based on a stripped-down version of the CCMD library, which is a
C implementation of the TOPS-20 COMND% JSYS call.


The moderator comments:
>I'd expect Kermit's parsers probably use a hard coded driver
>running from hand-written tables.


This is indeed the case. Basically, the program becomes a state machine,
with all sorts of longjmp()s playing havoc with your control flow.
Although you don't have to, what I usually end up doing is having a
function for each element of each command. This allows joining multiple
commands that have a common sub-grammar.


Thus, the following command language implemented via CCMD could have 5
functions defining the grammar:


set <parameter> <value>
show { <null> | <parameter> }


Or you could get by with four, by matching the <null> in the function
handling `show'.


My suggestion would be to get one of the microcomputer versions of kermit
from watsun.cc.columbia.edu and modify it as needed.


Dworkin
dworkin@rootgroup.com DoD #2525 (303) 678-5519
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.