2014-05-26 19:40:18 +00:00
|
|
|
class Menhir < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "LR(1) parser generator for the OCaml programming language"
|
2014-05-26 19:40:18 +00:00
|
|
|
homepage "http://cristal.inria.fr/~fpottier/menhir"
|
2015-01-14 08:24:11 +00:00
|
|
|
url "http://cristal.inria.fr/~fpottier/menhir/menhir-20141215.tar.gz"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "2592967c123a31e1b6566ab9f6034e7a0a709d57d547097f05693baf96a46fa4"
|
2014-05-26 19:40:18 +00:00
|
|
|
|
2015-01-14 08:46:29 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "a2d506915eb26d66fbf529fd48b906a3289601e3" => :yosemite
|
|
|
|
sha1 "8a6e1f662272c5536d33645a3e67616d19ec7706" => :mavericks
|
|
|
|
sha1 "7ab625d14199153fac46742c684e623e68590469" => :mountain_lion
|
|
|
|
end
|
|
|
|
|
2015-09-02 23:43:23 +00:00
|
|
|
depends_on "ocaml"
|
2014-05-26 19:40:18 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.deparallelize
|
2015-01-14 08:24:11 +00:00
|
|
|
system "make", "PREFIX=#{prefix}", "all", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.mly").write <<-EOS.undent
|
|
|
|
%token PLUS TIMES EOF
|
|
|
|
%left PLUS
|
|
|
|
%left TIMES
|
|
|
|
%token<int> INT
|
|
|
|
%start<int> prog
|
|
|
|
%%
|
|
|
|
|
|
|
|
prog: x=exp EOF { x }
|
|
|
|
|
|
|
|
exp: x = INT { x }
|
|
|
|
| lhs = exp; op = op; rhs = exp { op lhs rhs }
|
|
|
|
|
|
|
|
%inline op: PLUS { fun x y -> x + y }
|
|
|
|
| TIMES { fun x y -> x * y }
|
|
|
|
EOS
|
|
|
|
|
|
|
|
system "#{bin}/menhir", "--dump", "--explain", "--infer", "test.mly"
|
|
|
|
assert File.exist? "test.ml"
|
|
|
|
assert File.exist? "test.mli"
|
2014-05-26 19:40:18 +00:00
|
|
|
end
|
|
|
|
end
|