Commit 9427a73d authored by POTTIER Francois's avatar POTTIER Francois

Moved calc-param to ocamlbuild.

parent 14833477
calc
lexer.ml
parser.ml
parser.mli
*.cmi
*.cmo
*.cmx
*.o
*.d
tokens.ml
tokens.mli
calc.native
_build
.PHONY: all clean test
# Find Menhir.
ifndef MENHIR
MENHIR := $(shell ../find-menhir.sh)
endif
MENHIRFLAGS := --infer
OCAMLBUILD := ocamlbuild -use-ocamlfind -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS)"
MAIN := calc
all:
$(OCAMLBUILD) $(MAIN).native
clean:
rm -f *~ .*~
$(OCAMLBUILD) -clean
test: all
@echo "The following command should print 42.0:"
echo "(1 + 2 * 10) * 2" | ./$(MAIN).native
<tokens.mlypack>: only_tokens
<parser.mlypack>: external_tokens(Tokens)
open Ocamlbuild_plugin
open Command
let menhir_flags() =
(* Define two ocamlbuild flags [only_tokens] and [external_tokens(Foo)]
which correspond to menhir's [--only-tokens] and [--external-tokens Foo].
When they are used, these flags should be passed both to [menhir] and to
[menhir --raw-depend]. *)
List.iter (fun mode ->
flag [ mode; "only_tokens" ] (S[A "--only-tokens"]);
pflag [ mode ] "external_tokens" (fun name ->
S[A "--external-tokens"; A name]
)
) [ "menhir"; "menhir_ocamldep" ]
let () =
dispatch (fun event ->
match event with
| After_rules ->
menhir_flags()
| _ -> ()
)
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