Porting flex-2.4.7 to dos.

aporkka@cc.Helsinki.FI (Ari-Panu Porkka)
Thu, 5 Jan 1995 13:02:46 GMT

          From comp.compilers

Related articles
Porting flex-2.4.7 to dos. aporkka@cc.Helsinki.FI (1995-01-05)
Re: Porting flex-2.4.7 to dos. vern@daffy.ee.lbl.gov (1995-01-23)
| List of all articles for this month |

Newsgroups: comp.compilers,gnu.misc.discuss
From: aporkka@cc.Helsinki.FI (Ari-Panu Porkka)
Keywords: flex, MSDOS, question
Organization: University of Helsinki
Date: Thu, 5 Jan 1995 13:02:46 GMT

I'm trying to port flex-2.4.7 to dos and after 2 days of fiddling
I'm starting to feel hopeless. :(


I have Borlandc C++ 3.0 and a 286 with 4 megs of memory.


When running make the first flex manages to be created, but when it
is time to use it to create the final flex the first flex gives the
following errormessage:
input in flex scanner failed
If I try
flex -ist8 -Sflex.skl scan.l
in commandline, flex prints the skeletonfile and
#define INITIAL 0
after which, it hangs.


I _think_ one of the problems I have is stack overflow.


flex.map:


  00000H 0351BH 0351CH _TEXT CODE
  0351CH 0398AH 0046FH CCL_TEXT CODE
  ...
  11707H 11BC9H 004C3H YYLEX_TEXT CODE
  11BD0H 11BD0H 00000H _FARDATA FAR_DATA
  11BD0H 11BD3H 00004H CCL_DATA FAR_DATA
  ...
  244D0H 2453CH 0006DH YYLEX_DATA FAR_DATA
  24540H 24540H 00000H _FARBSS FAR_BSS
  ...
  24AE0H 24B5FH 00080H _STACK STACK
                                    ^^^
It looks to me that whatever value I give to _stklen, the length of
stack remains 128 bytes. i.e. the minimum. where do I go wrong?


I have added
extern unsigned _stklen = 16384;
at the beginning of main.c.




I have also seen
out of dynamic memory in yy_create_buffer()
and
stack overflow
at various times and configurations.


Could someone tell me what I am missing?
Where can I find a ready made executable for dos,
which I could use while I'm working with this?




This is the makefile I use:


#
# make file for "flex" tool
#
# the first time around use "make first_flex"
#
# Possible values for DEFS:
#
# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
# to DEFS.


CC = bcc
CFLAGS = -O -G -Z -mh -N -w-pro -Ff=16384 -M
DEFS = -DDEFAULT_CSIZE=256 -DMS_DOS


LDFLAGS =
LINK = tlink @flex.lnk/c/v


O = obj
EXE = .exe
YTAB = y_tab


SKELETON_DIR = .
SKELETON_FILE = flex.skl


FLEX_DIR = .
FLEX_FILE = flex$(EXE)
FLEX = $(FLEX_DIR)\\$(FLEX_FILE)
FLEX_FLAGS = -ist8 -S$(SKELETON_DIR)\\$(SKELETON_FILE)
FLEX_COMPRESSION =


YACC_DIR = ..
YACC_FILE = byacc
YACC = $(YACC_DIR)\\$(YACC_FILE)


FLEXOBJS = \
ccl.$(O) dfa.$(O) ecs.$(O) gen.$(O) main.$(O) misc.$(O) nfa.$(O) \
parse.$(O) scan.$(O) skel.$(O) sym.$(O) tblcmp.$(O) yylex.$(O)


FLEX_C_SOURCES = \
ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c \
parse.c scan.c skel.c sym.c tblcmp.c yylex.c


HEADERS = flexdef.h version.h


flex$(EXE): $(FLEXOBJS)
$(LINK)


first_flex:
copy initscan.c scan.c
touch scan.c
@echo compiling first flex
$(MAKE) flex$(EXE)
del scan.c
@echo using first flex to generate final version...
$(MAKE) flex$(EXE)


parse.h parse.c: parse.y
$(YACC) -d parse.y
del parse.c
del parse.h
ren $(YTAB).c parse.c
ren $(YTAB).h parse.h


scan.c: scan.l
$(FLEX) $(FLEX_FLAGS) $(FLEX_COMPRESSION) scan.l > scan.c


scan.$(O): scan.c parse.h flexdef.h


#main.$(O): main.c $(HEADERS)
# $(CC) $(CFLAGS) -c main.c


# yylex.o: yylex.c parse.h flexdef.h


clean:
del *.obj
del *.map


very_clean:
del *.obj
del *.map
del parse.c
del parse.h
del scan.c




And the flex.lnk file:


c:\bc\lib\c0h+
ccl+
dfa+
ecs+
gen+
main+
misc+
nfa+
parse+
scan+
skel+
sym+
tblcmp+
yylex
flex.exe


c:\bc\lib\ch


--
Ari-Panu Porkka
University of Helsinki
<Ari-Panu.Porkka@Helsinki.FI>
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.