regex for C comments

Doug Schmidt schmidt at zola.ics.uci.edu
Mon Jul 10 14:11:05 AEST 1989


In their book ``Introduction to Compiler Construction with UNIX,''
Schreiner and Friedman provide the following LEX regular expression
for recognizing C comments:

----------------------------------------
"/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/"
----------------------------------------

Ignoring the possibility of overflowing an internal LEX buffer,
does anyone know of any legal C comments that fail to match
with this regular expression?

thanks,

  Doug
--
Master Swordsman speak of humility;             | schmidt at ics.uci.edu (ARPA)
Philosophers speak of truth;                    | office: (714) 856-4034
Saints and wisemen speak of the Tao of no doubt;
The moon, sun, and sea speaks for itself. -- Hiroshi Hamada



More information about the Comp.lang.c mailing list