home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 405_01 / flexpp / notes.txt < prev    next >
Encoding:
Text File  |  1993-08-28  |  7.5 KB  |  222 lines

  1. ========================================================
  2. Date: 21 Jul 93 14:30:10-0400
  3. From: John Holmes Sr <ramanand@thor.ece.uc.EDU>
  4. Subject: Re: flex++/bison++
  5. To: coetmeur@icdc.fr
  6.  
  7. I tried all possible alternatives but I think there is still a problem
  8. with the main.c file in your distribution of flex++. The algorithm for 
  9. generating the variable "headerfilename" actually extracts the base name of 
  10. the file supplied in the command line (and NOT the name of the scanner as 
  11. defined by the %name in flex++) and then uses this extracted string to
  12. derive the #ifdef name for the flex header anti-include mechanism.
  13. However, what happens there is that any number that appears in a filename
  14. is converted to the symbol '_'.  Everything will be fine if the file names
  15. do not end with a number. But if they do, then multiple file names with
  16. the same prefix and different only in the trailing numbers get mapped onto
  17. the same #ifdef guard.   To fix this bug (if it is a bug) I went ahead and
  18. modified the  main.c file to take care of digits appearing in the file
  19. name.  Now it works fine.
  20.  
  21.  
  22.  
  23. From coetmeur Thu Jul 22 09:21:23 1993
  24. To: ramanand@thor.ece.uc.EDU
  25. Subject: Re: flex++/bison++
  26.  
  27.  
  28.  
  29.     THANKS, and good job ! I am patching the sources in this
  30. direction.  
  31.  
  32. ========================================================
  33.  
  34. From coetmeur Mon Jul 19 13:07:23 1993
  35. To: holzmann@fmi.uni-passau.de
  36. Subject: Re: flex++
  37. Content-Length: 2153
  38. X-Lines: 53
  39. Status: RO
  40.  
  41.     Good job ! you find one ! With such help, things are going
  42.     better and better.
  43.  
  44.     Effectively, I have forgotten the #define YY_USE_CLASS in the
  45.     flexskel.cc in the #ifdef __cplusplus ... It was not evident,
  46.     because the #include of the header contain such a #define , and it
  47.     is included short time after. But the effect if to keep the old
  48.     behaviour of YYINPUT and so on... so no virtual were used.  I don't
  49.     understand why I didn't found it before... but you find it, and so
  50.     I send you  may best thanks. 
  51.  
  52.     To patch it, just add this '#define YY_USE_CLASS' between the
  53.     #ifdef __cplusplus and the #endif, around line 39. I have patched
  54.     it in my master copy (release 2.3.7-4), in a similar way (I just
  55.     added an anti-redefine #ifndef ). I hope it doesn't add bugs !!
  56.  
  57.     I tested this on my own tools, and it does work. I noted a
  58.     change in the behaviour of the scanner. Since we now really use
  59.     buffered IO and not read, the scanner does buffers much data and so
  60.     output is not synchronized to input on keyboard/screen IO. this
  61.     shows that it works ! (hope so)
  62.  
  63.  
  64.  
  65.     Thanks for help... Hope my work will be useful...
  66.  
  67.     Alain Coetmeur
  68.  
  69. PS: You should rename the install directory of flex++ and
  70. bison++ to something like bison++-1.19-2 and flex++-2.3.8-3 to avoid
  71. mismatch with official flex and bison. I confirm that my job is not
  72. official, and not at all the successor of flex and bison. It is just
  73. a cleanly patched version, kept as much compatible as possible, in
  74. my mind.
  75.  
  76. ========================================================
  77.  
  78. From coetmeur Mon Jul 12 18:51:02 1993
  79. To: tlhouns@srv.PacBell.COM
  80. Subject: Re: bison++/flex++ / test bigtest
  81. Content-Length: 1919
  82. X-Lines: 47
  83. Status: RO
  84.  
  85.  
  86.  
  87. > The distribution of flex++
  88. > does not properly resolve a "make test" or "make bigtest" command.  I
  89. > get lots of errors.  Is this anything I need to worry about?
  90.  
  91.  
  92.     Good remark. there was 3 problems  .
  93.  
  94.         1- I have not regenerated the 'initscan.c' (or scan.c)
  95.          it is not important since it works, but is not coherent.
  96.         If you want to be clean :
  97.  
  98.         touch scan.l ; make flex++ initscan 
  99.  
  100.         2- The new system insert #line directive that use the skeletons name,
  101.         and since the test skeleton is local (./flexskel.cc .h) and
  102.         the other global (/u/.../flexskel.cc .h) there is always differences.
  103.  
  104.         3- the new code use trailing context in the internal scanner (scan.l)
  105.         and so we can no more use fast table compression mode to generate
  106.         scan.c itself. so don't worry errors are logical.
  107.  
  108. here is the new targets for test ...
  109. but you should not bother with test and bigtest , it is obsolete !!
  110.  
  111.  
  112. test : flex++
  113.     echo "diff should only be on #line directive"
  114.     -./flex++ $(FLEX_FLAGS) -S./flexskel.cc -H./flexskel.h $(COMPRESSION) scan.l | diff scan.c -
  115. bigtest :
  116.     echo "diff should only be on #line directive"
  117.     -rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  118.     echo "diff should only be on #line directive"
  119.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  120.     echo "diff should only be on #line directive"
  121.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  122.     echo this should fail because there is trailing context in the grammar
  123.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  124.     echo this should fail because there is trailing context in the grammar
  125.     -rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  126.     echo this should fail because there is trailing context in the grammar
  127.     -rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  128.     echo this should fail because there is trailing context in the grammar
  129.     -rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  130.     echo "diff should only be on #line directive"
  131.     -rm -f scan.c ; $(MAKE)
  132.  
  133. =====================================================
  134. > Date: 29 Aug 93 15:13:11+0200
  135. > From: Andreas Holzmann <holzmann@kirk.fmi.uni-passau.NONE.de>
  136. > Subject: flex++: header in section2?
  137. > To: coetmeur@icdc.fr
  138. > I have some problems with your flex++ version V3.0.2, based on 2.3.8.
  139. > In line 301 of flexskel.h there is an 'announcement' for the section2
  140. > %header{ but it was impossible to me to get some lines at this point of
  141. > the header file.
  142.     Ok, it is a bug
  143. > I tried the following program:
  144. > (translated with: flex++ -otest.cc -htest.h test.l)
  145. > -------- start test.l ------
  146. > %name test
  147. > %header{
  148. > #define HEADER_TEST_1 1
  149. > %}
  150. > %%
  151. > %header{
  152. > #define HEADER_TEST_2 1
  153. > %}
  154. > %%
  155. > -------- end test.l ------
  156. > the output of test.h after line 55:
  157. > -------- start test.h ------
  158. > /* % here is the declaration from section1 %header{  */
  159. > #line 6 "test.l"
  160. > #define HEADER_TEST_1 1
  161. > #line 10 "test.l"
  162. > #line 12 "test.l"
  163. > #define HEADER_TEST_2 1
  164. > #line 16 "test.l"
  165. > #endif
  166. > #line 52 "./flexskel.h"
  167. > ------ end test.h ------
  168. > well, I expected the HEADER_TEST_2 line to be at the end of the test.h file.
  169.  
  170.     Right, exactly as you say ! there is a bug in scan.l.
  171.     I must load the second skeleton  section (which is empty, this is why
  172.         I didn't notice it)
  173.  
  174.     i have corrected it. I just added the header_skeleton_out(); in the
  175.        lex rule to pass from section 1 to 2
  176.  
  177.  
  178.  
  179. ^"%%".*            {
  180.             set_lexer_name((char *)0);
  181.             sectnum = 2;
  182.             line_directive_out( headerfile );
  183.                   if(headerfilename!=NULL)
  184.                 {
  185.                    fprintf(stdout,
  186.                           "#include \"%s\"\n",includefilename);
  187.  >>>             header_skeleton_out();
  188.                  };
  189.             line_directive_out( stdout );
  190.             BEGIN(SECT2PROLOG);
  191.             return ( SECTEND );
  192.             }
  193. > Something strange happend, when I delete '%name test' from test.l
  194. > Then the HEADER_TEST_1 line moves to the top of test.h
  195.  
  196.     when you don't give the %name, the flex++ know thereof the 
  197.    name of the parser, so it decide immediately to include the parser declaration.
  198.    but before this, it cannot, since the name of the parser is needed to 
  199.    generate the symbols. when you don't give any %name, the
  200.    %% simulate a %name parser, just before the %%, up to be coherent, and
  201.    so it load the class declaration before section 2.
  202.  
  203.  
  204. > whereas the
  205. > HEADER_TEST_2 line furthermore is at the (wrong?) place.
  206.      now it will be a the good place
  207. > so my question is, how do I get some lines after this line:
  208. > /* % here is the declaration from section2 %header{ */
  209.     now it will work
  210.  
  211. thanks for all
  212.