diff options
author | mi <mi@FreeBSD.org> | 2001-06-05 11:48:42 +0800 |
---|---|---|
committer | mi <mi@FreeBSD.org> | 2001-06-05 11:48:42 +0800 |
commit | 76b7e8d412ce3a3eae748fa8a41fc830ebee44a7 (patch) | |
tree | 7b011665cfe12560857f1fb753538664ed281879 /devel/lemon | |
parent | 8c136b13142dc662637b3595e61e271f37c79bea (diff) | |
download | freebsd-ports-gnome-76b7e8d412ce3a3eae748fa8a41fc830ebee44a7.tar.gz freebsd-ports-gnome-76b7e8d412ce3a3eae748fa8a41fc830ebee44a7.tar.zst freebsd-ports-gnome-76b7e8d412ce3a3eae748fa8a41fc830ebee44a7.zip |
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/
Diffstat (limited to 'devel/lemon')
-rw-r--r-- | devel/lemon/Makefile | 32 | ||||
-rw-r--r-- | devel/lemon/distinfo | 2 | ||||
-rw-r--r-- | devel/lemon/files/patch-aa | 100 | ||||
-rw-r--r-- | devel/lemon/pkg-comment | 1 | ||||
-rw-r--r-- | devel/lemon/pkg-descr | 21 | ||||
-rw-r--r-- | devel/lemon/pkg-plist | 3 |
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 |