Related articles |
---|
C-comments in flex quan@sol.surv.utas.edu.au (1991-08-21) |
Newsgroups: | comp.compilers |
From: | quan@sol.surv.utas.edu.au (Stephen Quan) |
Keywords: | C, flex, question |
Organization: | Compilers Central |
Date: | 21 Aug 91 03:09:23 GMT |
I am designing a C/C++ compiler/program-verifier.
"/*"([^*]|("*"+[^*/]))*"*"+"/" RESPONSE(BLANK,COMMENT);
I have been looking for a definition of the /* ... */ comment in
C and have concocted the one above. If anybody has an improvements,
or know of a textbook solution, please, please mail me!
Thanks in advance.
--
quan@sol.surv.utas.edu.au (Stephen Quan)
Department of Surveying,
University of Tasmania,
Australia.
[That's a reasonable pattern except for one thing -- it processes the entire
comment as a single token, which tends to do unpleasant things to the token
buffer when it tries to eat a 25 line comment. My preferred solution is to
have "/*" put the scanner into a comment eating lexical state which is then
exited by "*/". Flex's exclusive start states make this easy. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.