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

Also build using menhir --table.

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