Commit 35135c20 authored by POTTIER Francois's avatar POTTIER Francois

Modify the speed test in speed.sh to NOT link MenhirLib when using the

code back-end. This should avoid some strange effects due to changes in
code size.
parent dd62940d
......@@ -4,11 +4,10 @@
# This is useful because ocamlbuild descends into _build.
ifndef MENHIR
READLINK := $(shell if which greadlink >/dev/null ; then echo greadlink ; else echo readlink ; fi)
MENHIR := $(shell $(READLINK) -f ../../src/_stage1/menhir.native) \
--table
MENHIR := $(shell $(READLINK) -f ../../src/_stage1/menhir.native)
endif
ifndef OCAMLBUILD
OCAMLBUILD := ocamlbuild -use-ocamlfind -use-menhir -menhir "$(MENHIR)"
OCAMLBUILD := ocamlbuild -use-ocamlfind -use-menhir -menhir "$(MENHIR)" $(TAGS)
endif
all:
......
true: package(menhirLib)
......@@ -71,6 +71,20 @@ let wrap token =
let () =
Random.init !seed
(* Copied from MenhirLib in order to avoid a dependency on it. *)
let traditional2revised parser =
fun (lexer : unit -> 'token) ->
let lexbuf : Lexing.lexbuf =
Lexing.from_string ""
in
let lexer (lexbuf : Lexing.lexbuf) : 'raw_token =
let (token, startp, endp) = lexer() in
lexbuf.Lexing.lex_start_p <- startp;
lexbuf.Lexing.lex_curr_p <- endp;
token
in
parser lexer lexbuf
let () =
let tks : token stream = produce !size in
let tks = fresh (map wrap tks) in
......@@ -79,7 +93,7 @@ let () =
printf "Done.\n"
end
else begin
let i : int = MenhirLib.Convert.Simplified.traditional2revised Parser.main tks in
let i : int = traditional2revised Parser.main tks in
printf "%d\n%!" i
end
......@@ -22,13 +22,15 @@ test_ocamlyacc=false
rm -f gene/*.time
# Build the parser with the code back-end.
# Do not link MenhirLib.
echo "Building (code)..."
make -C $GENE MENHIR="$MENHIR" clean all >/dev/null
cp -RH $GENE/gene.native $GENE/gene.code
# Build the parser with the table back-end.
# Do link MenhirLib.
echo "Building (table)..."
make -C $GENE MENHIR="$MENHIR --table" clean all >/dev/null
make -C $GENE MENHIR="$MENHIR --table" TAGS="-tags 'package(menhirLib)'" clean all >/dev/null
cp -RH $GENE/gene.native $GENE/gene.table
# (Optionally) Build the parser with ocamlyacc.
......
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