Split LLgen off to be self-contained, and not necessarily part of the ACK. Replaced...
authordtrg <none@none>
Sat, 4 Feb 2006 00:57:04 +0000 (00:57 +0000)
committerdtrg <none@none>
Sat, 4 Feb 2006 00:57:04 +0000 (00:57 +0000)
15 files changed:
util/LLgen/.distr [deleted file]
util/LLgen/COPYING
util/LLgen/LLgen.1 [deleted file]
util/LLgen/Makefile [deleted file]
util/LLgen/READ_ME
util/LLgen/bootstrap.sh [new file with mode: 0755]
util/LLgen/c.pm [new file with mode: 0644]
util/LLgen/lib/.distr [deleted file]
util/LLgen/mkdistr.sh [new file with mode: 0755]
util/LLgen/pm [new file with mode: 0755]
util/LLgen/pmfile [new file with mode: 0644]
util/LLgen/proto.make [deleted file]
util/LLgen/src/.distr [deleted file]
util/LLgen/src/Makefile [deleted file]
util/LLgen/src/proto.make [deleted file]

diff --git a/util/LLgen/.distr b/util/LLgen/.distr
deleted file mode 100644 (file)
index 6b0b1d2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-READ_ME
-COPYING
-lib
-src
-Makefile
-proto.make
-LLgen.1
index b45bcec..a27fd63 100644 (file)
@@ -1,19 +1,32 @@
-Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
-
+Copyright (c) 1987, 1990, 1993, 2005 Vrije Universiteit, Amsterdam, The Netherlands.
 All rights reserved.
 
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the Vrije Universiteit
-not be used in advertising or publicity pertaining to distribution of
-the software without specific, written prior permission.
-THE VRIJE UNIVERSITEIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
-SHALL THE VRIJE UNIVERSITEIT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
+Redistribution and use of the Amsterdam Compiler Kit in source and
+binary forms, with or without modification, are permitted provided
+that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   * Redistributions in binary form must reproduce the above
+     copyright notice, this list of conditions and the following
+     disclaimer in the documentation and/or other materials provided
+     with the distribution.
+
+   * Neither the name of Vrije Universiteit nor the names of the
+     software authors or contributors may be used to endorse or
+     promote products derived from this software without specific
+     prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
+CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL VRIJE UNIVERSITEIT OR ANY AUTHORS OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/util/LLgen/LLgen.1 b/util/LLgen/LLgen.1
deleted file mode 100644 (file)
index 0436ffa..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-.\" $Id$
-.TH LLGEN 1 "$Revision$"
-.ad
-.SH NAME
-LLgen, an extended LL(1) parser generator
-.SH SYNOPSIS
-LLgen [ \-vxwans ] [ \-j[\fInum\fP] ] [ \-l\fInum\fP ] [ \-h\fInum\fP ] file ...
-.SH DESCRIPTION
-\fILLgen\fP
-converts a context-free grammar into a set of
-functions which form a recursive descent parser with no backtrack.
-The grammar may be ambiguous;
-ambiguities can be broken by user specifications.
-.PP
-\fILLgen\fP
-reads each
-\fIfile\fP
-in sequence.
-Together, these files must constitute a context-free grammar.
-For each file,
-\fILLgen\fP
-generates an output file, which must be compiled by the
-C-compiler.
-In addition, it generates the files
-\fILpars.c\fP
-and
-\fILpars.h.\fP
-\fILpars.h\fP
-contains the
-\fIdefine\fP
-statements that associate the
-\fILLgen\fP-assigned `token-codes' with user declared `token-names'.
-This allows other source files, for instance the source file
-containing the lexical analyzer,
-to access the token-codes by
-using the token-names.
-\fILpars.c\fP
-contains the error recovery routines and tables. It must also
-be compiled by the C-compiler. When the generated parser uses non-correcting
-error recovery (
-\fB\-n\fP 
-option) 
-\fILLgen\fP
-also generates a file 
-\fILncor.c\fP
-that contains the non-correcting recovery mechanism.
-.PP
-\fILLgen\fP
-will only update those output files that differ from their previous
-version.
-This allows
-\fILLgen\fP
-to be used with
-\fImake\fP
-(1) convieniently.
-.PP
-To obtain a working program, the user must also supply a
-lexical analyzer, as well as
-\fImain\fP
-and
-\fILLmessage\fP,
-an error reporting routine;
-\fILex\fP
-(1) is a useful program for creating lexical analysers usable
-by
-\fILLgen\fP.
-.PP
-\fILLgen\fP accepts the following flags:
-.IP \fB\-v\fP
-create a file called
-\fILL.output\fP,
-which contains a description of the conflicts that
-were not resolved.
-If the flag is given more than once,
-\fILLgen\fP
-will be more "verbose".
-If it is given three times, a complete description of the
-grammar will be supplied.
-.IP \fB\-x\fP
-the sets that are computed are extended with the nonterminal
-symbols and these extended sets are also included in the
-\fILL.output\fP
-file.
-.IP \fB\-w\fP
-no warnings are given.
-.IP \fB\-a\fP
-Produce ANSI C function headers and prototypes.
-.IP \fB\-n\fP
-Produce a parser with non-correcting error recovery.
-.IP \fB\-s\fP
-Simulate the calling of all defined subparsers in all semantic actions. When 
-using non-correcting error recovery, subparsers that are called in semantic
-actions may cause problems; this flag provides a `brute-force' solution. 
-.IP \fB\-j\fP[\fInum\fP]
-when this flag is given, \fILLgen\fP will generate dense switches,
-so that the compiler can generate a jump table for it. This will only be
-done for switches that have density between
-\fIlow_percentage\fP and \fIhigh_percentage\fP, as explained below.
-Usually, compilers generate a jumptable when the density of the switch
-is above a certain threshold. When jump tables are to be used more often,
-\fIhigh_percentage\fP must be set to this threshold, and \fIlow_percentage\fP
-must be set to a minimum threshold. There is a time-space trade-off here.
-.I num
-is the minimum number of cases in a switch for the \fB\-j\fP option to be
-effective. The default value (if
-.I num
-is not given) is 8.
-.IP \fB\-l\fP\fInum\fP
-The \fIlow_percentage\fP, as described above. Default value is 10.
-.IP \fB\-h\fP\fInum\fP
-The \fIhigh_percentage\fP, as described above. Default value is 30.
-.SH FILES
-LL.output                 verbose output file
-.br
-Lpars.c                   the error recovery routines
-.br
-Lncor.c                   non-correcting error recovery mechanism
-.br
-Lpars.h                   defines for token names
-.SH "SEE ALSO"
-\fIlex\fP(1)
-.br
-\fImake\fP(1)
-.br
-\fILLgen, an Extended LL(1) Parser Generator\fP
-by C.J.H. Jacobs.
-.br
-\fITop-down Non-Correcting Error Recovery in LLgen\fP
-by A.W van Deudekom and P.J. Kooiman
-.SH DIAGNOSTICS
-Are intended to be self-explanatory. They are reported
-on standard error. A more detailed report is found in the
-\fILL.output\fP
-file.
-.SH AUTHOR
-Ceriel J. H. Jacobs
-.br
-The non-correcting error recovery mechanism is written by
-A.W van Deudekom and P.J. Kooiman.
diff --git a/util/LLgen/Makefile b/util/LLgen/Makefile
deleted file mode 100644 (file)
index 858da64..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# $Id$
-INSTALLDIR=/usr/local/bin
-LIBDIR=/usr/local/lib/LLgen
-MANDIR=/usr/local/man/man1
-
-all:
-       cd src; make LIBDIR=$(LIBDIR)
-
-clean:
-       -cd src; make clean
-
-install:
-       cd src; make LIBDIR=$(LIBDIR)
-       rm -f $(INSTALLDIR)/LLgen $(LIBDIR)/rec $(LIBDIR)/incl $(MANDIR)/LLgen.1
-       cp src/LLgen $(INSTALLDIR)/LLgen
-       cp lib/rec $(LIBDIR)/rec
-       cp lib/incl $(LIBDIR)/incl
-       cp lib/nc_rec $(LIBDIR)/nc_rec
-       cp lib/nc_incl $(LIBDIR)/nc_incl
-       cp LLgen.1 $(MANDIR)/LLgen.1
-
-firstinstall:
-       cd src; make LIBDIR=$(LIBDIR) first
-       rm -f $(INSTALLDIR)/LLgen $(LIBDIR)/rec $(LIBDIR)/incl $(MANDIR)/LLgen.1
-       cp src/LLgen $(INSTALLDIR)/LLgen
-       -mkdir $(LIBDIR)
-       cp lib/rec $(LIBDIR)/rec
-       cp lib/incl $(LIBDIR)/incl
-       cp lib/nc_rec $(LIBDIR)/nc_rec
-       cp lib/nc_incl $(LIBDIR)/nc_incl
-       cp LLgen.1 $(MANDIR)/LLgen.1
-
-cmp:
-       cd src; make LIBDIR=$(LIBDIR)
-       -cmp src/LLgen $(INSTALLDIR)/LLgen
-       -cmp lib/rec $(LIBDIR)/rec
-       -cmp lib/incl $(LIBDIR)/incl
-       -cmp lib/nc_rec $(LIBDIR)/nc_rec
-       -cmp lib/nc_incl $(LIBDIR)/nc_incl
-       -cmp LLgen.1 $(MANDIR)/LLgen.1
-
-distr:
-       cd src; make distr
-
-opr:
-       make pr | opr
-
-pr:
-       @cd src; make pr
index 9fb868b..19f909a 100644 (file)
@@ -1,19 +1,84 @@
-$Id$
-
-To install LLgen, proceed as follows:
-
-- create a directory to put the libraryfiles in, f.i.
-       /usr/local/lib/LLgen
-- cd to the src directory
-- adapt the file machdep.c, should be easy
-- adapt the Makefile, changing the options to the C-compiler if
-  necessary.
-- change back to this directory
-- edit the Makefile. LIBDIR should be set to the directory for the
-  library files, INSTALLDIR should be set to the directory where LLgen
-  is to be put.
-- now type 
-       make firstinstall
-- This should do all the work.
-
-LLgen.1 contains a man-page.
+                                 LLGEN V1.0
+                                 ==========
+
+  Copyright © 1991-2005 by the Vrije Universiteit, Amsterdam, the Netherlands.
+                                 2006-02-03
+
+INTRODUCTION
+============
+
+LLgen is a LL(1) parser in the style of yacc. It will generate an efficient
+recursive descent parser for Extended Context-Free grammars, with an optional
+non-correcting error recovery mechanism.
+
+For more information, see the white papers in the doc directory. (You may need
+to build LLgen first to be able to read them.)
+
+INSTALLATION
+============
+
+LLgen depends on the following software:
+
+    gcc: currently, LLgen only builds on gcc, due largely to the lack of any
+        non-gcc test systems. Please contact the support mailing list (see
+        below) if this is a problem.
+        
+    groff: used to build the documentation.
+
+LLgen uses Prime Mover as its build tool. To build, do:
+
+    ./pm install
+
+This will compile LLgen and install it into /usr/local (which you must be able
+to write to). If you want it installed elsewhere, use -D to change the PREFIX
+variable:
+
+    ./pm -DPREFIX="/home/dg/" install
+    
+(If you do change the prefix, you must supply it whenever you invoke pm. And
+there must be a trailing / in the path you give it.)
+
+Invoking ./pm by itself will compile it but not install it; look in the bin
+directory for an image of 
+
+USING LLGEN
+===========
+
+Please see the white papers in PREFIX/share/doc/LLgen, or the man page (called
+LLgen).
+
+LLgen itself uses a parser compiled in LLgen, so you can study the files in
+the src directory for examples. If you wish to modify LLgen's own parser, the
+bootstrap.sh script will update LLgen's source from the parser *.g files.
+LLgen itself may then be recompiled with pm in the usual way. (Although you
+may want to keep a copy of a known good LLgen around in case you break
+something!)
+
+SUPPORT
+=======
+
+LLgen is part of the Amsterdam Compiler Kit (although standalone and
+distributed seperately). For more details, please see:
+
+    http://tack.sourceforge.net
+
+There is a mailing list available at:
+
+       http://sourceforge.net/mail/?group_id=130811
+
+LICENSE
+=======
+
+LLgen is © 1991-2005 by the Vrije Universiteit and is distributed under a
+license equivalent to the three-clause BSD license. See the COPYING file
+for details.
+
+Prime Mover is © 2006 David Given and is distributed under the MIT license.
+Do './pm --license' for details.
+
+-----------------------------------------------------------------------------
+David Given
+dg@cowlark.com
+2006-02-04
+
+/* $Id$ */
\ No newline at end of file
diff --git a/util/LLgen/bootstrap.sh b/util/LLgen/bootstrap.sh
new file mode 100755 (executable)
index 0000000..6fcc3a8
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# $Id$
+#
+# Script to rebuild LLgen's own parser with LLgen.
+
+set -e
+
+if ! (which LLgen > /dev/null); then
+       echo "You can only bootstrap the LLgen parser if you've already got"
+       echo "LLgen installed."
+fi
+
+(cd src && LLgen -vvv -x tokens.g LLgen.g)
+
+echo ""
+echo "You should now be able to rebuild LLgen with the new parser."
diff --git a/util/LLgen/c.pm b/util/LLgen/c.pm
new file mode 100644 (file)
index 0000000..638316b
--- /dev/null
@@ -0,0 +1,144 @@
+-- This file is part of Prime Mover v0.1pre1.
+-- (C) 2006 David Given
+--
+-- pm includefile to compile *host* C programs.
+
+-- Standard Lua boilerplate.
+
+local io_open = io.open
+local string_gsub = string.gsub
+local string_gfind = string.gfind
+local table_insert = table.insert
+local table_getn = table.getn
+local filetime = pm.filetime
+
+-- Define some variables.
+
+CC = "gcc %CBUILDFLAGS% %CDYNINCLUDES% %CINCLUDES% %CEXTRAFLAGS% -c -o %out% %in%"
+CPROGRAM = "gcc %CBUILDFLAGS% %CLINKFLAGS% %CEXTRAFLAGS% -o %out% %in% %CLIBRARIES%"
+CDEPENDS = "gcc %CBUILDFLAGS% %CDYNINCLUDES% %CINCLUDES% %CEXTRAFLAGS% -MM -MG -MF %out% %in%"
+AR = "%RM% %out% && ar cr %out% %in%"
+
+CBUILDFLAGS = "-g -Os"
+CINCLUDES = {}
+CEXTRAFLAGS = ""
+CLINKFLAGS = ""
+CDYNINCLUDES = ""
+CLIBRARIES = ""
+
+--- Manage C file dependencies ----------------------------------------------
+
+local dependency_cache = {}
+local function load_dependency_file(fn)
+       local o = dependency_cache[fn]
+       if o then
+               return o
+       end
+       
+       -- Read in the dependency file.
+       
+       local f = io_open(fn)
+       if not f then
+               print("failed to open "..fn)
+               return nil
+       end
+       f = f:read("*a")
+       
+       -- Massage the dependency file into a string containing one unescaped
+       -- filename per line.
+       
+       f = string_gsub(f, "^.*[^\\]: *", "")
+       f = string_gsub(f, "\\\r?\n", "")
+       f = string_gsub(f, "([^\\]) +", "%1\n")
+       f = string_gsub(f, "\\", "")
+       
+       -- Parse the string.
+       
+       o = {}
+       for l in string_gfind(f, "[^\n]+") do
+               table_insert(o, l)
+       end
+       
+       dependency_cache[fn] = o
+       return o
+end
+
+-- This clause specialises 'simple' to add support for smart dependencies of C
+-- files.
+
+simple_with_clike_dependencies = simple {
+       class = "simple_with_clike_dependencies",
+       makedepends = {"%CDEPENDS%"},
+
+       __init = function(self, p)
+               simple.__init(self, p)
+               
+               -- If we're a class, don't verify.
+               
+               if ((type(p) == "table") and p.class) then
+                       return
+               end
+
+               -- If dynamicheaders is an object, turn it into a singleton list.
+               
+               if self.dynamicheaders then
+                       if (type(self.dynamicheaders) ~= "table") then
+                               self:__error("doesn't know what to do with dynamicheaders, which ",
+                                       "should be a list or an object but was a ", type(self.dynamicheaders))
+                       end
+                       if self.dynamicheaders.class then
+                               self.dynamicheaders = {self.dynamicheaders}
+                       end
+               end
+       end,
+       
+       __dependencies = function(self, inputs, outputs)
+               local obj = simple {
+                       CDYNINCLUDES = self.CDYNINCLUDES,
+                       command = self.makedepends,
+                       outputs = {"%U%-%I%.d"},
+                       unpack(inputs)
+               }
+               local o = obj:__build()
+               local depends = load_dependency_file(o[1])
+               if not depends then
+                       self:__error("could not determine the dependencies for ",
+                               pm.rendertable(inputs))
+               end
+               return depends
+       end,
+       
+       __buildadditionalchildren = function(self)
+               self.CDYNINCLUDES = ""
+               if self.dynamicheaders then
+                       for _, i in ipairs(self.dynamicheaders) do
+                               local o = i:__build()
+                               if o[1] then
+                                       self.CDYNINCLUDES = self.CDYNINCLUDES..' "-I'..string_gsub(o[1], "/[^/]*$", "")..'"'
+                               end
+                       end
+               end
+       end
+}
+
+-- These are the publically useful clauses.
+
+cfile = simple_with_clike_dependencies {
+       class = "cfile",
+       command = {"%CC%"},
+       outputs = {"%U%-%I%.o"},
+}
+
+cprogram = simple {
+       class = "cprogram",
+       command = {"%CPROGRAM%"},
+       outputs = {"%U%-%I%"},
+}
+
+clibrary = simple {
+       class = "clibrary",
+       command = {
+               "%AR%"
+       },
+       outputs = {"%U%-%I%.a"},
+}
diff --git a/util/LLgen/lib/.distr b/util/LLgen/lib/.distr
deleted file mode 100644 (file)
index 3384b4e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-incl
-rec
-nc_incl
-nc_rec
diff --git a/util/LLgen/mkdistr.sh b/util/LLgen/mkdistr.sh
new file mode 100755 (executable)
index 0000000..4c6e228
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+# $Id$
+#
+# Script to build a distribution package.
+
+set -e
+       
+if [ "$1" = "" ]; then
+       echo "Please specify a version number!"
+       exit 1
+fi
+
+if [ -d ../LLgen-$1 ]; then
+       echo "I think you've already generated version $1."
+       exit 1
+fi
+
+mkdir ../LLgen-$1
+cp -a --parents \
+       pm \
+       c.pm \
+       pmfile \
+       doc/LLgen.refs \
+       doc/LLgen_NCER.n \
+       doc/LLgen.1 \
+       doc/LLgen.n \
+       lib/rec \
+       lib/incl \
+       lib/nc_incl \
+       lib/nc_rec \
+       src/io.h \
+       src/extern.h \
+       src/reach.c \
+       src/LLgen.c \
+       src/LLgen.g \
+       src/compute.c \
+       src/savegram.c \
+       src/global.c \
+       src/gencode.c \
+       src/main.c \
+       src/name.c \
+       src/types.h \
+       src/sets.c \
+       src/sets.h \
+       src/tokens.c \
+       src/tokens.g \
+       src/Lpars.c \
+       src/Lpars.h \
+       src/cclass.c \
+       src/cclass.h \
+       src/alloc.c \
+       src/check.c \
+       src/machdep.c \
+       mkdistr.sh \
+       bootstrap.sh \
+       COPYING \
+       READ_ME \
+\
+       ../LLgen-$1
+
+(cd .. && tar cvf LLgen-$1.tar.bz2 --bzip2 LLgen-$1)
+
+echo ""
+echo "Done --- but did you remember to update the version number in the README?"
diff --git a/util/LLgen/pm b/util/LLgen/pm
new file mode 100755 (executable)
index 0000000..b20d520
Binary files /dev/null and b/util/LLgen/pm differ
diff --git a/util/LLgen/pmfile b/util/LLgen/pmfile
new file mode 100644 (file)
index 0000000..61f362b
--- /dev/null
@@ -0,0 +1,103 @@
+-- $Id$
+--
+-- This is the build file used to compile LLgen. It should be run through
+-- Prime Mover (copy supplied). See the READ_ME file for more information.
+
+include "c.pm"
+
+-- Where is LLgen going to be installed eventually? (Needs trailing slash.)
+
+PREFIX = PREFIX or "/usr/local/"
+
+-- Where's LLgen's staging area? (Don't change. Needs trailing slash.)
+
+INSTALLPATH = "bin/"
+
+LLgen = cprogram {
+       CEXTRAFLAGS = '-DLIBDIR=\\"'..PREFIX..'share/LLgen\\" -DNON_CORRECTING',
+
+       cfile "src/main.c",
+       cfile "src/gencode.c",
+       cfile "src/compute.c",
+       cfile "src/check.c",
+       cfile "src/reach.c",
+       cfile "src/global.c",
+       cfile "src/name.c",
+       cfile "src/sets.c",
+       cfile "src/alloc.c",
+       cfile "src/machdep.c",
+       cfile "src/cclass.c",
+       cfile "src/savegram.c",
+
+       -- These use pre-LLgen'd version of the files. If LLgen.g gets updated,
+       -- they need rebuilding. Use the bootstrap script to do this.
+       
+       cfile "src/LLgen.c",
+       cfile "src/Lpars.c",
+       cfile "src/tokens.c",
+
+       outputs = {"%U%/LLgen"},
+       install = pm.install(              INSTALLPATH.."bin/LLgen")
+}
+
+library = group {
+       install = {
+               pm.install("lib/rec",          INSTALLPATH.."share/LLgen/rec"),
+               pm.install("lib/incl",         INSTALLPATH.."share/LLgen/incl"),
+               pm.install("lib/nc_incl",      INSTALLPATH.."share/LLgen/nc_incl"),
+               pm.install("lib/nc_rec",       INSTALLPATH.."share/LLgen/nc_rec"),
+       }
+}
+
+manpage = group {
+       install = {
+               pm.install("doc/LLgen.1", INSTALLPATH.."man/man1/LLgen.1"),
+       }
+}
+
+documentation = group {
+       simple {
+               outputs = {"%U%-%I%.ps.gz"},
+               command = "refer -sA+T -p %in[1]% %in[2]% | groff -Tps -e -t -ms "..
+                       "| gzip -c9 > %out[1]%",
+               
+               file "doc/LLgen.refs",
+               file "doc/LLgen.n",
+               
+               install = {
+                       pm.install(INSTALLPATH.."share/doc/LLgen/LLgen.ps.gz")
+               }
+       },
+       
+       simple {
+               outputs = {"%U%-%I%.ps.gz"},
+               command = "groff -Tps -e -t -p -ms %in% | gzip -c9 > %out[1]%",
+               
+               file "doc/LLgen_NCER.n",
+               
+               install = {
+                       pm.install(INSTALLPATH.."share/doc/LLgen/NCER.ps.gz")
+               }
+       },
+}
+
+-- Default rule: builds everything into the staging area, but does nothing
+-- else.
+
+default = group {
+       LLgen,         -- build LLgen itself
+       library,       -- copy over the library
+       manpage,       -- copy over the man page
+       documentation, -- build the two white papers
+}
+
+-- This rule will build everything, and then install it to its final location.
+
+install = group {
+       default,
+       
+       install = {
+               "mkdir -p %PREFIX%",
+               "(cd bin && tar cf - .) | (cd %PREFIX% && tar xvf -)"
+       }
+}
diff --git a/util/LLgen/proto.make b/util/LLgen/proto.make
deleted file mode 100644 (file)
index d7fa271..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# $Id$
-
-#PARAMS                do not remove this line!
-
-INSTALLDIR=$(TARGET_HOME)/bin
-LIBDIR=$(TARGET_HOME)/lib/LLgen
-
-all:
-       cd src; make LIBDIR=$(LIBDIR)
-
-clean:
-       -cd src; make clean
-
-install:
-       cd src; make LIBDIR=$(LIBDIR)
-       cp src/LLgen $(INSTALLDIR)/LLgen
-       if [ $(DO_MACHINE_INDEP) = y ] ; \
-       then    cp $(SRC_HOME)/util/LLgen/lib/rec $(LIBDIR)/rec ; \
-               cp $(SRC_HOME)/util/LLgen/lib/incl $(LIBDIR)/incl ; \
-               cp $(SRC_HOME)/util/LLgen/lib/nc_incl $(LIBDIR)/nc_incl ; \
-               cp $(SRC_HOME)/util/LLgen/lib/nc_rec $(LIBDIR)/nc_rec ; \
-               mk_manpage $(SRC_HOME)/util/LLgen/LLgen.1 $(TARGET_HOME) ; \
-       fi
-
-firstinstall:
-       cd src; make LIBDIR=$(LIBDIR) first
-       cp src/LLgen $(INSTALLDIR)/LLgen
-       if [ $(DO_MACHINE_INDEP) = y ] ; \
-       then    if [ -d $(LIBDIR) ] ; then : ; else mkdir $(LIBDIR) ; fi ; \
-               cp $(SRC_HOME)/util/LLgen/lib/rec $(LIBDIR)/rec ; \
-               cp $(SRC_HOME)/util/LLgen/lib/incl $(LIBDIR)/incl ; \
-               cp $(SRC_HOME)/util/LLgen/lib/nc_incl $(LIBDIR)/nc_incl ; \
-               cp $(SRC_HOME)/util/LLgen/lib/nc_rec $(LIBDIR)/nc_rec ; \
-               mk_manpage $(SRC_HOME)/util/LLgen/LLgen.1 $(TARGET_HOME) ; \
-       fi
-
-cmp:
-       cd src; make LIBDIR=$(LIBDIR)
-       -cmp src/LLgen $(INSTALLDIR)/LLgen
-       -cmp $(SRC_HOME)/util/LLgen/lib/rec $(LIBDIR)/rec
-       -cmp $(SRC_HOME)/util/LLgen/lib/incl $(LIBDIR)/incl
-       -cmp $(SRC_HOME)/util/LLgen/lib/nc_rec $(LIBDIR)/nc_rec
-       -cmp $(SRC_HOME)/util/LLgen/lib/nc_incl $(LIBDIR)/nc_incl
-
-distr:
-       cd src; make distr
-
-opr:
-       make pr | opr
-
-pr:
-       @cd src; make pr
diff --git a/util/LLgen/src/.distr b/util/LLgen/src/.distr
deleted file mode 100644 (file)
index c9c1b9d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-cclass.c
-cclass.h
-LLgen.c.dist
-LLgen.g
-Lpars.c.dist
-Lpars.h.dist
-Makefile
-proto.make
-alloc.c
-check.c
-compute.c
-extern.h
-gencode.c
-global.c
-io.h
-machdep.c
-main.c
-name.c
-reach.c
-sets.c
-sets.h
-tokens.c.dist
-tokens.g
-types.h
-savegram.c
diff --git a/util/LLgen/src/Makefile b/util/LLgen/src/Makefile
deleted file mode 100644 (file)
index 6729c69..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-# $Id$
-PROF=
-LLOPT= # -vvv -x
-INCLUDES =
-DEFINES = -DNDEBUG -DNON_CORRECTING
-CFLAGS=-O $(DEFINES) $(INCLUDES) $(PROF)
-LDFLAGS=
-OBJECTS = main.o gencode.o compute.o LLgen.o tokens.o check.o reach.o global.o name.o sets.o Lpars.o alloc.o machdep.o cclass.o savegram.o
-CFILES = main.c gencode.c compute.c LLgen.c tokens.c check.c reach.c global.c name.c sets.c Lpars.c alloc.c machdep.c cclass.c savegram.c
-FILES =types.h extern.h io.h sets.h tokens.g LLgen.g main.c name.c compute.c sets.c gencode.c global.c check.c reach.c alloc.c machdep.c Makefile cclass.c savegram.c
-GFILES = tokens.g LLgen.g
-LINT = lint -b $(DEFINES) -DNORCSID
-
-LIBDIRSTR = \"$(LIBDIR)\"
-
-all:           parser
-               @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)" "LIBDIR=$(LIBDIR)"
-
-parser:                $(GFILES)
-               LLgen $(LLOPT) $(GFILES)
-               @touch parser
-
-first:         firstparser
-               @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)" "LIBDIR=$(LIBDIR)"
-
-firstparser:
-               cp LLgen.c.dist LLgen.c
-               cp tokens.c.dist tokens.c
-               cp Lpars.c.dist Lpars.c
-               cp Lpars.h.dist Lpars.h
-               @touch parser
-
-LLgen:         $(OBJECTS)
-               $(CC) $(PROF) $(LDFLAGS) $(OBJECTS) -o LLgen
-               @size LLgen
-
-pr : 
-               @pr $(FILES) ../lib/rec ../lib/incl Makefile
-
-lint: 
-               $(LINT) $(INCLUDES) -DLIBDIR=$(LIBDIRSTR) $(CFILES)
-
-clean:
-               -rm -f *.o LL.temp LL.xxx LL.output LLgen LLgen.c tokens.c Lpars.[ch] parser
-
-distr:
-               -rm -f parser
-               make parser
-               cp Lpars.c Lpars.c.dist
-               cp Lpars.h Lpars.h.dist
-               cp LLgen.c LLgen.c.dist
-               cp tokens.c tokens.c.dist
-
-machdep.o:     machdep.c
-               $(CC) -c $(CFLAGS) -DLIBDIR=$(LIBDIRSTR) machdep.c
-
-# The next lines are generated automatically
-# AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
-LLgen.o:       Lpars.h
-LLgen.o:       cclass.h
-LLgen.o:       extern.h
-LLgen.o:       io.h
-LLgen.o:       types.h
-Lpars.o:       Lpars.h
-alloc.o:       extern.h
-alloc.o:       types.h
-cclass.o:      cclass.h
-check.o:       extern.h
-check.o:       io.h
-check.o:       sets.h
-check.o:       types.h
-compute.o:     extern.h
-compute.o:     io.h
-compute.o:     sets.h
-compute.o:     types.h
-gencode.o:     cclass.h
-gencode.o:     extern.h
-gencode.o:     io.h
-gencode.o:     sets.h
-gencode.o:     types.h
-global.o:      extern.h
-global.o:      io.h
-global.o:      types.h
-machdep.o:     types.h
-main.o:        extern.h
-main.o:        io.h
-main.o:        sets.h
-main.o:        types.h
-name.o:        extern.h
-name.o:        io.h
-name.o:        types.h
-reach.o:       extern.h
-reach.o:       io.h
-reach.o:       types.h
-sets.o:        extern.h
-sets.o:        sets.h
-sets.o:        types.h
-tokens.o:      Lpars.h
-tokens.o:      cclass.h
-tokens.o:      extern.h
-tokens.o:      io.h
-tokens.o:      types.h
diff --git a/util/LLgen/src/proto.make b/util/LLgen/src/proto.make
deleted file mode 100644 (file)
index c28630b..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-# $Id$
-
-#PARAMS                do not remove this line
-
-SRC_DIR = $(SRC_HOME)/util/LLgen/src
-LIBDIR = $(TARGET_HOME)/lib/LLgen
-INCLUDES = -I$(SRC_DIR) -I.
-LIBDIRSTR = \"$(LIBDIR)\"
-DEFINES = -DNDEBUG -DNON_CORRECTING
-CFLAGS = $(DEFINES) $(INCLUDES) $(COPTIONS)
-LDFLAGS=$(LDOPTIONS)
-LINTFLAGS=$(LINTOPTIONS) $(DEFINES) $(INCLUDES) -DNORCSID
-
-LLOPT= # -vvv -x
-
-OBJECTS = main.$(SUF) gencode.$(SUF) compute.$(SUF) LLgen.$(SUF) tokens.$(SUF) \
-       check.$(SUF) reach.$(SUF) global.$(SUF) name.$(SUF) sets.$(SUF) \
-       Lpars.$(SUF) alloc.$(SUF) machdep.$(SUF) cclass.$(SUF) savegram.$(SUF)
-CSRC = $(SRC_DIR)/main.c $(SRC_DIR)/gencode.c $(SRC_DIR)/compute.c \
-       $(SRC_DIR)/check.c $(SRC_DIR)/reach.c $(SRC_DIR)/global.c \
-       $(SRC_DIR)/name.c $(SRC_DIR)/sets.c $(SRC_DIR)/alloc.c \
-       $(SRC_DIR)/machdep.c $(SRC_DIR)/cclass.c $(SRC_DIR)/savegram.c
-CFILES = LLgen.c tokens.c Lpars.c $(CSRC)
-GFILES = $(SRC_DIR)/tokens.g $(SRC_DIR)/LLgen.g
-FILES = $(SRC_DIR)/types.h $(SRC_DIR)/extern.h \
-       $(SRC_DIR)/io.h $(SRC_DIR)/sets.h \
-       $(GFILES) $(CSRC) $(SRC_DIR)/proto.make
-
-all:           parser
-               @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LIBDIR=$(LIBDIR)"
-
-parser:                $(GFILES)
-               LLgen $(LLOPT) $(GFILES)
-               @touch parser
-
-first:         firstparser
-               @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LIBDIR=$(LIBDIR)"
-
-firstparser:
-               cp $(SRC_DIR)/LLgen.c.dist LLgen.c
-               cp $(SRC_DIR)/tokens.c.dist tokens.c
-               cp $(SRC_DIR)/Lpars.c.dist Lpars.c
-               cp $(SRC_DIR)/Lpars.h.dist Lpars.h
-               @touch parser
-
-LLgen:         $(OBJECTS)
-               $(CC) $(LDFLAGS) $(OBJECTS) $(TARGET_HOME)/modules/lib/libsystem.$(LIBSUF) -o LLgen
-
-pr : 
-               @pr $(FILES) $(SRC_HOME)/util/LLgen/lib/rec $(SRC_HOME)/util/LLgen/lib/incl
-
-lint:          parser
-               $(LINT) $(LINTFLAGS) -DLIBDIR=$(LIBDIRSTR) $(CFILES)
-
-clean:
-               -rm -f *.$(SUF) LL.temp LL.xxx LL.output LLgen LLgen.c tokens.c Lpars.[ch] parser
-
-distr:
-               -rm -f parser
-               make parser
-               cp Lpars.c $(SRC_DIR)/Lpars.c.dist
-               cp Lpars.h $(SRC_DIR)/Lpars.h.dist
-               cp LLgen.c $(SRC_DIR)/LLgen.c.dist
-               cp tokens.c $(SRC_DIR)/tokens.c.dist
-
-LLgen.$(SUF):  LLgen.c
-               $(CC) -c $(CFLAGS) LLgen.c
-LLgen.$(SUF):  Lpars.h
-LLgen.$(SUF):  $(SRC_DIR)/cclass.h
-LLgen.$(SUF):  $(SRC_DIR)/extern.h
-LLgen.$(SUF):  $(SRC_DIR)/io.h
-LLgen.$(SUF):  $(SRC_DIR)/types.h
-
-Lpars.$(SUF):  Lpars.c
-               $(CC) -c $(CFLAGS) Lpars.c
-Lpars.$(SUF):  Lpars.h
-
-alloc.$(SUF):  $(SRC_DIR)/alloc.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/alloc.c
-alloc.$(SUF):  $(SRC_DIR)/extern.h
-alloc.$(SUF):  $(SRC_DIR)/types.h
-
-cclass.$(SUF): $(SRC_DIR)/cclass.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/cclass.c
-cclass.$(SUF): $(SRC_DIR)/cclass.h
-
-check.$(SUF):  $(SRC_DIR)/check.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/check.c
-check.$(SUF):  $(SRC_DIR)/extern.h
-check.$(SUF):  $(SRC_DIR)/io.h
-check.$(SUF):  $(SRC_DIR)/sets.h
-check.$(SUF):  $(SRC_DIR)/types.h
-
-compute.$(SUF):        $(SRC_DIR)/compute.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/compute.c
-compute.$(SUF):        $(SRC_DIR)/extern.h
-compute.$(SUF):        $(SRC_DIR)/io.h
-compute.$(SUF):        $(SRC_DIR)/sets.h
-compute.$(SUF):        $(SRC_DIR)/types.h
-
-gencode.$(SUF):        $(SRC_DIR)/gencode.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/gencode.c
-gencode.$(SUF):        $(SRC_DIR)/cclass.h
-gencode.$(SUF):        $(SRC_DIR)/extern.h
-gencode.$(SUF):        $(SRC_DIR)/io.h
-gencode.$(SUF):        $(SRC_DIR)/sets.h
-gencode.$(SUF):        $(SRC_DIR)/types.h
-
-global.$(SUF): $(SRC_DIR)/global.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/global.c
-global.$(SUF): $(SRC_DIR)/extern.h
-global.$(SUF): $(SRC_DIR)/io.h
-global.$(SUF): $(SRC_DIR)/types.h
-
-machdep.$(SUF):        $(SRC_DIR)/machdep.c
-               $(CC) -c $(CFLAGS) -DUSE_SYS -DLIBDIR=$(LIBDIRSTR) $(SRC_DIR)/machdep.c
-machdep.$(SUF):        $(SRC_DIR)/types.h
-
-main.$(SUF):   $(SRC_DIR)/main.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/main.c
-main.$(SUF):   $(SRC_DIR)/extern.h
-main.$(SUF):   $(SRC_DIR)/io.h
-main.$(SUF):   $(SRC_DIR)/sets.h
-main.$(SUF):   $(SRC_DIR)/types.h
-
-name.$(SUF):   $(SRC_DIR)/name.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/name.c
-name.$(SUF):   $(SRC_DIR)/extern.h
-name.$(SUF):   $(SRC_DIR)/io.h
-name.$(SUF):   $(SRC_DIR)/types.h
-
-reach.$(SUF):  $(SRC_DIR)/reach.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/reach.c
-reach.$(SUF):  $(SRC_DIR)/extern.h
-reach.$(SUF):  $(SRC_DIR)/io.h
-reach.$(SUF):  $(SRC_DIR)/types.h
-
-sets.$(SUF):   $(SRC_DIR)/sets.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/sets.c
-sets.$(SUF):   $(SRC_DIR)/extern.h
-sets.$(SUF):   $(SRC_DIR)/sets.h
-sets.$(SUF):   $(SRC_DIR)/types.h
-
-tokens.$(SUF): tokens.c
-               $(CC) -c $(CFLAGS) tokens.c
-tokens.$(SUF): Lpars.h
-tokens.$(SUF): $(SRC_DIR)/cclass.h
-tokens.$(SUF): $(SRC_DIR)/extern.h
-tokens.$(SUF): $(SRC_DIR)/io.h
-tokens.$(SUF): $(SRC_DIR)/types.h
-
-savegram.$(SUF):       $(SRC_DIR)/savegram.c
-               $(CC) -c $(CFLAGS) $(SRC_DIR)/savegram.c
-savegram.$(SUF):       $(SRC_DIR)/types.h
-savegram.$(SUF):       $(SRC_DIR)/extern.h
-savegram.$(SUF):       $(SRC_DIR)/io.h
-savegram.$(SUF):       $(SRC_DIR)/sets.h