jwabik@cs.D.UMN.EDU (Jeff Wabik) (08/11/87)
Thanks to all who responded to my recent LEX question.. I managed to take two of the 4 responses I got and merge them for a solution.. Another question comes up, now: I'm still having fun with preprocessors. What I now need to do is to implement a (YACC) grammar to preprocess hunks of code, disregarding code that is the actual program body wherever necesary.. For example, Here is a possibility: ? (VAR debug_mode:boolean := TRUE, unhappy_mode:boolean := TRUE; );? . <lots of program body here #1> . ?IF (debug_mode) PROCEDURE [XREF] Moo (x:integer); . . <lots of program body here #2> . PROCEND Moo; ?ELSE PROCEDURE [XREF] Moo2 (x:real); . . ?IFEND For clarification of my ambiguous comment above, what I need to do is to take a YACC grammar that will accept preprocessor directives but that has no clue about the programming language itself. Thus, I will need to disregard code that is in "<lots of program body here #1>". I can deal with program bodies #2 and #3 and their appropriate manipulation, but can't comprehend how to disregard all that middle code. Anyone have an idea? Thanks in advance! -Jeff