YACC and parser design help

Dave Hammond daveh at marob.MASA.COM
Tue Jul 26 02:17:22 AEST 1988


Can anyone suggest "novice level" reading material on the subjects:

	1. Command parser design and implementation
	2. YACC usage as it relates to #1 above.

I am involved with a project which currently does command parsing in a
brute-force manner (i.e. "if getchar is a begin-token then read till the
end-token, but lookout for comment lines along the way. Then do something
with the stuff between begin- and end-tokens").

I'm quite sure that with a better understanding of parser design I could do
this more efficiently. Also, perhaps YACC could do the trick for me, if I
knew how to make YACC do what I want.

Should it relate to the above, the syntax which I am attempting to parse is:

	a. "procedures" consist of a name and a curly-brace surrounded
	   set of statements.
	b. "statements" consist of a keyword, an optional set of comma
	   separated arguments, and a terminating semi-colon.
	c. multi-word arguments must be surrounded with quotes.
	d. comment lines may appear within (or between) procedures.

	example:
	# comment line
	procedure {
		keyword, arg1, arg2, "arg 3" ;
		# comment line
		keyword;
		}

	This is a bit simplified. For example, It would be helpful to
	differentiate between "statement" and 'statement', check for
	assignment operators (arg=text), etc.

Any pointers to appropriate reading materials, or suggestions for YACC
implementation of the above syntax would be appreciated.

Please e-mail responses. Thanks in advance.

Dave Hammond
DOMAIN: dsix2!daveh at masa.com
                                                            /dsix2!daveh
  UUCP: {uunet | rutgers | spl1 | ...}!{masa.com | hombre}!<
                                                            \marob!daveh
USMAIL: DSI Communications Inc, 333 W. Merrick Road, Valley Stream, NY 11580
-----------------------------------------------------------------------------



More information about the Comp.lang.c mailing list