Commit 5f3f814d authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Also build using menhir --table.

parent 77bfdc1d
_menhir
_ocamlyacc _ocamlyacc
_menhir
_menhir_table
*.log *.log
...@@ -5,37 +5,51 @@ ifndef MENHIR ...@@ -5,37 +5,51 @@ ifndef MENHIR
MENHIR := $(shell ../../demos/find-menhir.sh) MENHIR := $(shell ../../demos/find-menhir.sh)
endif endif
MENHIRFLAGS := --infer -v MENHIRFLAGS := --infer -v --fixed-exception
OCAMLBUILD := ocamlbuild -use-ocamlfind OCAMLBUILD := ocamlbuild -use-ocamlfind
MAIN := calc MAIN := calc
all: all:
@ $(OCAMLBUILD) -build-dir _ocamlyacc $(MAIN).native @ $(OCAMLBUILD) -build-dir _ocamlyacc $(MAIN).native
@ $(OCAMLBUILD) -build-dir _menhir -tag fancy $(MAIN).native \ @ $(OCAMLBUILD) -build-dir _menhir -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS)" -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS)"
@ $(OCAMLBUILD) -build-dir _menhir_table -tag fancy $(MAIN).native \
-use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS) --table" -package menhirLib
clean: clean:
@ rm -f *~ .*~ @ rm -f *~ .*~
@ $(OCAMLBUILD) -build-dir _ocamlyacc -clean @ $(OCAMLBUILD) -build-dir _ocamlyacc -clean
@ $(OCAMLBUILD) -build-dir _menhir -clean @ $(OCAMLBUILD) -build-dir _menhir -clean
@ $(OCAMLBUILD) -build-dir _menhir_table -clean
_ocamlyacc/%.out: %.in # We try every input file whose name matches *.in.
_ocamlyacc/$(MAIN).native < $< > $@ # We parse it using each of the three parsers,
# and compare the results pairwise.
_menhir/%.out: %.in
_menhir/$(MAIN).native < $< > $@
test: all test: all
@ for f in *.in ; do \ @ for f in *.in ; do \
out=$${f%*.in}.out ; \ out=$${f%*.in}.out ; \
log=$${f%*.in}.log ; \ log=$${f%*.in}.log ; \
for target in _ocamlyacc _menhir ; do \ for target in _ocamlyacc _menhir _menhir_table ; do \
$$target/$(MAIN).native < $$f > $$target/$$out ; \ $$target/$(MAIN).native < $$f > $$target/$$out ; \
done ; \ done ; \
if diff _ocamlyacc/$$out _menhir/$$out > $$log ; then \ if diff _ocamlyacc/$$out _menhir/$$out > $$log ; then \
echo "OK $$f" ; \ echo "ocamlyacc versus menhir(code): $$f: OK" ; \
else \
echo "ocamlyacc versus menhir(code): $$f: FAILURE" ; \
cat $$log ; \
fi ; \
if diff _ocamlyacc/$$out _menhir_table/$$out > $$log ; then \
echo "ocamlyacc versus menhir(table): $$f: OK" ; \
else \ else \
echo "FAILURE $$f" ; \ echo "ocamlyacc versus menhir(table): $$f: FAILURE" ; \
cat $$log ; \
fi ; \
if diff _menhir/$$out _menhir_table/$$out > $$log ; then \
echo "menhir(code) versus menhir(table): $$f: OK" ; \
else \
echo "menhir(code) versus menhir(table): $$f: FAILURE" ; \
cat $$log ; \ cat $$log ; \
fi ; \ fi ; \
done done
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