ivlpp: Removed the unnecessary parser

The verilog preprocessing language is sufficiently simple
that the parser may be implemented by hand on top of the
lexical analyzer.

In fact, ivlpp was already implemented in this way; relevant
[bison] parser files specified no grammar, and the parser
entry-point (yyparse) was simply an indirect use of the lexical
analyzer (yylex).

Therefore, parse.y has been removed, invocations of yyparse()
have been replaced by yylex(), references to bison generated
files have been removed, and Makefile.in has been updated
accordingly.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
This commit is contained in:
Michael Witten 2008-02-14 03:26:41 -05:00 committed by Stephen Williams
parent e989f63192
commit 623073c722
6 changed files with 7 additions and 57 deletions

View File

@ -1,6 +1,3 @@
lexor.c
parse.c
parse.h
parse.output
Makefile
ivlpp

View File

@ -47,12 +47,12 @@ LDFLAGS = @LDFLAGS@
all: ivlpp@EXEEXT@
clean:
rm -f *.o lexor.c parse.c parse.h parse.output ivlpp@EXEEXT@
rm -f *.o lexor.c ivlpp@EXEEXT@
distclean: clean
rm -f Makefile
O = main.o lexor.o parse.o
O = main.o lexor.o
ivlpp@EXEEXT@: $O
$(CC) $(LDFLAGS) $O -o ivlpp@EXEEXT@ @EXTRALIBS@
@ -60,9 +60,6 @@ ivlpp@EXEEXT@: $O
lexor.c: lexor.lex
flex -olexor.c $(srcdir)/lexor.lex
parse.h parse.c: parse.y
bison --verbose -t -d -o parse.c $(srcdir)/parse.y
install: all installdirs $(libdir)/ivl/ivlpp@EXEEXT@
$(libdir)/ivl/ivlpp@EXEEXT@: ivlpp@EXEEXT@
@ -74,6 +71,5 @@ installdirs: ../mkinstalldirs
uninstall:
rm -f $(libdir)/ivl/ivlpp@EXEEXT@
lexor.o: lexor.c parse.h globals.h
lexor.o: lexor.c globals.h
main.o: main.c globals.h
parse.o: parse.c

View File

@ -39,7 +39,7 @@ extern unsigned error_count;
extern FILE *depend_file;
/* This is the entry to the parser. */
extern int yyparse();
/* This is the entry to the lexer. */
extern int yylex();
#endif

View File

@ -30,7 +30,6 @@
# include <ctype.h>
# include <assert.h>
# include "parse.h"
# include "globals.h"
static void output_init();

View File

@ -352,9 +352,9 @@ int main(int argc, char*argv[])
}
/* Pass to the lexical analyzer the list of input file, and
start the parser. */
start scanning. */
reset_lexor(out, source_list);
if (yyparse()) return -1;
if (yylex()) return -1;
if(depend_file) {
fclose(depend_file);

View File

@ -1,42 +0,0 @@
%{
/*
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.4 2003/08/26 16:26:02 steve Exp $"
#endif
# include <stdio.h>
static void yyerror(const char*msg);
extern int yylex (void);
%}
%%
file : ;
%%
void yyerror(const char*msg)
{
fprintf(stderr, "ivlpp error: %s\n", msg);
}