summaryrefslogtreecommitdiff
path: root/devel/lemon
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2001-06-05 03:48:42 +0000
committerMikhail Teterin <mi@FreeBSD.org>2001-06-05 03:48:42 +0000
commit258dab36c2f4dfa7f4468a9096e90c80732cc23a (patch)
treec4f7a5c2b6dbdce07120319bd96e6d11c0e73beb /devel/lemon
parentUpdate to 20010604, and build with SSL/TLS support. (diff)
The Lemon program is an LALR(1) parser generator. It 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 lemon is not compatible with either yacc or bison. There are several important differences: . Lemon using a different grammar syntax which is less prone to programming errors. . Lemon generates a parser that is faster than Yacc or Bison parsers (according to the author). . The parser generated by Lemon is both re-entrant and thread-safe. . Lemon includes the concept of a non-terminal destructor, which makes it much easier to write a parser that does not leak memory. WWW: http://www.hwaci.com/sw/lemon/
Notes
Notes: svn path=/head/; revision=43506
Diffstat (limited to 'devel/lemon')
-rw-r--r--devel/lemon/Makefile32
-rw-r--r--devel/lemon/distinfo2
-rw-r--r--devel/lemon/files/patch-aa100
-rw-r--r--devel/lemon/pkg-comment1
-rw-r--r--devel/lemon/pkg-descr21
-rw-r--r--devel/lemon/pkg-plist3
6 files changed, 159 insertions, 0 deletions
diff --git a/devel/lemon/Makefile b/devel/lemon/Makefile
new file mode 100644
index 000000000000..b356ade89c08
--- /dev/null
+++ b/devel/lemon/Makefile
@@ -0,0 +1,32 @@
+# Ports collection makefile for: lemon
+# Date created: June 4, 2001
+# Whom: Mikhail Teterin
+#
+# $FreeBSD$
+#
+
+PORTNAME= lemon
+PORTVERSION= 1.0
+CATEGORIES= devel
+MASTER_SITES= http://www.hwaci.com/sw/lemon/
+DISTFILES= lemon.c lempar.c
+
+MAINTAINER= mi@aldan.algebra.com
+
+NO_WRKSUBDIR= YES
+
+do-extract:
+ ${MKDIR} ${WRKSRC}
+ ${CP} -p ${DISTDIR}/lemon.c ${WRKSRC}
+
+do-build:
+ cd ${WRKSRC} && ${MAKE} VPATH=${DISTDIR} PROG=lemon NOMAN=1 \
+ CFLAGS="${CFLAGS} -DLEMPAR='\"${PREFIX}/share/lemon/lempar.c\"'" \
+ -f bsd.prog.mk
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKDIR}/${PORTNAME} ${PREFIX}/bin/
+ ${MKDIR} ${PREFIX}/share/lemon
+ ${INSTALL_DATA} ${DISTDIR}/lempar.c ${PREFIX}/share/lemon/
+
+.include <bsd.port.mk>
diff --git a/devel/lemon/distinfo b/devel/lemon/distinfo
new file mode 100644
index 000000000000..abee70b45ac7
--- /dev/null
+++ b/devel/lemon/distinfo
@@ -0,0 +1,2 @@
+MD5 (lemon.c) = 926bc7eb6e5ee8f02e919cc0fe2febd6
+MD5 (lempar.c) = 19c9e510be0b6bde25f945aecc79a97b
diff --git a/devel/lemon/files/patch-aa b/devel/lemon/files/patch-aa
new file mode 100644
index 000000000000..663a90cf1cb2
--- /dev/null
+++ b/devel/lemon/files/patch-aa
@@ -0,0 +1,100 @@
+--- /usr/ports/distfiles/lemon.c Tue Dec 5 20:52:24 2000
++++ ./lemon.c Mon Jun 4 23:35:15 2001
+@@ -31,2 +31,5 @@
+ #include <ctype.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <sys/param.h>
+
+@@ -35,4 +38,2 @@
+ extern long strtol();
+-extern void free();
+-extern int access();
+ extern int atoi();
+@@ -55,3 +56,2 @@
+ char *msort();
+-extern void *malloc();
+
+@@ -2525,45 +2525,13 @@
+
+-/* Search for the file "name" which is in the same directory as
+-** the exacutable */
+-PRIVATE char *pathsearch(argv0,name,modemask)
+-char *argv0;
+-char *name;
+-int modemask;
++PRIVATE const char *pathsearch()
+ {
+- char *pathlist;
+- char *path,*cp;
+- char c;
+- extern int access();
++ const char *path;
+
+-#ifdef __WIN32__
+- cp = strrchr(argv0,'\\');
+-#else
+- cp = strrchr(argv0,'/');
+-#endif
+- if( cp ){
+- c = *cp;
+- *cp = 0;
+- path = (char *)malloc( strlen(argv0) + strlen(name) + 2 );
+- if( path ) sprintf(path,"%s/%s",argv0,name);
+- *cp = c;
+- }else{
+- extern char *getenv();
+- pathlist = getenv("PATH");
+- if( pathlist==0 ) pathlist = ".:/bin:/usr/bin";
+- path = (char *)malloc( strlen(pathlist)+strlen(name)+2 );
+- if( path!=0 ){
+- while( *pathlist ){
+- cp = strchr(pathlist,':');
+- if( cp==0 ) cp = &pathlist[strlen(pathlist)];
+- c = *cp;
+- *cp = 0;
+- sprintf(path,"%s/%s",pathlist,name);
+- *cp = c;
+- if( c==0 ) pathlist = "";
+- else pathlist = &cp[1];
+- if( access(path,modemask)==0 ) break;
+- }
+- }
+- }
+- return path;
++ path = getenv("LEMPAR");
++
++ if (path)
++ if (access(path, R_OK)) perror(path);
++ else return(path);
++
++ return(LEMPAR);
+ }
+@@ -2631,6 +2599,5 @@
+ {
+- static char templatename[] = "lempar.c";
+- char buf[1000];
++ char buf[MAXPATHLEN];
+ FILE *in;
+- char *tpltname;
++ const char *tpltname;
+ char *cp;
+@@ -2643,10 +2610,9 @@
+ }
+- if( access(buf,004)==0 ){
++ if( access(buf, R_OK)==0 ){
+ tpltname = buf;
+ }else{
+- tpltname = pathsearch(lemp->argv0,templatename,0);
++ tpltname = pathsearch();
+ }
+ if( tpltname==0 ){
+- fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
+- templatename);
++ fprintf(stderr,"Can't find the parser driver template file.\n");
+ lemp->errorcnt++;
+@@ -2656,3 +2622,3 @@
+ if( in==0 ){
+- fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
++ fprintf(stderr,"Can't open the template file \"%s\".\n", tpltname);
+ lemp->errorcnt++;
diff --git a/devel/lemon/pkg-comment b/devel/lemon/pkg-comment
new file mode 100644
index 000000000000..0a3855e1139d
--- /dev/null
+++ b/devel/lemon/pkg-comment
@@ -0,0 +1 @@
+An LALR(1) parser generator. Similar in function to yacc and bison
diff --git a/devel/lemon/pkg-descr b/devel/lemon/pkg-descr
new file mode 100644
index 000000000000..4025df838fec
--- /dev/null
+++ b/devel/lemon/pkg-descr
@@ -0,0 +1,21 @@
+The Lemon program is an LALR(1) parser generator. It 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 lemon is not compatible with either yacc or bison. There are several
+important differences:
+
+ . Lemon using a different grammar syntax which is less prone to
+ programming errors.
+
+ . Lemon generates a parser that is faster than Yacc or Bison
+ parsers (according to the author).
+
+ . The parser generated by Lemon is both re-entrant and thread-safe.
+
+ . Lemon includes the concept of a non-terminal destructor, which
+ makes it much easier to write a parser that does not
+ leak memory.
+
+WWW: http://www.hwaci.com/sw/lemon/
diff --git a/devel/lemon/pkg-plist b/devel/lemon/pkg-plist
new file mode 100644
index 000000000000..3dc10ef91982
--- /dev/null
+++ b/devel/lemon/pkg-plist
@@ -0,0 +1,3 @@
+bin/lemon
+share/lemon/lempar.c
+@dirrm share/lemon