Commit 05e97fc7 authored by osku's avatar osku

Add make_flex.sh and update lexer/parser generation documentation.

parent 57341d44
#!/bin/bash
#
# regenerate parser from bison input files as documented at the top of
# pars0lex.l.
# generate parser files from bison input files.
set -eu
......
#!/bin/bash
#
# generate lexer files from flex input files.
set -eu
TMPFILE=_flex_tmp.c
OUTFILE=lexyy.c
flex -o $TMPFILE pars0lex.l
# AIX needs its includes done in a certain order, so include "univ.i" first
# to be sure we get it right.
echo '#include "univ.i"' > $OUTFILE
# flex assigns a pointer to an int in one place without a cast, resulting in
# a warning on Win64. this adds the cast.
sed -e 's/int offset = (yy_c_buf_p) - (yytext_ptr);/int offset = (int)((yy_c_buf_p) - (yytext_ptr));/;' < $TMPFILE >> $OUTFILE
rm $TMPFILE
......@@ -12,27 +12,11 @@ not automatically generate them from pars0grm.y and pars0lex.l.
How to make the InnoDB parser and lexer C files:
1. First do
bison -d pars0grm.y
That generates pars0grm.tab.c and pars0grm.tab.h.
1. Run ./make_flex.sh to generate lexer files.
2. Rename pars0grm.tab.c to pars0grm.c and pars0grm.tab.h to pars0grm.h.
2. Run ./make_bison.sh to generate parser files.
3. Copy pars0grm.h also to /innobase/include
4. Do
flex pars0lex.l
That generates lex.yy.c.
5. Rename lex.yy.c to lexyy.c.
6. Add '#include "univ.i"' before #include <stdio.h> in lexyy.c
(Needed for AIX)
7. Add a type cast to int to the assignment below the comment
'need more input.' (Removes a warning on Win64)
These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
These instructions seem to work at least with bison-1.875d and flex-2.5.31 on
Linux.
*******************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment