From: Terence Parr <> Date: Fri, 6 Oct 1995 00:39:44 +0000 (-0500) Subject: auto commit for import X-Git-Url: https://pd.if.org/git/?p=pccts;a=commitdiff_plain;h=6d2ac3f332762a7d8fd47331a3a53ab59612c8bd auto commit for import --- diff --git a/NOTES.BCC b/NOTES.BCC new file mode 100755 index 0000000..8316ce5 --- /dev/null +++ b/NOTES.BCC @@ -0,0 +1,184 @@ +March 95 +Version 1.32 of pccts + +At the moment this file is available via anonymous FTP at + + Node: marvin.ecn.purdue.edu + File: pub/pccts/1.32/NOTES.BCC + +Mail corrections or additions to David Seidel <71333.1575@compuserve.com> +=============================================================================== +Notes on Building PCCTS 1.32 with Borland C++ + +David Seidel, Innovative Data Concepts Incorporated +CompuServe: 71333,1575 +Internet: 71333.1575@compuserve.com + dseidel@delphi.com + +I have gotten ANTLR and DLG to succesfully build with BCC 4.0, but have found +from experience that ANTLR, in particular, is likely to run out of memory +with grammars over a certain size, or with larger values for the -k and -ck +options. Now that BCC 4.02 and the new Borland Power Pack for DOS is now +available, I feel that there is no excuse not to build these tools as +32-bit executables, as they ought to be. + +For people without the Power Pack, the makefiles below should be fairly easily +modified to build 16-bit real-mode executables, but I don't really recommend +it. As an alternative, you might consider the highly regarded DJGPP compiler +(a DOS port of the Gnu GCC compiler, with a DOS extender included). Hopefully +some other PCCTS who has DJGPP can provode whatever advice is necessary. The +Watcom compiler is also an excellent possibility (albeit a commercial one), +and I hope to make available Watcom makefiles in the near future. + +Here are the makefiles I am using. Both makefiles use a compiler configuration +file that contains compiler switches such as optimization settings. I call +this file bor32.cfg and keep a copy in both the ANTLR and DLG subdirectories. + +==== File: bor32.cfg (cut here) =============================================== +-w- +-RT- +-x- +-N- +-k- +-d +-O2-e-l +-Z +-D__STDC__=1 +==== End of file bor32.cfg (cut here) ========================================= + +==== File: antlr\bor32.mak (cut here) ========================================= +# +# ANTLR 1.32 Makefile for Borland C++ 4.02 with DPMI 32-bit DOS extender by +# David Seidel +# Innovative Data Concepts Incorporated +# 71333.1575@compuserve.com (or) dseidel@delphi.com +# +# Notes: 1. Compiler switches (optimization etc.) are contained in the +# file bor32.cfg. +# 2. This makefile requires Borland C++ 4.02 or greater with +# the DOS Power Pack add-on package. +# 3. Change the BCCDIR macro below to the topmost directory in +# which BCC is installed on your system. +# + +BCCDIR = d:\bc4 +CC = bcc32 +SET = ..\support\set +PCCTS_H = ..\h +ANTLR = ..\bin\antlr +DLG = ..\bin\dlg +CFLAGS = -I$(BCCDIR)\include -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN \ + +bor32.cfg +LIBS = dpmi32 cw32 +OBJ_EXT = obj +OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj fset.obj \ + gen.obj globals.obj hash.obj lex.obj main.obj misc.obj pred.obj dialog.obj \ + set.obj + +.c.obj: + $(CC) -c $(CFLAGS) {$&.c } + +antlr.exe: $(OBJS) + tlink32 @&&| +-Tpe -ax -c -s -L$(BCCDIR)\lib + +$(BCCDIR)\lib\c0x32 $** +$@ + +$(LIBS) +; +| + copy *.exe ..\bin + + +# *********** Target list of PC machines *********** +# +# Don't worry about the ambiguity messages coming from antlr +# for making antlr.c etc... [should be 10 of them, I think] +# + +# leave this commented out for initial build! +#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g +# $(ANTLR) antlr.g + +antlr.$(OBJ_EXT): antlr.c mode.h tokens.h + +scan.$(OBJ_EXT): scan.c mode.h tokens.h + +# leave this commented out for initial build! +#scan.c mode.h: parser.dlg +# $(DLG) -C2 parser.dlg scan.c + +set.$(OBJ_EXT): $(SET)\set.c + $(CC) -c $(CFLAGS) $(SET)\set.c + +==== End of file antlr\bor32.mak (cut here) =================================== + +==== File: dlg\bor32.mak (cut here) =========================================== +# +# DLG 1.32 Makefile for Borland C++ 4.02 with DPMI 32-bit DOS extender by +# David Seidel +# Innovative Data Concepts Incorporated +# 71333.1575@compuserve.com (or) dseidel@delphi.com +# +# Notes: 1. Compiler switches (optimization etc.) are contained in the +# file bor32.cfg. +# 2. This makefile requires Borland C++ 4.02 or greater with +# the DOS Power Pack add-on package. +# 3. Change the BCCDIR macro below to the topmost directory in +# which BCC is installed on your system. +# + + +BCCDIR = d:\bc4 +CC = bcc32 +SET = ..\support\set +PCCTS_H = ..\h +ANTLR = ..\bin\antlr +DLG = ..\bin\dlg +CFLAGS = -I$(BCCDIR)\include -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN \ + +bor32.cfg +LIBS = dpmi32 cw32 +OBJ_EXT = obj +OBJS = dlg_p.obj dlg_a.obj main.obj err.obj support.obj \ + output.obj relabel.obj automata.obj set.obj + +.c.obj: + $(CC) -c $(CFLAGS) {$&.c } + +dlg.exe : $(OBJS) + tlink32 @&&| +-Tpe -ax -c -s -L$(BCCDIR)\lib + +c0x32 $** +$@ + +$(LIBS) +; +| + copy *.exe ..\bin + +dlg_p.obj: dlg_p.c + +dlg_a.obj: dlg_a.c + +main.obj: main.c + +err.obj: err.c + +support.obj: support.c + +output.obj: output.c + +relabel.obj: relabel.c + +automata.obj: automata.c + +set.$(OBJ_EXT): $(SET)\set.c + $(CC) -c $(CFLAGS) $(SET)\set.c + +==== End of file dlg\bor32.mak (cut here) ===================================== + + + + + + diff --git a/NOTES.MSVC b/NOTES.MSVC new file mode 100755 index 0000000..ad0dd1e --- /dev/null +++ b/NOTES.MSVC @@ -0,0 +1,854 @@ + Microsoft Visual C Stuff + +[Modified by Terence Parr (September 1995) to change .C to .cpp ] + +[This file contains notes on MSVC for Windows NT console execs by Dave + Seidel and an explanation of flags etc.. by John Hall; good luck, + Terence] + +Date: Sat, 31 Dec 1994 11:40:36 -0500 (EST) +From: David Seidel <75342.2034@compuserve.com> + +I've succesfully build 1.31b3 with djgpp for DOS and MSVC 2.0 for Windows +NT. The only (minor) problem I had was that GNU make (version 3.71, in the +djgpp port) complained about "multiple targets" in both the antlr and dlg +makefiles. I got around the error by, in each makefile, commenting out the +$(SRC) dependency, for example: + + antlr: $(OBJ) #$(SRC) + +I don't know why this is happenning, since you haven't changed that part of +the makefile at all, and I think this used to work ok... + +Here are the makefiles I built from within the MSVC 2.0 environment for antlr +and dlg and Windows NT console executables. Please feel free to pass them +on. Of course, as soon as 1.31 "goes gold", I will send you nice new +binaries. I'm not going to bother to keep doing both Borland and djgpp for +DOS however. Instead, I'll just keep the djgpp version up to date and also +provide WinNT binaries. + +Dave + +------ File antlr.mak: -------------- + +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ANTLR.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Release" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "WinRel" +# PROP BASE Intermediate_Dir "WinRel" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "WinRel" +# PROP Intermediate_Dir "WinRel" +OUTDIR=.\WinRel +INTDIR=.\WinRel + +ALL : $(OUTDIR)/ANTLR.exe $(OUTDIR)/ANTLR.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /W2 /YX /O2 /I "..\h" /I "..\support\set" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /W2 /YX /O2 /I "..\h" /I "..\support\set" /D "WIN32" /D\ + "NDEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /Fp$(OUTDIR)/"ANTLR.pch"\ + /Fo$(INTDIR)/ /c +CPP_OBJS=.\WinRel/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"ANTLR.bsc" + +$(OUTDIR)/ANTLR.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no\ + /PDB:$(OUTDIR)/"ANTLR.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"ANTLR.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/HASH.OBJ \ + $(INTDIR)/MISC.OBJ \ + $(INTDIR)/BUILD.OBJ \ + $(INTDIR)/ANTLR.OBJ \ + $(INTDIR)/GLOBALS.OBJ \ + $(INTDIR)/PRED.OBJ \ + $(INTDIR)/FSET.OBJ \ + $(INTDIR)/FSET2.OBJ \ + $(INTDIR)/GEN.OBJ \ + $(INTDIR)/MAIN.OBJ \ + $(INTDIR)/SCAN.OBJ \ + $(INTDIR)/LEX.OBJ \ + $(INTDIR)/ERR.OBJ \ + $(INTDIR)/BITS.OBJ \ + $(INTDIR)/SET.OBJ + +$(OUTDIR)/ANTLR.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "WinDebug" +# PROP BASE Intermediate_Dir "WinDebug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "WinDebug" +# PROP Intermediate_Dir "WinDebug" +OUTDIR=.\WinDebug +INTDIR=.\WinDebug + +ALL : $(OUTDIR)/ANTLR.exe $(OUTDIR)/ANTLR.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /MD /W2 /Zi /YX /Od /I "..\h" /I "..\support\set" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /c +# SUBTRACT CPP /Gf /Fr +CPP_PROJ=/nologo /MD /W2 /Zi /YX /Od /I "..\h" /I "..\support\set" /D "WIN32"\ + /D "_DEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /Fp$(OUTDIR)/"ANTLR.pch"\ + /Fo$(INTDIR)/ /Fd$(OUTDIR)/"ANTLR.pdb" /c +CPP_OBJS=.\WinDebug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"ANTLR.bsc" + +$(OUTDIR)/ANTLR.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /PDB:none /DEBUG /MACHINE:I386 +# SUBTRACT LINK32 /MAP +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /NOLOGO /SUBSYSTEM:console /PDB:none /DEBUG /MACHINE:I386\ + /OUT:$(OUTDIR)/"ANTLR.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/HASH.OBJ \ + $(INTDIR)/MISC.OBJ \ + $(INTDIR)/BUILD.OBJ \ + $(INTDIR)/ANTLR.OBJ \ + $(INTDIR)/GLOBALS.OBJ \ + $(INTDIR)/PRED.OBJ \ + $(INTDIR)/FSET.OBJ \ + $(INTDIR)/FSET2.OBJ \ + $(INTDIR)/GEN.OBJ \ + $(INTDIR)/MAIN.OBJ \ + $(INTDIR)/SCAN.OBJ \ + $(INTDIR)/LEX.OBJ \ + $(INTDIR)/ERR.OBJ \ + $(INTDIR)/BITS.OBJ \ + $(INTDIR)/SET.OBJ + +$(OUTDIR)/ANTLR.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\HASH.C +DEP_HASH_=\ + .\HASH.H + +$(INTDIR)/HASH.OBJ : $(SOURCE) $(DEP_HASH_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MISC.C +DEP_MISC_=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/MISC.OBJ : $(SOURCE) $(DEP_MISC_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\BUILD.C +DEP_BUILD=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/BUILD.OBJ : $(SOURCE) $(DEP_BUILD) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ANTLR.C +DEP_ANTLR=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/ANTLR.OBJ : $(SOURCE) $(DEP_ANTLR) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\GLOBALS.C +DEP_GLOBA=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/GLOBALS.OBJ : $(SOURCE) $(DEP_GLOBA) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\PRED.C +DEP_PRED_=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/PRED.OBJ : $(SOURCE) $(DEP_PRED_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\FSET.C +DEP_FSET_=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/FSET.OBJ : $(SOURCE) $(DEP_FSET_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\FSET2.C +DEP_FSET2=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/FSET2.OBJ : $(SOURCE) $(DEP_FSET2) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\GEN.C +DEP_GEN_C=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/GEN.OBJ : $(SOURCE) $(DEP_GEN_C) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MAIN.C +DEP_MAIN_=\ + .\STDPCCTS.H\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/MAIN.OBJ : $(SOURCE) $(DEP_MAIN_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\SCAN.C +DEP_SCAN_=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\H\DLGAUTO.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/SCAN.OBJ : $(SOURCE) $(DEP_SCAN_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEX.C +DEP_LEX_C=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/LEX.OBJ : $(SOURCE) $(DEP_LEX_C) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ERR.C +DEP_ERR_C=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\ERR.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/ERR.OBJ : $(SOURCE) $(DEP_ERR_C) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\BITS.C +DEP_BITS_=\ + \PCCTS\SUPPORT\SET\SET.H\ + .\SYN.H\ + .\HASH.H\ + .\GENERIC.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\CONFIG.H\ + .\PROTO.H + +$(INTDIR)/BITS.OBJ : $(SOURCE) $(DEP_BITS_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\PCCTS\SUPPORT\SET\SET.C +DEP_SET_C=\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/SET.OBJ : $(SOURCE) $(DEP_SET_C) $(INTDIR) + $(CPP) $(CPP_PROJ) $(SOURCE) + +# End Source File +# End Group +# End Project +################################################################################ +------ File dlg.mak: ---------------- + +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "DLG.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "WinRel" +# PROP BASE Intermediate_Dir "WinRel" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "WinRel" +# PROP Intermediate_Dir "WinRel" +OUTDIR=.\WinRel +INTDIR=.\WinRel + +ALL : $(OUTDIR)/DLG.exe $(OUTDIR)/DLG.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /W2 /YX /O2 /I "..\h" /I "..\support\set" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /W2 /YX /O2 /I "..\h" /I "..\support\set" /D "WIN32" /D\ + "NDEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /Fp$(OUTDIR)/"DLG.pch"\ + /Fo$(INTDIR)/ /c +CPP_OBJS=.\WinRel/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"DLG.bsc" + +$(OUTDIR)/DLG.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no\ + /PDB:$(OUTDIR)/"DLG.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"DLG.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/SET.OBJ \ + $(INTDIR)/AUTOMATA.OBJ \ + $(INTDIR)/SUPPORT.OBJ \ + $(INTDIR)/DLG_P.OBJ \ + $(INTDIR)/ERR.OBJ \ + $(INTDIR)/MAIN.OBJ \ + $(INTDIR)/DLG_A.OBJ \ + $(INTDIR)/RELABEL.OBJ \ + $(INTDIR)/OUTPUT.OBJ + +$(OUTDIR)/DLG.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "WinDebug" +# PROP BASE Intermediate_Dir "WinDebug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "WinDebug" +# PROP Intermediate_Dir "WinDebug" +OUTDIR=.\WinDebug +INTDIR=.\WinDebug + +ALL : $(OUTDIR)/DLG.exe $(OUTDIR)/DLG.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /MD /W2 /Zi /YX /Od /I "..\h" /I "..\support\set" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /MD /W2 /Zi /YX /Od /I "..\h" /I "..\support\set" /D "WIN32"\ + /D "_DEBUG" /D "_CONSOLE" /D "USER_ZZSYN" /D "PC" /Fp$(OUTDIR)/"DLG.pch"\ + /Fo$(INTDIR)/ /Fd$(OUTDIR)/"DLG.pdb" /c +CPP_OBJS=.\WinDebug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"DLG.bsc" + +$(OUTDIR)/DLG.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /PDB:none /DEBUG /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /NOLOGO /SUBSYSTEM:console /PDB:none /DEBUG /MACHINE:I386\ + /OUT:$(OUTDIR)/"DLG.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/SET.OBJ \ + $(INTDIR)/AUTOMATA.OBJ \ + $(INTDIR)/SUPPORT.OBJ \ + $(INTDIR)/DLG_P.OBJ \ + $(INTDIR)/ERR.OBJ \ + $(INTDIR)/MAIN.OBJ \ + $(INTDIR)/DLG_A.OBJ \ + $(INTDIR)/RELABEL.OBJ \ + $(INTDIR)/OUTPUT.OBJ + +$(OUTDIR)/DLG.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=\PCCTS\SUPPORT\SET\SET.C + +$(INTDIR)/SET.OBJ : $(SOURCE) $(INTDIR) + $(CPP) $(CPP_PROJ) $(SOURCE) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\AUTOMATA.C +DEP_AUTOM=\ + .\DLG.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/AUTOMATA.OBJ : $(SOURCE) $(DEP_AUTOM) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\SUPPORT.C +DEP_SUPPO=\ + .\DLG.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/SUPPORT.OBJ : $(SOURCE) $(DEP_SUPPO) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\DLG_P.C +DEP_DLG_P=\ + .\DLG.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/DLG_P.OBJ : $(SOURCE) $(DEP_DLG_P) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ERR.C +DEP_ERR_C=\ + .\DLG.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + \PCCTS\H\ERR.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/ERR.OBJ : $(SOURCE) $(DEP_ERR_C) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MAIN.C +DEP_MAIN_=\ + .\STDPCCTS.H\ + .\DLG.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/MAIN.OBJ : $(SOURCE) $(DEP_MAIN_) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\DLG_A.C +DEP_DLG_A=\ + .\DLG.H\ + \PCCTS\H\ANTLR.H\ + .\TOKENS.H\ + \PCCTS\H\DLGDEF.H\ + .\MODE.H\ + \PCCTS\H\DLGAUTO.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/DLG_A.OBJ : $(SOURCE) $(DEP_DLG_A) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\RELABEL.C +DEP_RELAB=\ + .\DLG.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/RELABEL.OBJ : $(SOURCE) $(DEP_RELAB) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\OUTPUT.C +DEP_OUTPU=\ + .\DLG.H\ + \PCCTS\SUPPORT\SET\SET.H\ + \PCCTS\H\CONFIG.H + +$(INTDIR)/OUTPUT.OBJ : $(SOURCE) $(DEP_OUTPU) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ +------------------------------------- + + How to port PCCTS 1.10 (and 1.32 hopefully) to Visual C++ + + By + + John Hall + +Here is how to compile an ANTLR grammar in Visual C++. These steps +describe how to have your ANTLR grammar parse the input file the user +selects when they choose File Open in your Windows application. (Even +if you aren't using Visual C++, the steps should be portable enough to +other compilers.) + + * Make sure that ANTLR and DLG generate ANSI code (use the -ga + switch). + + * Set the following compiler flags in Visual C++ (these are in the + Memory Model category of the compiler options in the Project + Options menu): + + FLAG MEANING + ==== ============================================================== + /AL Large memory model (multiple data segments; data items must be + smaller than 64K). + + /Gtn Allocates all items whose size is greater than or equal to n + in a new data segment. (I let n be 256: /Gt256.) + + /Gx- All references to data items are done with far addressing in + case they are placed in a far segment. + + * Add the following member variable to the attributes section of your + derived CDocument class (you will need to make sure you also + include stdio.h): + + FILE *fp; + + * Add the following method to your derived CDocument class: + + BOOL CAppDoc::OnOpenDocument(const char* pszPathName) + { + // Call CDocument's OnOpenDocument to do housekeeping for us + // DON'T add anything to the loading section of Serialize + if (!CDocument::OnOpenDocument(pszPathName)) + return FALSE; + + // Open input file + if ((fp = fopen(pszPathName, "r")) == NULL) + return FALSE; + + // Parse input file + ANTLR(start(), fp); + + // Close input file + fclose(fp); + return TRUE; + } + + (Note: additional code may be necessary, depending on your parser. + For example, if your parser uses PCCTS's symbol table library, you + will need to insert calls to zzs_init and zzs_done.) + + * Compile the generated C files as C++ files. (I renamed the files + to have a .CPP extension to fool Visual C++ into thinking they were + C++ files. One might also use the /Tp switch, but that switch + requires you separately include the filename.) [I used this step + as an easy out for all the external linking errors I was getting + that I couldn't fix by declaring things extern "C".] + + * Make sure the __STDC__ portion of the generated files gets + compiled. (Either define __STDC__ yourself or else change all + occurrences of __STDC__ to __cplusplus in the generated files. You + can define __STDC__ in the Preprocessor category of the compiler + options.) + +That last step is important for Visual C++, but may not apply to other +compilers. For C++ compilers, whether __STDC__ is defined is +implementation dependent (ARM, page 379). Apparently, Visual C++ does +not to define it; it also does not support "old style" C function +definitions (which is okay, according to page 404 of the ARM). Those +two things together caused problems when trying to port the code. +When it saw this: + +#ifdef __STDC__ +void +globals(AST **_root) +#else +globals(_root) +AST **_root; +#endif + +it skipped the __STDC__ section and tried to process the "old style" +function definition, where it choked. + +When you finally get your parser to compile and link without error, +you may get General Protection Fault errors at run time. The problem +I had was that a NULL was passed to a variable argument function +without an explicit cast. The function grabbed a pointer (32-bits) +off the stack using va_arg, but the NULL was passed silently as the +integer 0 (16 bits), making the resulting pointer was invalid. (This +was in PCCTS's sample C parser.) + +There is one other thing I might suggest to help you avoid a run-time +error. Make sure you redefine the default error reporting function, +zzsyn. To do this, put "#define USER_ZZSYN" in your #header section +and put your own zzsyn somewhere. You can then pop up a MessageBox or +print the error to some output window. + diff --git a/NOTES.OS2 b/NOTES.OS2 new file mode 100755 index 0000000..df81b42 --- /dev/null +++ b/NOTES.OS2 @@ -0,0 +1,296 @@ +14 April 94 +Version 1.20 of pccts + +At the moment this help file is available via anonymous FTP at + + Node: marvin.ecn.purdue.edu + File: pub/pccts/1.20/NOTES.OS2 + +Mail corrections or additions to Steve Robenalt +=============================================================================== +Notes on building PCCTS under OS/2 2.X with the C Set compilers. + +The supplied makefiles can be used to build PCCTS under OS/2 with minimal +trouble. First you need to edit the makefiles such that the Unix specific +defaults are commented out, then uncomment the lines which are specific +to OS/2 and C Set/2 compilers as originally set up by Ed Harfmann. Note +also that you need to use the target list which reflects the appropriate +naming conventions. Some of the lines now need to be changed to reflect +differences in conventions between the operating systems: 1) change forward +slashes in directories to backslashes, 2) change command line parameters +from -option to /option (note that this applies to C Set, not ANTLR and DLG +options), and 3) change rm to del for clean and scrub targets. + +To build ANTLR for the first time: + +note: I tried various combinations of "touch"ing files to try to prevent nmake + from using ANTLR to rebuild itself, and was unsuccessful. + +In the section labelled "Target list of PC machines", comment out the +scan.c and antlr.c dependencies. This prevents nmake from trying to invoke +ANTLR to build itself. After you have built ANTLR successfully for the first +time, you can uncomment these lines and it will build itself normally. (If you +had a working 1.10 installation before, you can also use the older binaries +when building the new ones.) + +An example of the resulting makefile, with all the extra baggage for Unix, DOS, +and OS/2 1.X is shown here: + +----- cut here ----- + +# +# Makefile for ANTLR 1.20 +# +# SOFTWARE RIGHTS +# +# We reserve no LEGAL rights to the Purdue Compiler Construction Tool +# Set (PCCTS) -- PCCTS is in the public domain. An individual or +# company may do whatever they wish with source code distributed with +# PCCTS or the code generated by PCCTS, including the incorporation of +# PCCTS, or its output, into commerical software. +# +# We encourage users to develop software with PCCTS. However, we do ask +# that credit is given to us for developing PCCTS. By "credit", +# we mean that if you incorporate our source code into one of your +# programs (commercial product, research project, or otherwise) that you +# acknowledge this fact somewhere in the documentation, research report, +# etc... If you like PCCTS and have developed a nice tool with the +# output, please mention that you developed it using PCCTS. In +# addition, we ask that this header remain intact in our source code. +# As long as these guidelines are kept, we expect to continue enhancing +# this system and expect to make other tools available as they are +# completed. +# +# ANTLR 1.20 +# Terence Parr +# Purdue University +# With AHPCRC, University of Minnesota +# 1989-1994 +# +# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by +# Ed Harfmann +# Micro Data Base Systems +# Lafayette, Indiana +# - With updates by Steve Robenalt 4/94 +# +SET=..\support\set +PCCTS_H=..\h + +# +# C-Set/2 for OS/2 +# +CC=icc +CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN +OUT_OBJ = /Fo +LIBS= +ANTLR=..\bin\antlr +DLG=..\bin\dlg +OBJ_EXT = obj + +antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \ + fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \ + misc.obj set.obj pred.obj dialog.obj + link386 @<< +$** /NOI +$@ /STACK:32768 + +$(LIBS: = +^ +) +$(DEF_FILE) $(LFLAGS) ; +<< + copy *.exe ..\bin + +# +# *********** Target list of PC machines *********** +# +# Don't worry about the ambiguity messages coming from antlr +# for making antlr.c etc... [should be 10 of them, I think] +# +#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g +# $(ANTLR) antlr.g + +antlr.$(OBJ_EXT): antlr.c mode.h tokens.h + +scan.$(OBJ_EXT): scan.c mode.h tokens.h + +#scan.c mode.h: parser.dlg +# $(DLG) -C2 parser.dlg scan.c + +set.$(OBJ_EXT): $(SET)\set.c + $(CC) $(CFLAGS) /C $(OUT_OBJ)set.$(OBJ_EXT) $(SET)\set.c + +# +# what files does PCCTS generate (both ANTLR and DLG) +# + +PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h + +SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \ + hash.c lex.c main.c misc.c $(SET)\set.c pred.c dialog.c + +# +# ****** These next targets are common to UNIX and PC world ******** +# + +#clean up all the intermediate files +clean: + del *.$(OBJ_EXT) + +#remove everything in clean plus the PCCTS files generated +scrub: + del $(PCCTS_GEN) *.$(OBJ_EXT) + +----- cut here ----- + +To build DLG for the first time: + +Follow the same steps as were used to build ANTLR, changing the slashes and +commands, targets, and extensions for OS/2. Comment out the dependencies for +dlg_p.c and dlg_a.c to prevent nmake from trying to invoke ANTLR and DLG to +build DLG (unless you have 1.10 binaries). + +An example of the resulting makefile, with all the extra baggage for Unix, DOS, +and OS/2 1.X is shown here: + +----- cut here ----- + +# +# Makefile for DLG 1.20 +# Terence Parr +# Purdue University +# 1989-1993 +# +# Ported to IBM C-Set/2 and Microsoft 6.0 by +# Ed Harfmann +# Micro Data Base Systems +# Lafayette, Indiana +# - With updates by Steve Robenalt 4/94 +# +SET=..\support\set +PCCTS_H=..\h + +# +# C-Set/2 for OS/2 +# +CC=icc +CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 +OUT_OBJ = /Fo +LIBS= +ANTLR=..\bin\antlr +DLG=..\bin\dlg +OBJ_EXT=obj + +dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \ + output.obj relabel.obj automata.obj + link386 @<< +$** /NOI +$@ /STACK:32768 + +$(LIBS: = +^ +) +$(DEF_FILE) $(LFLAGS) ; +<< + copy *.exe ..\bin + +SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c \ + relabel.c automata.c + +#dlg_p.c parser.dlg err.c tokens.h : dlg_p.g +# $(ANTLR) dlg_p.g + +#dlg_a.c mode.h : parser.dlg +# $(DLG) -C2 parser.dlg dlg_a.c + +dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h + $(CC) $(CFLAGS) /c dlg_p.c + +dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h + $(CC) $(CFLAGS) /c dlg_a.c + +main.$(OBJ_EXT) : main.c dlg.h + $(CC) $(CFLAGS) /c main.c + +set.$(OBJ_EXT) : $(SET)\set.c + $(CC) /c $(CFLAGS) $(SET)\set.c + +lint: + lint *.c + +#clean up all the intermediate files +clean: + del *.$(OBJ_EXT) + +----- cut here ----- + +Once you have built ANTLR and DLG successfully, you will also want to build +the genmk utility, located at ~\pccts\support\genmk. The makefile in this +directory is relatively simple to modify, so I won't repeat it here. + +At this point, you can test the executables by building one of the sample +programs, such as the Pascal or C example under ~pccts\lang. The prototype +makefile which is in these directories will work fine as a base, with OS/2 +specific modifications as noted above. Note that the /Sa flag defines the +ANSI C mode of the compiler which is not the default. The default mode +does not define __STDC__ and will lead to lots of errors. + +A sample pascal makefile is shown below: + +----- cut here ----- + +GRM =pascal.g +LEX_FILE =pscan.dlg +GSRC=pascal.c err.c pscan.c ttree.c adebug.c +GOBJ=pascal.obj err.obj pscan.obj ttree.obj adebug.obj + +PCCTS_GEN= pascal.c err.c $(LEX_FILE) pscan.c mode.h tokens.h + +SRC =$(GSRC) pmain.c sym.c +OBJ =$(GOBJ) pmain.obj sym.obj +INCL = ..\..\h +SYM = ..\..\support\sym +ANTLR = ..\..\bin\antlr +DLG = ..\..\bin\dlg + +CFLAGS=/I. /I$(INCL) /Sa +AFLAGS= -fl $(LEX_FILE) -gh + +pascal.exe : $(OBJ) + $(CC) $(CFLAGS) /Fopascal.exe $(OBJ) + +pascal.c $(LEX_FILE) : $(GRM) + $(ANTLR) $(AFLAGS) $(GRM) + +mode.h pscan.c : $(LEX_FILE) + $(DLG) -C2 $(LEX_FILE) pscan.c + +pmain.obj : pmain.c pascal.h + +pascal.obj : pascal.c mode.h tokens.h + +sym.obj : $(SYM)\sym.c + icc /c /Fo sym.obj $(CFLAGS) $(SYM)\sym.c + +err.obj : err.c + +clean: + del $(PCCTS_GEN) *.obj + + +----- cut here ----- + +The C example can be built in much the same way. + +If you have problems compiling anything, I would appreciate hearing about +it. I was able to get everything built and working without changing any +of the supplied or generated C code, so if you find that you need to make +changes to any code, I've probably written something up incorrectly. + +Please post comments to the mailing list for PCCTS at: + + pccts-users@ahpcrc.umn.edu + +since I am most likely to see them there. + +- Steve Robenalt + + diff --git a/NOTES.watcom b/NOTES.watcom new file mode 100755 index 0000000..1120dca --- /dev/null +++ b/NOTES.watcom @@ -0,0 +1,114 @@ +From Tom Zougas, zougas@civ.utoronto.ca + +These are the changes I had to make to get ANTLR to compile under Watcom C +10.0 32-bit mode. I'm including the makefiles for antlr and dlg: + +[Warning from T. Parr: I think that I may have expanded the tabs by + mistake in this file. You might have to convert them back to + tabs to have this file work correctly.] + +antlr.mak: +----------------------------------------------------------------------- + +SET=..\support\set +PCCTS_H=..\h + +# +# Watcom +# +CC=wcl386 +ANTLR=..\bin\antlr +DLG=..\bin\dlg +CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DPC +OUT_OBJ = -o +OBJ_EXT = obj +LINK = wcl386 + +.c.obj : + $(CC) -c $[* $(CFLAGS) + +antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj & + fset.obj gen.obj globals.obj hash.obj lex.obj main.obj & + misc.obj set.obj pred.obj + $(LINK) -fe=antlr.exe *.obj -k14336 + copy *.exe ..\bin + +# *********** Target list of PC machines *********** +# +# Don't worry about the ambiguity messages coming from antlr +# for making antlr.c etc... [should be 10 of them, I think] +# +antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g + $(ANTLR) antlr.g + +antlr.$(OBJ_EXT): antlr.c mode.h tokens.h + +scan.$(OBJ_EXT): scan.c mode.h tokens.h + +scan.c mode.h: parser.dlg + $(DLG) -C2 parser.dlg scan.c + +set.$(OBJ_EXT): $(SET)\set.c + $(CC) $(CFLAGS) -c set.$(OBJ_EXT) $(SET)\set.c + +# +# ****** These next targets are common to UNIX and PC world ******** +# + +#clean up all the intermediate files +clean: + del *.obj + +#remove everything in clean plus the PCCTS files generated +scrub: + del $(PCCTS_GEN) + del *.$(OBJ_EXT) +--------------------------------------------------------------------- +dlg.mak: +--------------------------------------------------------------------- +SET=..\support\set +PCCTS_H=..\h + +# +# Watcom +# +CC=wcl386 +ANTLR=..\bin\antlr +DLG=..\bin\dlg +CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DPC +LIBS= +OBJ_EXT = obj +LINK = wcl386 + +.c.obj : + $(CC) -c $[* $(CFLAGS) + +dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj & + output.obj relabel.obj automata.obj + $(LINK) -fe=dlg.exe *.obj -k14336 + copy *.exe ..\bin + +SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c & + relabel.c automata.c + +dlg_p.c parser.dlg err.c tokens.h : dlg_p.g + $(ANTLR) dlg_p.g + +dlg_a.c mode.h : parser.dlg + $(DLG) -C2 parser.dlg dlg_a.c + +dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h + $(CC) $(CFLAGS) -c dlg_p.c + +dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h + $(CC) $(CFLAGS) -c dlg_a.c + +main.$(OBJ_EXT) : main.c dlg.h + $(CC) $(CFLAGS) -c main.c + +set.$(OBJ_EXT) : $(SET)\set.c + $(CC) -c $(CFLAGS) $(SET)\set.c + +#clean up all the intermediate files +clean: + del *.$(OBJ_EXT) diff --git a/README b/README new file mode 100755 index 0000000..45b8bda --- /dev/null +++ b/README @@ -0,0 +1,209 @@ + + Welcome to PCCTS 1.33 + + October 5, 1995 + + + Parr Research Corporation + with + Purdue University Electrical Engineering + and + University of Minnesota, AHPCRC + + Terence Parr + Russell Quong + Will Cohen + Hank Dietz + +[The "NOTES for new users" by Tom Moog is available now via web + browser at http:www.mcs.net/~tmoog and via anonymous ftp at + ftp.mcs.net/mcsnet.users/tmoog.] + +[We've removed PCCTS.FUTURE from the distribution and added file SERVICES, + which describes the services of Parr Research Corporation.] + + + INSTALLATION + + This document describes the installation of PCCTS 1.33 on UNIX +and non-UNIX machines. The UNIX installation is trivial while the +non-UNIX folks have a bit more work to do as an install script +explicitly for there machine will not exist--they will have to +interpret the install script. + + PCCTS 1.33 includes a number of different programs and examples +in the software release package -- most of which like to live in their +own directories. The install script will build a standard hierarchy. +Or, if you get the tar file off the ftp site, the hierarchy will be +constructed automatically by tar. + + The PCCTS executables (antlr, dlg) may be placed anywhere the user +wishes but the install script places them in the bin directory created +during installation. + +1.0. UNIX USERS + +This section is for UNIX users and describes the most convenient +installation procedure. + +1.1. FORMAT: pccts.tar + +To begin installation, place the pccts.tar file into the directory +where you want to place a pccts subdirectory. Untar the file with + + tar xvf pccts.tar + +and cd into it. To install PCCTS, simply type + + make + +which will build the standard PCCTS directory hierarchy (under the +directory where you ran the install script) and build executable +versions of antlr and dlg. + +1.2. FORMAT: pccts.bag + + To begin installation, the user should create a directory (usually +called pccts) where the PCCTS source subtree is to be created. Place +the pccts.bag file and the install script into this directory and cd +into it. To install PCCTS, simply type + + sh install + +which will build the standard PCCTS directory hierarchy (under the +directory where you ran the install script), "unbag" all of the files +and build executable versions of antlr and dlg. + +If you do not have the 'sh' shell, you'll need the install.unbag.reqd +file. + +NOTE: If you are using the later SGI C++ compilers, use -woff 3262 to +get rid of a bunch of noise by the compiler (warnings). + + +2.0. NON-UNIX USERS + + ANTLR was written using portable (we hope), vanilla K&R-style C, +ANSI C, and C++. It has been successfully ported to a variety of +environments. We do not provide an installation script explicitly for +non-Unix users. You must interpret the install script and perform the +analogous operations on your machine. There is an install script, +install.mpw, for Macintosh programmers. + +IMPORTANT NOTE: For PC users: You must create the parser.dlg and + "touch" scan.c in antlr and dlg directories or the + makefiles will try to execute antlr and dlg, which + don't exist yet. The first time, you want only to + compile the C files in order to obtain an executable + for antlr and dlg. From this point, a change in + antlr.g or dlg_p.g will force antlr/dlg to regenerate + themselves. + + You must define symbol PC if you want things to work + out right for use on a DOS, OS/2, Windows machine. + This affects the config.h file, which you can change + as you wish. + + For Mac programmers using MPW (Macintosh Programmer's Workshop), +define symbol MPW to get the correct config.h stuff included. + +3.0. EMAIL VERSION RECIPIENTS + + If you received PCCTS via email response from +pccts@ecn.purdue.edu you have one additional installation step to +perform over the ftp folks (and pccts.tar is unavailable). You will +have received a number of bite-size chunks of pccts which are small +enough to be emailed (~1500 lines each). You must reconstruct the +PCCTS files before you can begin installation. In order to rebuild an +original file, you must have "one.c" which will take the chunks and +pack them together. If you are a non-UNIX type, you must have the +"unbag.c" file which unbags the bags created by our mail archiver. +UNIX folks use the shell to unbag as they would for shar files (this +will be done automatically by the install script). + + To install PCCTS, place all PCCTS mail messages into a pccts +directory, remove the mail headers from one.c. Then compile one.c +with: + + cc -o one one.c + +and then type: + + ./one f1 f2 ... fn + +where f1..fn are the parts of PCCTS source sent as chunks (i.e. these +files will be all the files you received NOT including one.c, unbag.c, +README, install and the request acknowledge banner). There is no need +to remove mail headers from the chunk files and they may appear in any +order. The subject line of the mail will identify it as a chunk and a +chunk of what file. The "one" program should be used to put pccts.bag +back together. You are now in a position to begin normal PCCTS +installation. All files you receive should go into a pccts directory. + + Note that all files which arrive in "chunks" must be put back +together using "one". Beware that you do not mix chunks from more +than one original file. For instance, do not specify all chunks that +you collect from the PCCTS mailbot on the "one" command line unless +you have requested only one original file that was split into multiple +files. Each chunk knows which original file it is a part of, where it +goes in that file and how many total chunks are required to rebuild +that original. + +4.0. WORD SIZE AND PC USERS + + The config.h file now sets up the word size for your compiler +automatically. + + + TUTORIAL + + The advanced tutorial should be placed in a directory at the +same level as antlr, dlg, support etc... Do a + + sh advtut.bag + +to unbag (or use the unbag program) and then type + + make -s all + +which will create executables called tut1-tut4. Naturally, if you got +the tutorials from the ftp site, the tar format of the tutorials can +be obtained for easier installation. + +Unfortunately, the tutorials have changed little since the 1.06 +release. With luck, these will be enhanced and an AST tutorial will +appear. + + MACHINE COMPATIBILITY + +PCCTS is known to compile "out of the box" on the following machines +and/or operating systems: [didn't have time to retest on all these +machines, but seems to be highly portable still]. + +o DECSTATION 5000 + +o SGI; use "-woff 3262" in your CFLAGS make variable + +o Sun SparcStation (cc, gcc, g++, Cfront, acc) + +o VAX C under VMS + +o Linux SLS 0.99, gcc/g++ + +o 386 PC, NetBSD 0.9, gcc 2.4.5 + +o HP 9000/755, HP-UX 9.01, HP cc + +o 486 PC, OS/2 2.1 (w/long filenames), IBM C Set++ 2.1 + +o NeXTStep 3.2 running g++/gcc 2.6.3 (pentium-90) + + + INCOMPATIBILITIES + +Please see the release notes. + + + CREDITS + +Please see the history.ps or history.txt. diff --git a/SERVICES b/SERVICES new file mode 100755 index 0000000..63511ab --- /dev/null +++ b/SERVICES @@ -0,0 +1,86 @@ +October 2, 1995 + + Services Provided + + By + + Parr Research Corporation + parrt@parr-research.com + http://www.parr-research.com/~parrt/prc + + ``Thorough Research, Business Integrity, and really cool software tools'' + +Programming language and data translation can be difficult and +frustrating tasks. Parr Research Corporation, the primary developer +and distributor of the public domain language toolkit PCCTS (ANTLR, +DLG, SORCERER), has extensive experience and expertise that can be +applied to your projects to successfully: + +o Reduce translator design and development time + + We help you avoid unnecessary delays in your overall project + due to difficult translation tasks. + +o Reduce development cost + + Odds are that we have seen something similar to your project + and can produce an excellent and quick solution. + +o Reduce risk + + We resolve crucial technical questions or development problems + that hamper your efforts on time-critical projects. + +Parr Research accomplishes these goals by providing the following +services: + +o Design consultations (fixed price or per hour) + + Parr Research designs ``front-end''s and translators. + +o Development (fixed price or per hour) + +o Retainers / Maintenance / Support agreements + + PCCTS and translator-implementation questions answered + Special modifications to PCCTS + Bug fixes + Maintenance agreements are insurance policies against + unforeseen development problems + +o Installation support + +o Tutorials + + ANTLR/DLG + SORCERER, intermediate-representations + Translation techniques + On-site or off-site tutorials + +Parr Research Corporation has a proven record of superior service with +research labs and corporations such as the Army Research Lab, Tandem, +NeXT, Berkeley Systems, Computing Devices International, and Pencom. +In addition, we have informal relationships with Apple, Sun Labs, +Intel, and Motorola as well as numerous academic institutions. + +To discuss how Parr Research can save your project time and money +please contact: + +Terence Parr, Ph.D. +Parr Research Corporation +1535 Francisco Street Suite 9 +San Francisco, California 94123 +(415) 346 1070 +parrt@parr-research.com + + +For a summary of the ANTLR parser generator as published in the July +issue of Software Practice and Experience see: + + ftp://ftp.parr-research.com/pub/pccts/papers/antlr.ps + +A pre-release version of the upcoming book by Terence Parr entitled +``Language Translation Using PCCTS and C++ (A Reference Guide)'' is +available at + + ftp://ftp.parr-research.com/pub/pccts/Book/reference.ps diff --git a/unbag.c b/unbag.c new file mode 100755 index 0000000..cfaf208 --- /dev/null +++ b/unbag.c @@ -0,0 +1,93 @@ +/* + * unbag + * + * This program "unbags" files "bagged" by bag. Can be used for non-UNIX + * folks that need to unbag stuff. + */ +#include + +static int line=0; + +main(argc, argv) +int argc; +char **argv; +{ + FILE *f; + + if ( argc <= 1 ) + { + fprintf(stderr, "unbag: missing bagfile name\n"); + exit(-1); + } + f = fopen(argv[1], "r"); + if ( f == NULL ) + { + fprintf(stderr, "unbag: cannot open %s\n", argv[1]); + exit(-1); + } + + unbag( f ); + + fclose( f ); +} + +unbag(f) +FILE *f; +{ + FILE *output; + static char text[2048]; + char *nm, *p; + + while ( fgets(text, 2048, f) != NULL ) + { + line++; + if ( strncmp(text, "cat << \\EOF_", strlen("cat << \\EOF_"))!= 0 ) + { + fprintf(stderr, "unbag: line %d: bad file format (missing BEGIN)\n", line); + fprintf(stderr, "unbag: text was '%s'\n", text); + exit(-1); + } + nm = &text[strlen("cat << \\EOF_")]; + for (p=nm; *p!=' '; p++) {;} /* find end of filename */ + *p = '\0'; + output = fopen(nm, "w"); + if ( output == NULL ) + { + fprintf(stderr, "unbag: cannot open ouput file %s\n", nm); + exit(-1); + } + extract(f, output, nm); + fclose(output); + } +} + +/* Cat a f to f2 (lines <= 2047 characters) stopping after reading 'stop' */ +extract(f, f2, stop) +FILE *f, *f2; +char *stop; +{ + static char text[2048]; + char *p; + + while ( fgets(text, 2048, f)!=NULL ) + { + line++; + text[strlen(text)-1] = '\0'; /* rm \n */ + if ( strncmp(text, "EOF_", strlen("EOF_")) == 0 ) + if ( strcmp(&text[strlen("EOF_")], stop) == 0 ) return; + if ( text[0] != '>' ) + { + fprintf(stderr,"unbag: line %d: bad file format: %s\n", line, stop); + exit(-1); + } + fprintf(f2, "%s\n", &text[1]); +/* + for (p=&text[1]; *p!='\0'; p++) + { + if ( *p=='\\' ) p++; + putc(*p, f2); + } + putc('\n', f2); +*/ + } +}