Followup YACC & LEX Question

Followup YACC & LEX Question

Post by Jeff Wab » Thu, 02 Aug 1990 18:05:00



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

 
 
 

1. Yacc & Lex Question

Hi all,

        I am writing a program which will use Yacc & Lex to get the user's
input. But while waiting for the user's input, I want the program to poll
the message queue at the same time. If there is a message, it will be
displayed on the screen. How to do that ?  Seems that I cannot do
anything while waiting for user's input  ( yyparse() ) ...

Thanks

Leung

2. efax and printing

3. Where can I get origianl AT&T lex & yacc source?

4. Xfree for QVision

5. Wanted - additional tutorials & documentation on Lex & Yacc

6. How do you remap keys on keyboard?

7. YACC & LEX under Microsoft Windows

8. current->state after kmalloc

9. The Lex & Yacc source code for C++

10. LEX/YACC & Imake

11. Copmiling w/gcc under Solaris 2.3 (w/lex & yacc)

12. Need smart makefile for lex&yacc

13. how to use lex&yacc?