Hi All,
Greetings for the day !!
I am trying to modify the GNU Pascal fronted. I have gone through GNU Pascal manual and GNU Pascal internals site and this is what I have understood.
1.Lexer - I need to modify pascal-lex.l file and using flex compile it to lex.yy.c file.Rename this file to pascal-lex.c 2. Parser - I need to modify parse.y file and using bison compile it to parse.c file.
Now what I am supposed to do next, to make these changes reflect when I compile a pascal file ?
Thanks a lot in advance.
Thanks and regards, Rajat
Rajat Singh wrote:
I am trying to modify the GNU Pascal fronted. I have gone through GNU Pascal manual and GNU Pascal internals site and this is what I have understood.
1.Lexer - I need to modify pascal-lex.l file and using flex compile it to lex.yy.c file.Rename this file to pascal-lex.c 2. Parser - I need to modify parse.y file and using bison compile it to parse.c file.
Now what I am supposed to do next, to make these changes reflect when I compile a pascal file ?
Running flex and bison by hand is not needed. Normal procedure is:
1) fetch sources (for modification it is best to fetch from git, but tarball will do too) 2) make sure you can build from sources (but use separate build directory so that sources remain clean) 3) make modifications, in your case pascal-lex.l and parse.y 4) run build, like in 2
gpc tarball contains pre-build pascal-lex.c and parse.c, but makefiles know how to rebuild them if needed.
Note: in 4) above normally it is enough to run make, which is faster than full build. However, to make sure that other (and you on different machine) can build gpc after your modification once you are convinced that your change works it is better to run full build. That is, when you develop your change run make in the same tree to quickly test it. Once you think you ar ready run full build to make sure that build machinery works OK after your change.
Also, look at
http://www.gnu-pascal.de/gpc/Testing.html
for info how to run test (note that to run only Pascal tests you need to change to the gcc-xxx/gcc/p subdirectory of the build tree).