summary refs log tree commit diff
path: root/pkgs/development/tools/parsing/lemon/default.nix
blob: 23d4ea911dbe5e36f900cb9c123a42d9df47527d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ stdenv, fetchurl }:

let

  version = "1.0";

  srcs = {
    lemon = fetchurl {
      sha256 = "1grm95m2cnc61zim332g7z8nchmcy91ljf50k13lm421v0ygyyv6";
      url = "http://www.sqlite.org/src/raw/tool/lemon.c?name=039f813b520b9395740c52f9cbf36c90b5d8df03";
      name = "lemon.c";
    };
    lempar = fetchurl {
      sha256 = "09nki0cwc5zrm365g6plhjxz3byhl9w117ab3yvrpds43ks1j85z";
      url = "http://www.sqlite.org/src/raw/tool/lempar.c?name=3617143ddb9b176c3605defe6a9c798793280120";
      name = "lempar.c";
    };
  };

in stdenv.mkDerivation {
  name = "lemon-${version}";

  phases = [ "buildPhase" "installPhase" ];

  buildPhase = ''
    sh -xc "$CC ${srcs.lemon} -o lemon"
  '';

  installPhase = ''
    install -Dvm755 lemon $out/bin/lemon
    install -Dvm644 ${srcs.lempar} $out/bin/lempar.c
  '';

  meta = with stdenv.lib; {
    inherit version;
    description = "An LALR(1) parser generator";
    longDescription = ''
      The Lemon program is an LALR(1) parser generator that takes a
      context-free grammar and converts it into a subroutine that will parse a
      file using that grammar. Lemon is similar to the much more famous
      programs "yacc" and "bison", but is not compatible with either.
    '';
    homepage = http://www.hwaci.com/sw/lemon/;
    license = licenses.publicDomain;
    platforms = platforms.unix;
    maintainers = with maintainers; [ nckx ];
  };
}