[comp.sources.misc] v20i017: wacco - A C++ LL parser generator, Patch01

parag@hpsdeb.sde.hp.com (Parag Patel) (05/24/91)

Submitted-by: Parag Patel <parag@hpsdeb.sde.hp.com>
Posting-number: Volume 20, Issue 17
Archive-name: wacco/patch01
Patch-To: wacco: Volume 19, Issue 88-93

This is the first bug fix to wacco.  There was a bug in gen.C fixed 
where the string "(null)" was generated on Sparc because I was passing 
NULL to printf().  Some typos have been fixed in the wacco.doc example 
but NOT in wacco.doc.{iw,ps} To apply the patch, unshar this file and ..

	patch < patch-1.1-1.2

   -- Parag

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 05/23/1991 17:42 UTC by parag@hpsdeb
# Source directory /users/parag/tools/wacco/VERSIONS
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   4768 -rw-r--r-- patch-1.1-1.2
#
# ============= patch-1.1-1.2 ==============
if test -f 'patch-1.1-1.2' -a X"$1" != X"-c"; then
	echo 'x - skipping patch-1.1-1.2 (File already exists)'
else
sed 's/^X//' << 'SHAR_EOF' > 'patch-1.1-1.2' &&
*** tmp/README	Fri May 17 15:29:52 1991
--- README	Mon May 20 19:38:39 1991
***************
*** 1,4
! $Header: README,v 1.7 91/05/17 16:29:53 hmgr Exp $
X  
X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
X  You can do what you wish with this as long as
X
--- 1,4 -----
! $Header: README,v 1.10 91/05/20 20:38:40 hmgr Exp $
X  
X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
X  You can do what you wish with this as long as
***************
*** 9,15
X  software.  It is completely unsupported.  You're on your own.
X  
X  
! This is version 1.1 of Wacco, basically an LL(1) parser generator.
X  Why Another Compiler COmpiler?  Why not?!?
X  
X  Wacco generates recursive-descent C++ code from an input file.  The
X
--- 9,15 -----
X  software.  It is completely unsupported.  You're on your own.
X  
X  
! This is Wacco, which is basically an LL(1) parser generator.
X  Why Another Compiler COmpiler?  Why not?!?
X  
X  Wacco generates recursive-descent C++ code from an input file.  The
***************
*** 58,60
X  
X  
X  	-- Parag Patel <parag@sde.hp.com>
X
--- 58,77 -----
X  
X  
X  	-- Parag Patel <parag@sde.hp.com>
+ 
+ 
+ 
+ --------------------REVISION-INFO----------------------
+ 
+ 1.0	released on HP INTERX Contrib Tape
+ 
+ 1.1	first version released to comp.sources.misc
+ 	files modified: Makefile README defs.h table.h version.C
+ 	ported to Sparc, added -Dstuff in Makefile
+ 	fixed problem with macro names in table.h
+ 
+ 1.2	first bug-fix release
+ 	files modified: gen.C wacco.doc
+ 	bug in gen.C fixed where the string "(null)" was generated on Sparc
+ 		because I was passing NULL to printf()
+ 	some typos fixed in wacco.doc example but NOT in wacco.doc.{iw,ps}
*** tmp/gen.C	Fri Feb 22 15:08:25 1991
--- gen.C	Mon May 20 12:18:31 1991
***************
*** 1,5
X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
! static const char rcs_id[] = "$Header: gen.C,v 1.29 91/02/22 16:08:02 hmgr Exp $";
X  
X  #include "defs.h"
X  #include "toks.h"
X
--- 1,5 -----
X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
! static const char rcs_id[] = "$Header: gen.C,v 1.30 91/05/20 13:18:31 hmgr Exp $";
X  
X  #include "defs.h"
X  #include "toks.h"
***************
*** 115,121
X  		return FALSE;
X  }
X  
! static const char *mktype(symbol *sym, char *pre = "", char *post = NULL)
X  {
X      if (!dotype(sym))
X  	return "";
X
--- 115,121 -----
X  		return FALSE;
X  }
X  
! static const char *mktype(symbol *sym, char *pre = "", char *post = "")
X  {
X      if (!dotype(sym))
X  	return "";
***************
*** 136,142
X      return strbldf("%s%s%s", pre, name, post);
X  }
X  
! static const char *mkvoidtype(symbol *sym, char *pre = "", char *post = NULL)
X  {
X      const char *type = mktype(sym, pre, post);
X      if (*type == '\0')
X
--- 136,142 -----
X      return strbldf("%s%s%s", pre, name, post);
X  }
X  
! static const char *mkvoidtype(symbol *sym, char *pre = "", char *post = "")
X  {
X      const char *type = mktype(sym, pre, post);
X      if (*type == '\0')
*** tmp/version.C	Fri May 17 15:30:01 1991
--- version.C	Mon May 20 12:18:33 1991
***************
*** 1,3
X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
X  
! static char *const whatid = "@(#)wacco 1.1 (17 May 1991)";
X
--- 1,3 -----
X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
X  
! static char *const whatid = "@(#)wacco 1.2 (20 May 1991)";
*** tmp/wacco.doc	Fri Feb 22 15:04:39 1991
--- wacco.doc	Mon May 20 19:28:08 1991
***************
*** 1,5
X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
! << $Header: wacco.doc,v 1.25 91/02/22 16:04:23 hmgr Exp $ >>
X  
X  << Please see the wacco(1) man page for details on its usage. >>
X  << Only the grammar format is described here.                 >>
X
--- 1,5 -----
X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
! << $Header: wacco.doc,v 1.27 91/05/20 20:28:05 hmgr Exp $ >>
X  
X  << Please see the wacco(1) man page for details on its usage. >>
X  << Only the grammar format is described here.                 >>
***************
*** 420,426
X  
X  
X  
! ================= E X A M P L E    G R A M M E R ==================
X  
X  // This is the usual required calculator sample.  It can still use
X  // a LOT of work, but it illustrates the basics.  Note that the
X
--- 420,426 -----
X  
X  
X  
! ================= E X A M P L E    G R A M M A R ==================
X  
X  // This is the usual required calculator sample.  It can still use
X  // a LOT of work, but it illustrates the basics.  Note that the
***************
*** 487,493
X  
X  "."		{ return (int)EOI; }
X  
! $DOUBLE		({D}+)|({D}+\.{D}+)|({D}+[Ee]-?{D}+)|({D}+\.{D}+[Ee]-?{D}+)
X  
X  "#".*$		;
X  
X
--- 487,493 -----
X  
X  "."		{ return (int)EOI; }
X  
! $DOUBLE		({D}+)|({D}+\.{D}*)|({D}+[Ee]-?{D}+)|({D}+\.{D}*[Ee]-?{D}+)
X  
X  "#".*$		;
X  
SHAR_EOF
chmod 0644 patch-1.1-1.2 ||
echo 'restore of patch-1.1-1.2 failed'
Wc_c="`wc -c < 'patch-1.1-1.2'`"
test 4768 -eq "$Wc_c" ||
	echo 'patch-1.1-1.2: original size 4768, current size' "$Wc_c"
fi
exit 0

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.