Subject: How I made flex and bison work with nmake and VC++5.
From: [email-masked] (Tony Stratton)

28 Dec 1998 14:48:12 -0800
Message-ID: <[email-masked]>
To: [email-masked]

Here is how I mangle flex and bison to create a workable VC++ alternitive.

First a .l file called "st.l":

%{
#include "st.tab.h"
#include "unistd.h"
void yyerror(char *message)
{

}

%}

%%

STRINGTABLE     {return STRINGTABLE;}
PRELOAD {return  PRELOAD;}
DISCARDABLE     {return  DISCARDABLE;}
BEGIN   {return  BEGIN;}
END     {return  END;}

\"(\"\"|[^\"])*\"       {return QUOTEDSTRING;}
[A-Za-z][A-Z0-9_]*       {return IDNAME;}

[\/\n\t ]*        ;

%%

Then a .y file called "st.y":

%{

/* variable declarations. */
extern void yyerror(char *message);
#include "malloc.h"
#include "unistd.h"

%}

%token STRINGTABLE PRELOAD DISCARDABLE BEGIN END IDNAME QUOTEDSTRING

%start strings
%%

strings: string_table_list
  ;

string_table_list: string_table_list string_table_entry
  |                string_table_entry
  ; 

string_table_entry: header BEGIN qs_list END
  ;

header: STRINGTABLE PRELOAD DISCARDABLE
  |     STRINGTABLE DISCARDABLE
  ;

qs_list: qs_item
  |      qs_list qs_item
  ;

qs_item: IDNAME QUOTEDSTRING
  ;

%%

void main()
{
  yyparse();
}

Finally, a make (actually nmake) file:

CC = cl
CCFLAGS = /nologo /link libfl.a
LEX = flex
YACC = bison

start: all

st.l.o:
	$(LEX) -d st.l

st.tab.o:
	$(YACC) -d -v st.y -S d:\lt\bison.simple

all: st.l.o st.tab.o
	$(CC) -o st.exe st.tab.c lex.yy.c $(CCFLAGS)      

Comments:

The libfl.a file is a file located in 
D:\cygnus\cygwin-b20\H-i586-cygwin32\lib, or some similiar directory 
in your installation.  I had to add this path to the set LIB line in 
VCVARS32.bat.

This is just a quick example concocted to get this ball rolling.

Happy flexing, and bisoning.
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".