help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I have some problem "Segmentation fault (core dumped)"


From: Jordán E . Moisés
Subject: I have some problem "Segmentation fault (core dumped)"
Date: Mon, 30 Aug 2004 01:53:08 -0300

Hi!

Before anything, I excuse for my English

I'm reading an O'REILLY's book named "lex & yacc", I'm trying to follow
exercise by exercise, but I have stuck because one of then shows me
"Segmentation fault (core dumped)" while I'm executing it, I don't know
why?, and I can't be able to discover the problem.

I attach the 3 files of the exercise [ch1-05.l, ch1-05.y and
ch1-05y(original).h, of course the real name is "ch1-05y.h"] and 2 c source
files an 1 header file generated by flex and byacc [ch1-05l.c, ch1-05y.c and
ch1-05y(after-mv).h about its name the same as before] (I'm working in my
Windows 98 SE with cygwin).


The programs version
FLEX
 flex version 2.5.4-2

BYACC
 byacc version 1.9-1

GCC
 Thread model: posix
 gcc version 3.2 20020927 (prerelease)

BISON
bison (GNU Bison) 1.875b
Written by Robert Corbett and Richard Stallman.

M4
GNU m4 1.4

The excercise has the "ch1-05.l", "ch1-05.y" and "ch1-05y.h" files

I try in this two ways

1) First one

 flex -t ch1-05.l > ch1-05l.c
 byacc -d ch1-05.y
 mv y.tab.c ch1-05y.c
 mv y.tab.h ch1-05y.h
 gcc -g -DYYDEBUG=1 -c -o ch1-05l.o ch1-05l.c
 gcc -g -DYYDEBUG=1 -c -o ch1-05y.o ch1-05y.c
 gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl
   (i try again with)
 gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl -ly


Copy of the screens

address@hidden ~/lexyacc
$ flex -t ch1-05.l > ch1-05l.c

address@hidden ~/lexyacc
$ byacc -d ch1-05.y

address@hidden ~/lexyacc
$ ls -lrt y.*
-rw-r--r--    1 Jordán   all           191 Aug 29 12:49 y.tab.h
-rw-r--r--    1 Jordán   all          9763 Aug 29 12:49 y.tab.c

address@hidden ~/lexyacc
$ mv y.tab.c ch1-05y.c

address@hidden ~/lexyacc
$ mv y.tab.h ch1-05y.h

address@hidden ~/lexyacc
$ gcc -g -DYYDEBUG=1 -c -o ch1-05l.o ch1-05l.c

address@hidden ~/lexyacc
$ gcc -g -DYYDEBUG=1 -c -o ch1-05y.o ch1-05y.c

address@hidden ~/lexyacc
$ gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)

address@hidden ~/lexyacc
$ gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl -ly

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)


2) Second one
 flex -t ch1-05.l > ch1-05l.c
 byacc -d ch1-05.y
 mv y.tab.c ch1-05y.c
 mv y.tab.h ch1-05y.h
 gcc -g  -DYYDEBUG=1 -o ch1-05 ch1-05l.c ch1-05y.c -lfl
   (i try again with)
 gcc -g  -DYYDEBUG=1 -o ch1-05 ch1-05l.c ch1-05y.c -lfl -ly


Copy of the screens

address@hidden ~/lexyacc
$ flex -t ch1-05.l > ch1-05l.c

address@hidden ~/lexyacc
$ byacc -d ch1-05.y

address@hidden ~/lexyacc
$ ls -lrt y.*
-rw-r--r--    1 Jordán   all           191 Aug 29 13:05 y.tab.h
-rw-r--r--    1 Jordán   all          9763 Aug 29 13:05 y.tab.c

address@hidden ~/lexyacc
$ mv y.tab.c ch1-05y.c

address@hidden ~/lexyacc
$ mv y.tab.h ch1-05y.h

address@hidden ~/lexyacc
$ gcc -g  -DYYDEBUG=1 -o ch1-05 ch1-05l.c ch1-05y.c -lfl

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)

address@hidden ~/lexyacc
$ gcc -g  -DYYDEBUG=1 -o ch1-05 ch1-05l.c ch1-05y.c -lfl

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)


I also try with bison


3) The last

 flex -t ch1-05.l > ch1-05l.c
 bison -d ch1-05.y
 mv ch1-05.tab.c ch1-05y.c
 mv ch1-05.tab.h ch1-05y.h
 gcc -g -DYYDEBUG=1 -c -o ch1-05l.o ch1-05l.c
 gcc -g -DYYDEBUG=1 -c -o ch1-05y.o ch1-05y.c
 gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl
   (i try again with)
 gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl -ly


Copy of the screens

address@hidden ~/lexyacc
$ flex -t ch1-05.l > ch1-05l.c

address@hidden ~/lexyacc
$ bison -d ch1-05.y

address@hidden ~/lexyacc
$ mv ch1-05.tab.c ch1-05y.c

address@hidden ~/lexyacc
$ mv ch1-05.tab.h ch1-05y.h

address@hidden ~/lexyacc
$ gcc -g -DYYDEBUG=1 -c -o ch1-05l.o ch1-05l.c

address@hidden ~/lexyacc
$ gcc -g -DYYDEBUG=1 -c -o ch1-05y.o ch1-05y.c

address@hidden ~/lexyacc
$ gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)

address@hidden ~/lexyacc
$ gcc -g -o ch1-05 ch1-05l.o ch1-05y.o -lfl -ly

address@hidden ~/lexyacc
$ ./ch1-05.exe
Segmentation fault (core dumped)

-------X-------

May be there are some or lots of errors that they are basics stuff in C,
flex or yacc, but i'm new with all this.

Thank you.


Attachment: ch1-05y.c
Description: Binary data

Attachment: ch1-05.y
Description: Binary data

Attachment: ch1-05l.c
Description: Binary data

Attachment: ch1-05y(after-mv).h
Description: Binary data

Attachment: ch1-05y(bison).c
Description: Binary data

Attachment: ch1-05y(bison).h
Description: Binary data

Attachment: ch1-05y(original).h
Description: Binary data

Attachment: ch1-05.l
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]