🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.v7
Article #57

yacc library

#57
From: utzoohenry
Date: Tue, 20 Apr 1982 19:51
82 lines
1217 bytes
The V7 distribution does not include the -ly library at all.  This is
not serious since it can be built from the description in the manual.
I also added a default yylex to ours.  The following are the sources,
the makefile, and a simple test program.

--- main.c ---
main()
{
	return(yyparse());
}
--- yyerror.c ---
#include <stdio.h>

yyerror(s)
char *s;
{
	fprintf(stderr, "%s\n", s);
}
--- yylex.c ---
#include <stdio.h>

int
yylex()
{
	return(getchar());
}
--- Makefile ---
CFLAGS=-O

all:	liby.a

cp:	liby.a
	cp liby.a /usr/lib/liby.a

liby.a:	main.o yyerror.o yylex.o
	ar cr liby.a main.o yyerror.o yylex.o

clean:
	rm -f liby.a *.o test

test:	test.o liby.a
	$(CC) -n test.o liby.a -o test
--- test.y ---
%%
all:
	word
	|
	all space word
	;

word:
	if
	|
	but
	|
	maybe
	;

if:
	'i' 'f' {
		printf("if\n");
	}

but:
	'b' 'u' 't' {
		printf("but\n");
	}

maybe:
	'm' 'a' 'y' 'b' 'e' {
		printf("maybe\n");
	}

space:	aspace
	|
	space aspace
	;

aspace:	' '
	|
	'\n'
	;
Technical Details
Message-ID: <anews.Autzoo.1588>
Path: arc1-ca.pugleaf.net!utzoo!henry

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!henry
From: utzoo!henry
Newsgroups: net.bugs.v7
Subject: yacc library
Date: Tue, 20 Apr 1982 19:51:59 +0000
Message-ID: <anews.Autzoo.1588>