Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!amdahl!dlb!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: lex grammer for C comments Message-ID: <441@goofy.megatest.UUCP> Date: 6 Apr 88 18:55:12 GMT References: <262@nyit.UUCP> Organization: Megatest Corporation, San Jose, Ca Lines: 34 in article <262@nyit.UUCP>, michael@nyit.UUCP (Michael Gwilliam) says: > > > > NOTE: Sorry this reply took so long, but our phone line was out for a long > time. > > ----- > > Well the information is back and I've summerized the replies. In case > you forgot the question it is, "Can C comments be filtered out with > LEX as regular expressions?" > > The answer is, "Yes, but it may not be a good idea." > Well... I agree with the "not a good idea" part. > ... > Here's what I did -- built my own little automata inside the action ^^^^^^^^ pl. > for the "/*" pattern. This is stripped out of working code. > > ... Considered as a puzzle solution, that's cheating. Of course you can do it in C! My question is, "Is there an LR(k) grammar for C comments?" If so, show. If not, prove not. This would make a good assignment in an automata theory class. Dave /* ** ****/ Jones