diff options
Diffstat (limited to 'Tools/CCode/Source/Pccts/dlg')
23 files changed, 0 insertions, 7032 deletions
diff --git a/Tools/CCode/Source/Pccts/dlg/DlgMS.mak b/Tools/CCode/Source/Pccts/dlg/DlgMS.mak deleted file mode 100644 index 086af956c8..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/DlgMS.mak +++ /dev/null @@ -1,121 +0,0 @@ -# PCCTS directory
-
-# You will need to set the LIB variable similar to this.
-# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
-
-# PCCTS_HOME=<your PCCTS_HOME>
-PCCTS_HOME=$(WORKSPACE)\Tools\CCode\Source\Pccts
-DLG_SRC=$(PCCTS_HOME)\dlg
-PCCTS_H=$(PCCTS_HOME)\h
-
-
-# Support directories
-SET=$(PCCTS_HOME)\support\set
-
-
-# Compiler stuff
-CC = cl
-CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
- -D "ZZLEXBUFSIZE=65536" /D "LONGFILENAMES" /W3 /Zi
-
-DLG_OBJS = dlg_p.obj dlg_a.obj main.obj err.obj support.obj \
- output.obj relabel.obj automata.obj
-
-SUPPORT_OBJS = set.obj
-
-# Dependencies
-
-dlg.exe: $(DLG_OBJS) $(SUPPORT_OBJS)
- $(CC) $(CFLAGS) -o dlg.exe $(DLG_OBJS) $(SUPPORT_OBJS)
- del *.obj
- del *.ilk
- del *.pdb
- move dlg.exe $(WORKSPACE)\Tools\bin\.
-
-dlg_p.obj: $(DLG_SRC)\dlg_p.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
- $(DLG_SRC)\mode.h \
- $(DLG_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_p.c
-
-dlg_a.obj: $(DLG_SRC)\dlg_a.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgauto.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
- $(DLG_SRC)\mode.h \
- $(DLG_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_a.c
-
-main.obj: $(DLG_SRC)\main.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
- $(DLG_SRC)\mode.h \
- $(DLG_SRC)\stdpccts.h \
- $(DLG_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\main.c
-
-err.obj: $(DLG_SRC)\err.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(PCCTS_H)\err.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
- $(DLG_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\err.c
-
-support.obj: $(DLG_SRC)\support.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\support.c
-
-output.obj: $(DLG_SRC)\output.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\output.c
-
-relabel.obj: $(DLG_SRC)\relabel.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\relabel.c
-
-automata.obj: $(DLG_SRC)\automata.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(DLG_SRC)\dlg.h \
-
- $(CC) -c $(CFLAGS) $(DLG_SRC)\automata.c
-
-
-set.obj: $(SET)\set.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
-
- $(CC) -c $(CFLAGS) $(SET)\set.c
-
-clean:
- del *.obj
-
-distclean:
- del *.obj
- del $(WORKSPACE)\Tools\bin\dlg.exe
diff --git a/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak b/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak deleted file mode 100644 index 55b643ad88..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak +++ /dev/null @@ -1,84 +0,0 @@ -# File: dlgPPC.make
-# Target: dlgPPC
-# Sources: automata.c
-# dlg_a.c
-# dlg_p.c
-# err.c
-# main.c
-# output.c
-# relabel.c
-# support.c
-# ::support:set:set.c
-# Created: Sunday, May 17, 1998 11:34:20 PM
-# Author: Kenji Tanaka
-
-
-MAKEFILE = dlgPPC.make
-„MondoBuild„ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
-Includes = ¶
- -i "::h:" ¶
- -i "::support:set:"
-Sym„PPC =
-ObjDir„PPC = ":Obj:"
-
-PPCCOptions = {Includes} {Sym„PPC} -w off -d MPW -d __STDC__=1 -d USER_ZZSYN
-
-Objects„PPC = ¶
- "{ObjDir„PPC}automata.c.x" ¶
- "{ObjDir„PPC}dlg_a.c.x" ¶
- "{ObjDir„PPC}dlg_p.c.x" ¶
- "{ObjDir„PPC}err.c.x" ¶
- "{ObjDir„PPC}main.c.x" ¶
- "{ObjDir„PPC}output.c.x" ¶
- "{ObjDir„PPC}relabel.c.x" ¶
- "{ObjDir„PPC}support.c.x" ¶
- "{ObjDir„PPC}set.c.x"
-
-
-dlgPPC ÄÄ {„MondoBuild„} {Objects„PPC}
- PPCLink ¶
- -o {Targ} {Sym„PPC} ¶
- {Objects„PPC} ¶
- -t 'MPST' ¶
- -c 'MPS ' ¶
- "{SharedLibraries}InterfaceLib" ¶
- "{SharedLibraries}StdCLib" ¶
- "{SharedLibraries}MathLib" ¶
- "{PPCLibraries}StdCRuntime.o" ¶
- "{PPCLibraries}PPCCRuntime.o" ¶
- "{PPCLibraries}PPCToolLibs.o"
-
-
-"{ObjDir„PPC}automata.c.x" Ä {„MondoBuild„} automata.c
- {PPCC} automata.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}dlg_a.c.x" Ä {„MondoBuild„} dlg_a.c
- {PPCC} dlg_a.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}dlg_p.c.x" Ä {„MondoBuild„} dlg_p.c
- {PPCC} dlg_p.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}err.c.x" Ä {„MondoBuild„} err.c
- {PPCC} err.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}main.c.x" Ä {„MondoBuild„} main.c
- {PPCC} main.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}output.c.x" Ä {„MondoBuild„} output.c
- {PPCC} output.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}relabel.c.x" Ä {„MondoBuild„} relabel.c
- {PPCC} relabel.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}support.c.x" Ä {„MondoBuild„} support.c
- {PPCC} support.c -o {Targ} {PPCCOptions}
-
-"{ObjDir„PPC}set.c.x" Ä {„MondoBuild„} "::support:set:set.c"
- {PPCC} "::support:set:set.c" -o {Targ} {PPCCOptions}
-
-
-dlgPPC ÄÄ dlg.r
- Rez dlg.r -o dlgPPC -a
-
-Install Ä dlgPPC
- Duplicate -y dlgPPC "{MPW}"Tools:dlg
diff --git a/Tools/CCode/Source/Pccts/dlg/automata.c b/Tools/CCode/Source/Pccts/dlg/automata.c deleted file mode 100644 index d6d5d7809d..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/automata.c +++ /dev/null @@ -1,353 +0,0 @@ -/* Automata conversion functions for DLG
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "pcctscfg.h"
-#include "dlg.h"
-#ifdef MEMCHK
-#include "trax.h"
-#else
-#ifdef __STDC__
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif /* __STDC__ */
-#endif
-
-#define hash_list struct _hash_list_
-hash_list{
- hash_list *next; /* next thing in list */
- dfa_node *node;
- };
-
-int dfa_allocated = 0; /* keeps track of number of dfa nodes */
-dfa_node **dfa_array; /* root of binary tree that stores dfa array */
-dfa_node *dfa_model_node;
-hash_list *dfa_hash[HASH_SIZE]; /* used to quickly find */
- /* desired dfa node */
-
-void
-#ifdef __USE_PROTOS
-make_dfa_model_node(int width)
-#else
-make_dfa_model_node(width)
-int width;
-#endif
-{
- register int i;
- dfa_model_node = (dfa_node*) malloc(sizeof(dfa_node)
- + sizeof(int)*width);
- dfa_model_node->node_no = -1; /* impossible value for real dfa node */
- dfa_model_node->dfa_set = 0;
- dfa_model_node->alternatives = FALSE;
- dfa_model_node->done = FALSE;
- dfa_model_node->nfa_states = empty;
- for(i = 0; i<width; i++){
- dfa_model_node->trans[i] = NIL_INDEX;
- }
-}
-
-
-/* adds a new nfa to the binary tree and returns a pointer to it */
-dfa_node *
-#ifdef __USE_PROTOS
-new_dfa_node(set nfa_states)
-#else
-new_dfa_node(nfa_states)
-set nfa_states;
-#endif
-{
- register int j;
- register dfa_node *t;
- static int dfa_size=0; /* elements dfa_array[] can hold */
-
- ++dfa_allocated;
- if (dfa_size<=dfa_allocated){
- /* need to redo array */
- if (!dfa_array){
- /* need some to do inital allocation */
- dfa_size=dfa_allocated+DFA_MIN;
- dfa_array=(dfa_node **) malloc(sizeof(dfa_node*)*
- dfa_size);
- }else{
- /* need more space */
- dfa_size=2*(dfa_allocated+1);
- dfa_array=(dfa_node **) realloc(dfa_array,
- sizeof(dfa_node*)*dfa_size);
- }
- }
- /* fill out entry in array */
- t = (dfa_node*) malloc(sizeof(nfa_node)+sizeof(int)*class_no);
- *t = *dfa_model_node;
- for (j=0; j<class_no; ++j)
- t->trans[j] = NIL_INDEX;
- t->node_no = dfa_allocated;
- t->nfa_states = set_dup(nfa_states);
- dfa_array[dfa_allocated] = t;
- return t;
-}
-
-
-/* past a pointer to the start start of the nfa graph
- * nfa_to_dfa convers this graph to dfa. The function returns
- * a pointer to the first dfa state.
- * NOTE: The function that prints out the table will have to figure out how
- * to find the other dfa states given the first dfa_state and the number of dfa
- * nodes allocated
- */
-dfa_node **
-#ifdef __USE_PROTOS
-nfa_to_dfa(nfa_node *start)
-#else
-nfa_to_dfa(start)
-nfa_node *start;
-#endif
-{
- register dfa_node *d_state, *trans_d_state;
- register int a;
- set t;
- int last_done;
- unsigned *nfa_list;
- unsigned *reach_list;
-
- reach_list = (unsigned *) malloc((2+nfa_allocated)*sizeof(unsigned));
- if (!start) return NULL;
- t = set_of(NFA_NO(start));
- _set_pdq(t,reach_list);
- closure(&t,reach_list);
- /* Make t a dfa state */
- d_state = dfastate(t);
- last_done = DFA_NO(d_state);
-
- do {
- /* Mark dfa state x as "done" */
- d_state->done = TRUE;
- nfa_list = set_pdq(d_state->nfa_states);
- for (a = 0; a<class_no; ++a) {
- /* Add NFA states reached by a from d_state */
- reach(nfa_list,a,reach_list);
- /* Were any states found? */
- if ((*reach_list)!=nil) {
- /* was t=empty; */
- set_free(t);
- /* yes, compute closure */
- closure(&t,reach_list);
- /* Make DFA state of it ... */
- trans_d_state = dfastate(t);
- /* And make transition x->t, labeled with a */
- d_state->trans[a] = DFA_NO(trans_d_state);
- d_state->alternatives = TRUE;
- }
- }
- free(nfa_list);
- ++last_done; /* move forward in queue */
- /* And so forth until nothing isn't done */
- d_state = DFA(last_done);
- } while (last_done<=dfa_allocated);
-
- free(reach_list);
- set_free(t);
-
- /* returns pointer to the array that holds the automaton */
- return dfa_array;
-}
-
-void
-#ifdef __USE_PROTOS
-clear_hash(void)
-#else
-clear_hash()
-#endif
-{
- register int i;
-
- for(i=0; i<HASH_SIZE; ++i)
- dfa_hash[i] = 0;
-}
-
-#if HASH_STAT
-void
-#ifdef __USE_PROTOS
-fprint_hash_stats(FILE *f)
-#else
-fprint_hash_stats(f)
-FILE *f;
-#endif
-{
- register hash_list *p;
- register int i,j;
- register total;
-
- total=0;
- for(i=0; i<HASH_SIZE; ++i){
- j=0;
- p = dfa_hash[i];
- while(p){
- ++j;
- p = p->next;
- }
- total+=j;
- fprintf(f,"bin[%d] has %d\n",i,j);
- }
- fprintf(f,"total = %d\n",total);
-}
-#endif
-
-/* Returns a pointer to a dfa node that has the same nfa nodes in it.
- * This may or maynot be a newly created node.
- */
-dfa_node *
-#ifdef __USE_PROTOS
-dfastate(set nfa_states)
-#else
-dfastate(nfa_states)
-set nfa_states;
-#endif
-{
- register hash_list *p;
- int bin;
-
- /* hash using set and see if it exists */
- bin = set_hash(nfa_states,HASH_SIZE);
- p = dfa_hash[bin];
- while(p && !set_equ(nfa_states,(p->node)->nfa_states)){
- p = p->next;
- }
- if(!p){
- /* next state to add to hash table */
- p = (hash_list*)malloc(sizeof(hash_list));
- p->node = new_dfa_node(nfa_states);
- p->next = dfa_hash[bin];
- dfa_hash[bin] = p;
- }
- return (p->node);
-}
-
-
-/* this reach assumes the closure has been done already on set */
-int
-#ifdef __USE_PROTOS
-reach(unsigned *nfa_list, register int a, unsigned *reach_list)
-#else
-reach(nfa_list, a, reach_list)
-unsigned *nfa_list;
-register int a;
-unsigned *reach_list;
-#endif
-{
- register unsigned *e;
- register nfa_node *node;
- int t=0;
-
- e = nfa_list;
- if (e){
- while (*e != nil){
- node = NFA(*e);
- if (set_el(a,node->label)){
- t=1;
- *reach_list=NFA_NO(node->trans[0]);
- ++reach_list;
- }
- ++e;
- }
- }
- *reach_list=nil;
- return t;
-}
-
-/* finds all the nodes that can be reached by epsilon transitions
- from the set of a nodes and returns puts them back in set b */
-set
-#ifdef __USE_PROTOS
-closure(set *b, unsigned *reach_list)
-#else
-closure(b, reach_list)
-set *b;
-unsigned *reach_list;
-#endif
-{
- register nfa_node *node,*n; /* current node being examined */
- register unsigned *e;
-
- ++operation_no;
-#if 0
- t = e = set_pdq(*b);
-#else
- e=reach_list;
-#endif
- while (*e != nil){
- node = NFA(*e);
- set_orel(NFA_NO(node),b);
- /* mark it done */
- node->nfa_set = operation_no;
- if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) &&
- (n->nfa_set != operation_no)){
- /* put in b */
- set_orel(NFA_NO(n),b);
- close1(n,operation_no,b);
- }
- if ((n=node->trans[1]) != NIL_INDEX &&
- (n->nfa_set != operation_no)){
- /* put in b */
- set_orel(NFA_NO(node->trans[1]),b);
- close1(n,operation_no,b);
- }
- ++e;
- }
-#if 0
- free(t);
-#endif
- return *b;
-}
-
-#ifdef __USE_PROTOS
-void close1(nfa_node *node, int o, set *b)
-#else
-void close1(node,o,b)
-nfa_node *node;
-int o; /* marker to avoid cycles */
-set *b;
-#endif
-{
- register nfa_node *n; /* current node being examined */
-
- /* mark it done */
- node->nfa_set = o;
- if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) &&
- (n->nfa_set != o)){
- /* put in b */
- set_orel(NFA_NO(n),b);
- close1(n,o,b);
- }
- if ((n=node->trans[1]) != NIL_INDEX &&
- (n->nfa_set != o)){
- /* put in b */
- set_orel(NFA_NO(node->trans[1]),b);
- close1(n,o,b);
- }
-}
diff --git a/Tools/CCode/Source/Pccts/dlg/build.xml b/Tools/CCode/Source/Pccts/dlg/build.xml deleted file mode 100644 index da5dbd0f59..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/build.xml +++ /dev/null @@ -1,127 +0,0 @@ -<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK Pccts Tool: dlg
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="dlg"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="PACKAGE_DIR" value="${WORKSPACE}/Tools"/>
-
- <target name="init">
- <condition property="CheckDepends">
- <uptodate targetfile="${WORKSPACE}/Tools/bin/dlg.exe">
- <srcfiles dir="." includes="*.c *.h *.g"/>
- </uptodate>
- </condition>
- <if>
- <equals arg1="${CheckDepends}" arg2="true"/>
- <then>
- <echo message="Executable, dlg.exe, is up to date."/>
- </then>
- <else>
- <echo message="Building the EDK Pccts Tool: ${ToolName}"/>
- </else>
- </if>
- </target>
-
- <target name="GenTool" depends="init" unless="CheckDepends">
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="TRUE">
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile BIN_DIR=${BIN_DIR}"/>
- </exec>
- </then>
- </elseif>
- </if>
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="TRUE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin clean"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="FALSE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="FALSE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg.1 b/Tools/CCode/Source/Pccts/dlg/dlg.1 deleted file mode 100644 index f68e3ae8a7..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg.1 +++ /dev/null @@ -1,79 +0,0 @@ -.TH dlg 1 "April 1994" "DLG" "PCCTS Manual Pages"
-.SH NAME
-dlg \- DFA Lexical Analyzer Generator
-.SH SYNTAX
-.LP
-\fBdlg\fR [\fIoptions\fR] \fIlexical_spec\fR [\fIoutput_file\fR]
-.SH DESCRIPTION
-.B dlg
-is a tool that produces fast deterministic finite automata for recognizing
-regular expressions in input.
-.SH OPTIONS
-.IP "\fB-CC\fR"
-Generate C++ output. The \fIoutput_file\fP is not specified in this
-case.
-.IP "\fB-C\fR[\fP level\fR]
-Where \fPlevel\fR is the compression level used. 0 indications no
-compression, 1 removes all unused characters from the transition from table,
-and 2 maps equivalent characters into the same character classes. It is
-suggested that level -C2 is used, since it will significantly reduce the size
-of the dfa produced for lexical analyzer.
-.IP "\fB-m\fP
-Produces the header file for the lexical mode with a name other than
-the default name of "mode.h".
-.IP \fB-i\fP
-An interactive, or as interactive as possible, parser is produced. A character
-is only obtained when required to decide which state to go to. Some care
-must be taken to obtain accept states that do not require look ahead at the
-next character to determine if that is the stop state. Any regular expression
-with a Kleene closure at the end is guaranteed to require another character
-of look ahead.
-.IP "\fB-cl\fP class
-Specify a class name for DLG to generate. The default is DLGLexer.
-'class' will be a subclass of DLGLexerBase; only used for -CC.
-.IP \fB-ci\fP
-The automaton will treat upper and lower case characters identically.
-This is accomplished in the automaton; the characters in the lexical
-buffer are unmodified.
-.IP \fB-cs\fP
-Upper and lower case characters are treated as distinct. This is the
-default.
-.IP "\fB-o\fP dir
-Directory where output files should go (default="."). This is very
-nice for keeping the source directory clear of ANTLR and DLG spawn.
-.IP \fB-Wambiguity\fP
-Warns if more than one regular expression could match the same character
-sequence. The warnings give the numbers of the expressions in the dlg
-lexical specification file. The numbering of the expressions starts at one.
-Multiple warnings may be print for the same expressions.
-.IP \-
-Used in place of file names to get input from standard in or send output
-to standard out.
-.SH "SPECIAL CONSIDERATIONS"
-.PP
-\fIDlg\fP works... we think. There is no implicit guarantee of
-anything. We reserve no \fBlegal\fP rights to the software known as
-the Purdue Compiler Construction Tool Set (PCCTS) \(em 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
-commercial 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. As long as these guidelines are followed, we
-expect to continue enhancing this system and expect to make other
-tools available as they are completed.
-.SH FILES
-.B mode.h
-,
-.B dlgauto.h
-,
-.B dlgdef.h
-.SH SEE ALSO
-.BR antlr (1),
-.BR pccts (1)
-.SH BUGS
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg.h b/Tools/CCode/Source/Pccts/dlg/dlg.h deleted file mode 100644 index 9f387c0a1c..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg.h +++ /dev/null @@ -1,250 +0,0 @@ -/* dlg header file
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-/* MR1 Move pcctscfg.h to top of file */
-
-#include "pcctscfg.h"
-
-/* turn off warnings for unreferenced labels */
-
-#ifdef _MSC_VER
-#pragma warning(disable:4102)
-#endif
-
-#include "set.h"
-
-#define TRUE 1
-#define FALSE 0
-
-/***** output related stuff *******************/
-#define IN input_stream
-#define OUT output_stream
-
-#define MAX_MODES 50 /* number of %%names allowed */
-#define MAX_ON_LINE 10
-
-#define NFA_MIN 64 /* minimum nfa_array size */
-#define DFA_MIN 64 /* minimum dfa_array size */
-
-#define DEFAULT_CLASSNAME "DLGLexer"
-
-/* these macros allow the size of the character set to be easily changed */
-/* NOTE: do NOT change MIN_CHAR since EOF is the lowest char, -1 */
-#define MIN_CHAR (-1) /* lowest possible character possible on input */
-#define MAX_CHAR 255 /* highest possible character possible on input */
-#define CHAR_RANGE (1+(MAX_CHAR) - (MIN_CHAR))
-
-/* indicates that the not an "array" reference */
-#define NIL_INDEX 0
-
-/* size of hash table used to find dfa_states quickly */
-#define HASH_SIZE 211
-
-#define nfa_node struct _nfa_node
-nfa_node {
- int node_no;
- int nfa_set;
- int accept; /* what case to use */
- nfa_node *trans[2];
- set label; /* one arc always labelled with epsilon */
-};
-
-#define dfa_node struct _dfa_node
-dfa_node {
- int node_no;
- int dfa_set;
- int alternatives; /* used for interactive mode */
- /* are more characters needed */
- int done;
- set nfa_states;
- int trans[1];/* size of transition table depends on
- * number of classes required for automata.
- */
-
-
-};
-
-/******** macros for accessing the NFA and DFA nodes ****/
-#define NFA(x) (nfa_array[x])
-#define DFA(x) (dfa_array[x])
-#define DFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX)
-#define NFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX)
-
-/******** wrapper for memory checking ***/
-/*#define malloc(x) dlg_malloc((x),__FILE__,__LINE__)*/
-
-/*#define calloc(x,y) dlg_calloc((x),(y),__FILE__,__LINE__)*/
-
-/******** antlr attributes *************/
-typedef struct {
- unsigned char letter;
- nfa_node *l,*r;
- set label;
- } Attrib;
-
-#define zzcr_attr(attr, token, text) { \
- (attr)->letter = text[0]; (attr)->l = NULL; \
- (attr)->r = NULL; (attr)->label = empty; \
-}
-#define zzd_attr(a) set_free((a)->label);
-
-/******************** Variable ******************************/
-extern char program[]; /* tells what program this is */
-extern char version[]; /* tells what version this is */
-extern char *file_str[]; /* file names being used */
-extern int err_found; /* flag to indicate error occured */
-extern int action_no; /* last action function printed */
-extern int func_action; /* should actions be turned into functions?*/
-extern set used_chars; /* used to label trans. arcs */
-extern set used_classes; /* classes or chars used to label trans. arcs */
-extern int class_no; /* number of classes used */
-extern set class_sets[]; /* shows char. in each class */
-extern set normal_chars; /* mask off unused portion of set */
-extern int comp_level; /* what compression level to use */
-extern int interactive; /* interactive scanner (avoid lookahead)*/
-extern int mode_counter; /* keeps track of the number of %%name */
-extern int dfa_basep[]; /* start of each group of dfa */
-extern int dfa_class_nop[];/* number of transistion arcs in */
- /* each dfa in each mode */
-extern int nfa_allocated;
-extern int dfa_allocated;
-extern nfa_node **nfa_array; /* start of nfa "array" */
-extern dfa_node **dfa_array; /* start of dfa "array" */
-extern int operation_no; /* unique number for each operation */
-extern FILE *input_stream; /* where description read from */
-extern FILE *output_stream; /* where to put the output */
-extern FILE *mode_stream; /* where to put the mode output */
-extern FILE *class_stream;
-extern char *mode_file; /* name of file for mode output */
-extern int gen_ansi; /* produce ansi compatible code */
-extern int case_insensitive;/* ignore case of input spec. */
-extern int warn_ambig; /* show if regular expressions ambiguous */
-extern int gen_cpp;
-extern char *cl_file_str;
-extern int firstLexMember; /* MR1 */
-extern char *OutputDirectory;
-extern char *class_name;
-
-/******************** Functions ******************************/
-#ifdef __USE_PROTOS
-extern char *dlg_malloc(int, char *, int); /* wrapper malloc */
-extern char *dlg_calloc(int, int, char *, int); /* wrapper calloc */
-extern int reach(unsigned *, register int, unsigned *);
-extern set closure(set *, unsigned *);
-extern dfa_node *new_dfa_node(set);
-extern nfa_node *new_nfa_node(void);
-extern dfa_node *dfastate(set);
-extern dfa_node **nfa_to_dfa(nfa_node *);
-extern void internal_error(char *, char *, int); /* MR9 23-Sep-97 */
-extern FILE *read_stream(char *); /* opens file for reading */
-extern FILE *write_stream(char *); /* opens file for writing */
-extern void make_nfa_model_node(void);
-extern void make_dfa_model_node(int);
-extern char *ClassName(char *);
-extern char *OutMetaName(char *);
-extern void error(char*, int);
-extern void warning(char*, int);
-extern void p_head(void);
-extern void p_class_hdr(void);
-extern void p_includes(void);
-extern void p_tables(void);
-extern void p_tail(void); /* MR1 */
-extern void p_class_def1(void); /* MR1 */
-extern void new_automaton_mode(void); /* MR1 */
-extern int relabel(nfa_node *,int); /* MR1 */
-extern void p_shift_table(int); /* MR1 */
-extern void p_bshift_table(void); /* MR1 */
-extern void p_class_table(void); /* MR1 */
-extern void p_mode_def(char *,int); /* MR1 */
-extern void init(void); /* MR1 */
-extern void p_class_def2(void); /* MR1 */
-extern void clear_hash(void); /* MR1 */
-extern void p_alternative_table(void); /* MR1 */
-extern void p_node_table(void); /* MR1 */
-extern void p_dfa_table(void); /* MR1 */
-extern void p_accept_table(void); /* MR1 */
-extern void p_action_table(void); /* MR1 */
-extern void p_base_table(void); /* MR1 */
-extern void p_single_node(int,int); /* MR1 */
-extern char * minsize(int); /* MR1 */
-extern void close1(nfa_node *,int,set *); /* MR1 */
-extern void partition(nfa_node *,int); /* MR1 */
-extern void intersect_nfa_labels(nfa_node *,set *); /* MR1 */
-extern void r_intersect(nfa_node *,set *); /* MR1 */
-extern void label_node(nfa_node *); /* MR1 */
-extern void label_with_classes(nfa_node *); /* MR1 */
-
-#else
-extern char *dlg_malloc(); /* wrapper malloc */
-extern char *dlg_calloc(); /* wrapper calloc */
-extern int reach();
-extern set closure();
-extern dfa_node *new_dfa_node();
-extern nfa_node *new_nfa_node();
-extern dfa_node *dfastate();
-extern dfa_node **nfa_to_dfa();
-extern void internal_error(); /* MR9 23-Sep-97 */
-extern FILE *read_stream(); /* opens file for reading */
-extern FILE *write_stream(); /* opens file for writing */
-extern void make_nfa_model_node();
-extern void make_dfa_model_node();
-extern char *ClassName();
-extern char *OutMetaName();
-extern void error();
-extern void warning();
-extern void p_head(); /* MR9 */
-extern void p_class_hdr(); /* MR9 */
-extern void p_includes(); /* MR9 */
-extern void p_tables(); /* MR9 */
-extern void p_tail(); /* MR1 */
-extern void p_class_def1(); /* MR1 */
-extern void new_automaton_mode(); /* MR1 */
-extern int relabel(); /* MR1 */
-extern void p_shift_table(); /* MR1 */
-extern void p_bshift_table(); /* MR1 */
-extern void p_class_table(); /* MR1 */
-extern void p_mode_def(); /* MR1 */
-extern void init(); /* MR1 */
-extern void p_class_def2(); /* MR1 */
-extern void clear_hash(); /* MR1 */
-extern void p_alternative_table(); /* MR1 */
-extern void p_node_table(); /* MR1 */
-extern void p_dfa_table(); /* MR1 */
-extern void p_accept_table(); /* MR1 */
-extern void p_action_table(); /* MR1 */
-extern void p_base_table(); /* MR1 */
-extern void p_single_node(); /* MR1 */
-extern char * minsize(); /* MR1 */
-extern void close1(); /* MR1 */
-extern void partition(); /* MR1 */
-extern void intersect_nfa_labels(); /* MR1 */
-extern void r_intersect(); /* MR1 */
-extern void label_node(); /* MR1 */
-extern void label_with_classes(); /* MR1 */
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg.r b/Tools/CCode/Source/Pccts/dlg/dlg.r deleted file mode 100644 index c5311fa1b8..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg.r +++ /dev/null @@ -1,275 +0,0 @@ -/*
- File: dlgMPW.r
- Target: dlg 133MR
- Created: Monday, June 15, 1998 4:44:11 AM
- Author: Kenji Tanaka (kentar@osa.att.ne.jp)
-*/
-
-#include "cmdo.r"
-
-resource 'cmdo' (128, "Dlg") {
- { /* array dialogs: 1 elements */
- /* [1] */
- 295,
- "DLG -- Purdue Compiler Construction Tool"
- " Set (PCCTS) lexical analyzer generator.",
- { /* array itemArray: 18 elements */
- /* [1] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {35, 175, 50, 225},
- "On",
- "-CC",
- "When this control is checked, DLG genera"
- "tes a scanner using C++ classes rather t"
- "han C functions."
- },
- /* [2] */
- Or {
- { /* array OrArray: 1 elements */
- /* [1] */
- 1
- }
- },
- RegularEntry {
- "Lexer Class Name:",
- {35, 225, 50, 355},
- {35, 355, 51, 450},
- "DLGLexer",
- keepCase,
- "-cl",
- "This entry specifies the name DLG uses f"
- "or the C++ lexer class."
- },
- /* [3] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {25, 165, 60, 460},
- "C++ Code Generation"
- },
- /* [4] */
- NotDependent {
-
- },
- Files {
- InputFile,
- RequiredFile {
- {37, 25, 56, 135},
- "Input File",
- "",
- "Choose the lexical description file for "
- "DLG to process."
- },
- Additional {
- "",
- "",
- "",
- "",
- { /* array TypesArray: 1 elements */
- /* [1] */
- text
- }
- }
- },
- /* [5] */
- Or {
- { /* array OrArray: 1 elements */
- /* [1] */
- -1
- }
- },
- Files {
- OutputFile,
- RequiredFile {
- {66, 25, 85, 135},
- "Output File",
- "",
- "Choose the name of the file that will ho"
- "ld the DLG-produced scanner."
- },
- NoMore {
-
- }
- },
- /* [6] */
- Or {
- { /* array OrArray: 2 elements */
- /* [1] */
- 1,
- /* [2] */
- 5
- }
- },
- Dummy {
-
- },
- /* [7] */
- NotDependent {
-
- },
- Redirection {
- DiagnosticOutput,
- {90, 25}
- },
- /* [8] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {25, 20, 132, 145},
- "Files"
- },
- /* [9] */
- NotDependent {
-
- },
- Files {
- DirOnly,
- OptionalFile {
- {68, 175, 84, 305},
- {88, 175, 107, 305},
- "Output Directory",
- ":",
- "-o",
- "",
- "Choose the directory where DLG will put "
- "its output.",
- dim,
- "Output DirectoryI",
- "",
- ""
- },
- NoMore {
-
- }
- },
- /* [10] */
- NotDependent {
-
- },
- RegularEntry {
- "Mode File Name:",
- {68, 315, 83, 450},
- {88, 315, 104, 450},
- "mode.h",
- keepCase,
- "-m",
- "This entry specifies the name DLG uses f"
- "or its lexical mode output file."
- },
- /* [11] */
- NotDependent {
-
- },
- RadioButtons {
- { /* array radioArray: 3 elements */
- /* [1] */
- {134, 175, 149, 255}, "None", "", Set, "When this option is selected, DLG will n"
- "ot compress its tables.",
- /* [2] */
- {134, 265, 149, 345}, "Level 1", "-C1", NotSet, "When this option is selected, DLG will r"
- "emove all unused characters from the tra"
- "nsition-from table.",
- /* [3] */
- {134, 360, 149, 450}, "Level 2", "-C2", NotSet, "When this option is selected, DLG will p"
- "erform level 1 compression plus it will "
- "map equivalent characters into the same "
- "character classes."
- }
- },
- /* [12] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {124, 165, 156, 460},
- "Table Compression"
- },
- /* [13] */
- NotDependent {
-
- },
- CheckOption {
- Set,
- {165, 20, 180, 145},
- "Case Sensitive",
- "-ci",
- "When this control is checked, the DLG au"
- "tomaton will treat upper and lower case "
- "characters identically."
- },
- /* [14] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {165, 150, 180, 300},
- "Interactive Scanner",
- "-i",
- "When this control is checked, DLG will g"
- "enerate as interactive a scanner as poss"
- "ible."
- },
- /* [15] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {165, 310, 180, 460},
- "Ambiguity Warnings",
- "-Wambiguity",
- "When this control is checked, DLG warns "
- "if more than one regular expression coul"
- "d match the same character sequence."
- },
- /* [16] */
- NotDependent {
-
- },
- VersionDialog {
- VersionString {
- "1.33MR"
- },
- "PCCTS was written by Terence Parr, Russe"
- "ll Quong, Will Cohen, and Hank Dietz: 19"
- "89-1998. MPW port by Scott Haney.",
- noDialog
- },
- /* [17] */
- And {
- { /* array AndArray: 2 elements */
- /* [1] */
- 4,
- /* [2] */
- 6
- }
- },
- DoItButton {
-
- },
- /* [18] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {142, 20, 157, 148},
- "Generate ANSI C",
- "-ga",
- "When this control is checked, DLG genera"
- "tes ANSI C compatible code."
- }
- }
- }
-};
-
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg1.txt b/Tools/CCode/Source/Pccts/dlg/dlg1.txt deleted file mode 100644 index 06b320de2a..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg1.txt +++ /dev/null @@ -1,132 +0,0 @@ -
-
-
-dlg(1) PCCTS Manual Pages dlg(1)
-
-
-
-NAME
- dlg - DFA Lexical Analyzer Generator
-
-SYNTAX
- dlg [_o_p_t_i_o_n_s] _l_e_x_i_c_a_l__s_p_e_c [_o_u_t_p_u_t__f_i_l_e]
-
-DESCRIPTION
- dlg is a tool that produces fast deterministic finite auto-
- mata for recognizing regular expressions in input.
-
-OPTIONS
- -CC Generate C++ output. The _o_u_t_p_u_t__f_i_l_e is not specified
- in this case.
-
- -C[ level]
- Where level is the compression level used. 0 indica-
- tions no compression, 1 removes all unused characters
- from the transition from table, and 2 maps equivalent
- characters into the same character classes. It is sug-
- gested that level -C2 is used, since it will signifi-
- cantly reduce the size of the dfa produced for lexical
- analyzer.
-
- -m Produces the header file for the lexical mode with a
- name other than the default name of "mode.h".
-
- -i An interactive, or as interactive as possible, parser
- is produced. A character is only obtained when
- required to decide which state to go to. Some care
- must be taken to obtain accept states that do not
- require look ahead at the next character to determine
- if that is the stop state. Any regular expression with
- a Kleene closure at the end is guaranteed to require
- another character of look ahead.
-
- -cl class
- Specify a class name for DLG to generate. The default
- is DLGLexer.
-
- -ci The automaton will treat upper and lower case charac-
- ters identically. This is accomplished in the automa-
- ton; the characters in the lexical buffer are unmodi-
- fied.
-
- -cs Upper and lower case characters are treated as dis-
- tinct. This is the default.
-
- -o dir
- Directory where output files should go (default=".").
- This is very nice for keeping the source directory
- clear of ANTLR and DLG spawn.
-
- -Wambiguity
- Warns if more than one regular expression could match
- the same character sequence. The warnings give the
- numbers of the expressions in the dlg lexical specifi-
- cation file. The numbering of the expressions starts
- at one. Multiple warnings may be print for the same
- expressions.
-
- - Used in place of file names to get input from standard
- in or send output to standard out.
-
-SPECIAL CONSIDERATIONS
- _D_l_g works... we think. There is no implicit guarantee of
- anything. We reserve no legal rights to the software known
- as 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 commercial 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 pro-
- ject, 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. As long as these
- guidelines are followed, we expect to continue enhancing
- this system and expect to make other tools available as they
- are completed.
-
-FILES
- mode.h , dlgauto.h , dlgdef.h
-
-SEE ALSO
- antlr(1), pccts(1)
-
-BUGS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg_a.c b/Tools/CCode/Source/Pccts/dlg/dlg_a.c deleted file mode 100644 index 0b8982cf2a..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg_a.c +++ /dev/null @@ -1,1414 +0,0 @@ -
-/* parser.dlg -- DLG Description of scanner
- *
- * Generated from: dlg_p.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include <ctype.h>
-#include "dlg.h"
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-LOOKAHEAD
-
-void
-#ifdef __USE_PROTOS
-zzerraction(void)
-#else
-zzerraction()
-#endif
-{
- (*zzerr)("invalid token");
- zzadvance();
- zzskip();
-}
-/*
- * D L G tables
- *
- * Generated from: parser.dlg
- *
- * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz
- * Purdue University Electrical Engineering
- * DLG Version 1.33MR33
- */
-
-#include "mode.h"
-
-
-
-
-int func_action; /* should actions be turned into functions?*/
-int lex_mode_counter = 0; /* keeps track of the number of %%names */
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via <<%%lexmember...>> */
-/* MR1 */
-int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
-int lexAction = 0; /* <<%%lexaction ...>> MR1 */
-int parserClass = 0; /* <<%%parserclass ...>> MR1 */
-int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
-char theClassName[100]; /* MR11 */
-char *pClassName=theClassName; /* MR11 */
-int firstLexMember=1; /* MR1 */
-
-#ifdef __USE_PROTOS
-void xxputc(int c) { /* MR1 */
-#else
- void xxputc(c) /* MR1 */
- int c; /* MR1 */
- { /* MR1 */
-#endif
- if (parserClass) { /* MR1 */
- *pClassName++=c; /* MR1 */
- *pClassName=0; /* MR1 */
- } else if (lexMember || lexPrefix) { /* MR1 */
- if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
- } else { /* MR1 */
- fputc(c,OUT); /* MR1 */
- }; /* MR1 */
- } /* MR1 */
-
-#ifdef __USE_PROTOS
- void xxprintf(char *format,char *string) { /* MR1 */
-#else
- void xxprintf(format,string) /* MR1 */
- char *format; /* MR1 */
- char *string; /* MR1 */
- { /* MR1 */
-#endif
- if (lexMember || lexPrefix || parserClass) { /* MR1 */
- if (class_stream != NULL) /* MR1 */
- fprintf(class_stream,format,string); /* MR1 */
- } else { /* MR1 */
- fprintf(OUT,format,string); /* MR1 */
- }; /* MR1 */
- } /* MR1 */
-
-static void act1()
-{
- NLA = 1;
- }
-
-
-static void act2()
-{
- NLA = 2;
- zzskip();
- }
-
-
-static void act3()
-{
- NLA = 3;
- zzline++; zzskip(); DAWDLE;
- }
-
-
-static void act4()
-{
- NLA = L_EOF;
- }
-
-
-static void act5()
-{
- NLA = PER_PER;
- }
-
-
-static void act6()
-{
- NLA = NAME_PER_PER;
- p_mode_def(&zzlextext[2],lex_mode_counter++);
- }
-
-
-static void act7()
-{
- NLA = LEXMEMBER;
- lexMember=1; /* MR1 */
- if (firstLexMember != 0) { /* MR1 */
- firstLexMember=0; /* MR1 */
- p_class_def1(); /* MR1 */
- }; /* MR1 */
- zzmode(ACT); /* MR1 */
- }
-
-
-static void act8()
-{
- NLA = LEXACTION;
- lexAction=1;zzmode(ACT);
- }
-
-
-static void act9()
-{
- NLA = PARSERCLASS;
- parserClass=1; /* MR1 */
- zzmode(ACT); /* MR1 */
- }
-
-
-static void act10()
-{
- NLA = LEXPREFIX;
- lexPrefix=1;zzmode(ACT);
- }
-
-
-static void act11()
-{
- NLA = ACTION;
- if (func_action)
- fprintf(OUT,"\n%s %sact%d()\n{ ",
- gen_cpp?"ANTLRTokenType":"static void",
- gen_cpp?ClassName("::"):"", ++action_no);
- zzmode(ACT); zzskip();
- }
-
-
-static void act12()
-{
- NLA = GREAT_GREAT;
- }
-
-
-static void act13()
-{
- NLA = L_BRACE;
- }
-
-
-static void act14()
-{
- NLA = R_BRACE;
- }
-
-
-static void act15()
-{
- NLA = L_PAR;
- }
-
-
-static void act16()
-{
- NLA = R_PAR;
- }
-
-
-static void act17()
-{
- NLA = L_BRACK;
- }
-
-
-static void act18()
-{
- NLA = R_BRACK;
- }
-
-
-static void act19()
-{
- NLA = ZERO_MORE;
- }
-
-
-static void act20()
-{
- NLA = ONE_MORE;
- }
-
-
-static void act21()
-{
- NLA = OR;
- }
-
-
-static void act22()
-{
- NLA = RANGE;
- }
-
-
-static void act23()
-{
- NLA = NOT;
- }
-
-
-static void act24()
-{
- NLA = OCTAL_VALUE;
- {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}
- }
-
-
-static void act25()
-{
- NLA = HEX_VALUE;
- {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}
- }
-
-
-static void act26()
-{
- NLA = DEC_VALUE;
- {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}
- }
-
-
-static void act27()
-{
- NLA = TAB;
- zzlextext[0] = '\t';
- }
-
-
-static void act28()
-{
- NLA = NL;
- zzlextext[0] = '\n';
- }
-
-
-static void act29()
-{
- NLA = CR;
- zzlextext[0] = '\r';
- }
-
-
-static void act30()
-{
- NLA = BS;
- zzlextext[0] = '\b';
- }
-
-
-static void act31()
-{
- NLA = CONTINUATION;
- zzline++; zzskip();
- }
-
-
-static void act32()
-{
- NLA = LIT;
- zzlextext[0] = zzlextext[1];
- }
-
-
-static void act33()
-{
- NLA = REGCHAR;
- }
-
-static unsigned char shift0[257] = {
- 0, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 1, 2, 40, 40, 1, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 1, 40, 40, 40, 40, 4, 40,
- 40, 30, 31, 34, 35, 40, 37, 40, 40, 23,
- 24, 24, 24, 24, 24, 24, 24, 25, 25, 40,
- 40, 26, 40, 27, 40, 3, 21, 21, 21, 21,
- 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 20,
- 22, 22, 32, 39, 33, 40, 22, 40, 11, 9,
- 12, 21, 6, 19, 22, 22, 14, 22, 22, 5,
- 8, 16, 15, 17, 22, 10, 18, 13, 22, 22,
- 22, 7, 22, 22, 28, 36, 29, 38, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40
-};
-
-
-static void act34()
-{
- NLA = 1;
- error("unterminated action", zzline); zzmode(START);
- }
-
-
-static void act35()
-{
- NLA = ACTION;
- if (func_action) fprintf(OUT,"}\n\n");
- zzmode(START);
- /* MR1 */
- /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
- /* MR1 via <<%%lexmember ...>> */
- /* MR1 This is a consequence of not saving actions */
- /* MR1 */
- /* MR1 */ parserClass=0;
- /* MR1 */ lexPrefix=0;
- /* MR1 */ lexAction=0;
- /* MR1 */ lexMember=0;
- }
-
-
-static void act36()
-{
- NLA = 34;
- xxputc(zzlextext[0]); zzskip();
- }
-
-
-static void act37()
-{
- NLA = 35;
- xxputc('>'); zzskip();
- }
-
-
-static void act38()
-{
- NLA = 36;
- xxputc('\\'); zzskip();
- }
-
-
-static void act39()
-{
- NLA = 37;
- xxputc(zzlextext[0]); ++zzline; zzskip();
- }
-
-
-static void act40()
-{
- NLA = 38;
- zzmode(ACTION_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- }
-
-
-static void act41()
-{
- NLA = 39;
- zzmode(ACTION_CPP_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- }
-
-
-static void act42()
-{
- NLA = 40;
- xxputc(zzlextext[0]); zzskip();
- }
-
-static unsigned char shift1[257] = {
- 0, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 3, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 5, 6, 6, 6, 6, 4, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 1, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 2, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6
-};
-
-
-static void act43()
-{
- NLA = 1;
- }
-
-
-static void act44()
-{
- NLA = 41;
- zzmode(ACT); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- }
-
-
-static void act45()
-{
- NLA = 42;
- zzline++; xxputc(zzlextext[0]); zzskip();
- }
-
-
-static void act46()
-{
- NLA = 43;
- xxputc(zzlextext[0]); zzskip();
- }
-
-static unsigned char shift2[257] = {
- 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 3, 4, 4, 3, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 1, 4, 4, 4, 4, 2, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4
-};
-
-
-static void act47()
-{
- NLA = 1;
- }
-
-
-static void act48()
-{
- NLA = 44;
- zzmode(ACT); zzline++; /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- }
-
-
-static void act49()
-{
- NLA = 45;
- xxputc(zzlextext[0]); zzskip();
- }
-
-static unsigned char shift3[257] = {
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 1, 2, 2, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2
-};
-
-#define DfaStates 94
-typedef unsigned char DfaState;
-
-static DfaState st0[42] = {
- 1, 2, 3, 4, 5, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 6, 94
-};
-
-static DfaState st1[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st2[42] = {
- 94, 21, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st3[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st4[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st5[42] = {
- 94, 94, 94, 94, 22, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st6[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st7[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 23, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st8[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 24, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st9[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st10[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st11[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st12[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st13[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st14[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st15[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st16[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st17[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st18[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st19[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st20[42] = {
- 94, 25, 26, 25, 25, 25, 25, 25, 25, 27,
- 28, 25, 25, 29, 25, 25, 30, 25, 25, 25,
- 25, 25, 25, 31, 32, 32, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 94
-};
-
-static DfaState st21[42] = {
- 94, 21, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st22[42] = {
- 94, 94, 94, 94, 94, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st23[42] = {
- 94, 94, 94, 94, 34, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st24[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st25[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st26[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st27[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st28[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st29[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st30[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st31[42] = {
- 94, 94, 94, 94, 94, 94, 94, 35, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 35, 94, 94, 36, 36, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st32[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 37, 37, 37, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st33[42] = {
- 94, 94, 94, 94, 94, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st34[42] = {
- 94, 94, 94, 94, 39, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st35[42] = {
- 94, 94, 94, 94, 94, 94, 40, 94, 94, 40,
- 94, 40, 40, 94, 94, 94, 94, 94, 94, 40,
- 94, 40, 94, 40, 40, 40, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st36[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 36, 36, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st37[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 37, 37, 37, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st38[42] = {
- 94, 94, 94, 94, 94, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st39[42] = {
- 94, 94, 94, 94, 94, 41, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 42, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st40[42] = {
- 94, 94, 94, 94, 94, 94, 40, 94, 94, 40,
- 94, 40, 40, 94, 94, 94, 94, 94, 94, 40,
- 94, 40, 94, 40, 40, 40, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st41[42] = {
- 94, 94, 94, 94, 94, 94, 43, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st42[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 44, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st43[42] = {
- 94, 94, 94, 94, 94, 94, 94, 45, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st44[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 46, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st45[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 47, 94,
- 94, 48, 94, 94, 94, 94, 94, 49, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st46[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 50, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st47[42] = {
- 94, 94, 94, 94, 94, 94, 51, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st48[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 52, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st49[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 53, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st50[42] = {
- 94, 94, 94, 94, 94, 94, 54, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st51[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 55, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st52[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 56, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st53[42] = {
- 94, 94, 94, 94, 94, 94, 57, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st54[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 58, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st55[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 59,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st56[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 60, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st57[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 61,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st58[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 62, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st59[42] = {
- 94, 94, 94, 94, 94, 94, 63, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st60[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 64, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st61[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 65, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st62[42] = {
- 94, 94, 94, 94, 94, 66, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st63[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 67, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st64[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 68, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st65[42] = {
- 94, 94, 94, 94, 94, 94, 94, 69, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st66[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 70, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st67[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st68[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st69[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st70[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 71, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st71[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 72, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st72[42] = {
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94
-};
-
-static DfaState st73[8] = {
- 74, 75, 76, 77, 78, 79, 79, 94
-};
-
-static DfaState st74[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st75[8] = {
- 94, 80, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st76[8] = {
- 94, 81, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st77[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st78[8] = {
- 94, 94, 94, 94, 82, 83, 94, 94
-};
-
-static DfaState st79[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st80[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st81[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st82[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st83[8] = {
- 94, 94, 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st84[6] = {
- 85, 86, 87, 88, 87, 94
-};
-
-static DfaState st85[6] = {
- 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st86[6] = {
- 94, 94, 89, 94, 94, 94
-};
-
-static DfaState st87[6] = {
- 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st88[6] = {
- 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st89[6] = {
- 94, 94, 94, 94, 94, 94
-};
-
-static DfaState st90[4] = {
- 91, 92, 93, 94
-};
-
-static DfaState st91[4] = {
- 94, 94, 94, 94
-};
-
-static DfaState st92[4] = {
- 94, 94, 94, 94
-};
-
-static DfaState st93[4] = {
- 94, 94, 94, 94
-};
-
-
-DfaState *dfa[94] = {
- st0,
- st1,
- st2,
- st3,
- st4,
- st5,
- st6,
- st7,
- st8,
- st9,
- st10,
- st11,
- st12,
- st13,
- st14,
- st15,
- st16,
- st17,
- st18,
- st19,
- st20,
- st21,
- st22,
- st23,
- st24,
- st25,
- st26,
- st27,
- st28,
- st29,
- st30,
- st31,
- st32,
- st33,
- st34,
- st35,
- st36,
- st37,
- st38,
- st39,
- st40,
- st41,
- st42,
- st43,
- st44,
- st45,
- st46,
- st47,
- st48,
- st49,
- st50,
- st51,
- st52,
- st53,
- st54,
- st55,
- st56,
- st57,
- st58,
- st59,
- st60,
- st61,
- st62,
- st63,
- st64,
- st65,
- st66,
- st67,
- st68,
- st69,
- st70,
- st71,
- st72,
- st73,
- st74,
- st75,
- st76,
- st77,
- st78,
- st79,
- st80,
- st81,
- st82,
- st83,
- st84,
- st85,
- st86,
- st87,
- st88,
- st89,
- st90,
- st91,
- st92,
- st93
-};
-
-
-DfaState accepts[95] = {
- 0, 1, 2, 3, 4, 33, 33, 33, 33, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 0, 2, 5, 11, 12, 32, 31, 30, 29, 27,
- 28, 24, 26, 6, 0, 0, 24, 26, 6, 0,
- 25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 7, 8, 10,
- 0, 0, 9, 0, 34, 36, 38, 39, 42, 42,
- 35, 37, 41, 40, 0, 43, 46, 46, 45, 44,
- 0, 47, 48, 49, 0
-};
-
-void (*actions[50])() = {
- zzerraction,
- act1,
- act2,
- act3,
- act4,
- act5,
- act6,
- act7,
- act8,
- act9,
- act10,
- act11,
- act12,
- act13,
- act14,
- act15,
- act16,
- act17,
- act18,
- act19,
- act20,
- act21,
- act22,
- act23,
- act24,
- act25,
- act26,
- act27,
- act28,
- act29,
- act30,
- act31,
- act32,
- act33,
- act34,
- act35,
- act36,
- act37,
- act38,
- act39,
- act40,
- act41,
- act42,
- act43,
- act44,
- act45,
- act46,
- act47,
- act48,
- act49
-};
-
-static DfaState dfa_base[] = {
- 0,
- 73,
- 84,
- 90
-};
-
-static unsigned char *b_class_no[] = {
- shift0,
- shift1,
- shift2,
- shift3
-};
-
-
-
-#define ZZSHIFT(c) (b_class_no[zzauto][1+c])
-#define MAX_MODE 4
-#include "dlgauto.h"
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg_p.c b/Tools/CCode/Source/Pccts/dlg/dlg_p.c deleted file mode 100644 index e726ae3983..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg_p.c +++ /dev/null @@ -1,959 +0,0 @@ -/*
- * A n t l r T r a n s l a t i o n H e a d e r
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- *
- * ..\bin\antlr dlg_p.g -gh
- *
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include <ctype.h>
-#include "dlg.h"
-#define zzSET_SIZE 8
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "mode.h"
-
-/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */
-
-#ifndef PCCTS_PURIFY
-#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s));
-#endif
-
-ANTLR_INFO
-
-
-/* MR20 G. Hobbelt
-Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled
-*/
-
-#ifdef __TURBOC__
-#pragma warn -aus /* unused assignment of 'xxx' */
-#endif
-
-int action_no = 0; /* keep track of actions outputed */
-int nfa_allocated = 0; /* keeps track of number of nfa nodes */
-nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
-nfa_node nfa_model_node; /* model to initialize new nodes */
-set used_chars; /* used to label trans. arcs */
-set used_classes; /* classes or chars used to label trans. arcs */
-set normal_chars; /* mask to get rid elements that aren't used
-in set */
-int flag_paren = FALSE;
-int flag_brace = FALSE;
-int mode_counter = 0; /* keep track of number of %%names */
-
-
-
-void
-#ifdef __USE_PROTOS
-grammar(void)
-#else
-grammar()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- p_head(); p_class_hdr(); func_action = FALSE;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd1[LA(1)]&0x1) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==LEXACTION) ) {
- zzmatch(LEXACTION); zzCONSUME;
- }
- else {
- if ( (LA(1)==LEXMEMBER) ) {
- zzmatch(LEXMEMBER); zzCONSUME;
- }
- else {
- if ( (LA(1)==LEXPREFIX) ) {
- zzmatch(LEXPREFIX); zzCONSUME;
- }
- else {
- if ( (LA(1)==PARSERCLASS) ) {
- zzmatch(PARSERCLASS); zzCONSUME;
- }
- else {
- if ( (LA(1)==ACTION) ) {
- }
- else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- zzEXIT(zztasp3);
- }
- }
- zzmatch(ACTION); zzCONSUME;
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- if ( gen_cpp ) p_includes();
- start_states();
- func_action = FALSE; p_tables(); p_tail();
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==ACTION) ) {
- zzmatch(ACTION); zzCONSUME;
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(1);
- if (firstLexMember != 0) p_class_def1();
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x2);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-start_states(void)
-#else
-start_states()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==PER_PER) ) {
- zzmatch(PER_PER); zzCONSUME;
- do_conversion();
- }
- else {
- if ( (LA(1)==NAME_PER_PER) ) {
- zzmatch(NAME_PER_PER); zzCONSUME;
- do_conversion();
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- while ( (LA(1)==NAME_PER_PER) ) {
- zzmatch(NAME_PER_PER); zzCONSUME;
- do_conversion();
- zzLOOP(zztasp3);
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(PER_PER); zzCONSUME;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x4);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-do_conversion(void)
-#else
-do_conversion()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- new_automaton_mode(); func_action = TRUE;
- rule_list();
-
- dfa_class_nop[mode_counter] =
- relabel(zzaArg(zztasp1,1 ).l,comp_level);
- if (comp_level)
- p_shift_table(mode_counter);
- dfa_basep[mode_counter] = dfa_allocated+1;
- make_dfa_model_node(dfa_class_nop[mode_counter]);
- nfa_to_dfa(zzaArg(zztasp1,1 ).l);
- ++mode_counter;
- func_action = FALSE;
-#ifdef HASH_STAT
- fprint_hash_stats(stderr);
-#endif
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x8);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-rule_list(void)
-#else
-rule_list()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd1[LA(1)]&0x10) ) {
- rule();
- zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd1[LA(1)]&0x20) ) {
- rule();
- {nfa_node *t1;
- t1 = new_nfa_node();
- (t1)->trans[0]=zzaRet.l;
- (t1)->trans[1]=zzaArg(zztasp2,1 ).l;
- /* all accept nodes "dead ends" */
- zzaRet.l=t1; zzaRet.r=NULL;
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (setwd1[LA(1)]&0x40) ) {
- zzaRet.l = new_nfa_node(); zzaRet.r = NULL;
- warning("no regular expressions", zzline);
- }
- else {zzFAIL(1,zzerr3,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x80);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-rule(void)
-#else
-rule()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd2[LA(1)]&0x1) ) {
- reg_expr();
- zzmatch(ACTION);
- if (zzaArg(zztasp1,1 ).r != NULL) {
- zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; (zzaArg(zztasp1,1 ).r)->accept=action_no;
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==ACTION) ) {
- zzmatch(ACTION);
- zzaRet.l = NULL; zzaRet.r = NULL;
- error("no expression for action ", zzline);
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x2);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-reg_expr(void)
-#else
-reg_expr()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- and_expr();
- zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==OR) ) {
- zzmatch(OR); zzCONSUME;
- and_expr();
- {nfa_node *t1, *t2;
- t1 = new_nfa_node(); t2 = new_nfa_node();
- (t1)->trans[0]=zzaRet.l;
- (t1)->trans[1]=zzaArg(zztasp2,2 ).l;
- /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2;
- if (zzaArg(zztasp2,2 ).r) {
- (zzaArg(zztasp2,2 ).r)->trans[1]=t2; /* MR20 */
- }
- zzaRet.l=t1; zzaRet.r=t2;
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x4);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-and_expr(void)
-#else
-and_expr()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- repeat_expr();
-
- zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd2[LA(1)]&0x8) ) {
- repeat_expr();
- if (zzaRet.r != NULL) {
- (zzaRet.r)->trans[1]=zzaArg(zztasp2,1 ).l;
- zzaRet.r=zzaArg(zztasp2,1 ).r;
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x10);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-repeat_expr(void)
-#else
-repeat_expr()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd2[LA(1)]&0x20) ) {
- expr();
- zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==ZERO_MORE) ) {
- zzmatch(ZERO_MORE);
- { nfa_node *t1,*t2;
- /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l;
- t1 = new_nfa_node(); t2 = new_nfa_node();
- t1->trans[0]=zzaRet.l;
- t1->trans[1]=t2;
- /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2;
- zzaRet.l=t1;zzaRet.r=t2;
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==ONE_MORE) ) {
- zzmatch(ONE_MORE);
- if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l;
- zzCONSUME;
-
- }
- else {
- if ( (setwd2[LA(1)]&0x40) ) {
- }
- else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (LA(1)==ZERO_MORE) ) {
- zzmatch(ZERO_MORE);
- error("no expression for *", zzline);
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==ONE_MORE) ) {
- zzmatch(ONE_MORE);
- error("no expression for +", zzline);
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x80);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-expr(void)
-#else
-expr()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- zzaRet.l = new_nfa_node();
- zzaRet.r = new_nfa_node();
- if ( (LA(1)==L_BRACK) ) {
- zzmatch(L_BRACK); zzCONSUME;
- atom_list();
- zzmatch(R_BRACK);
-
- /* MR23 */ if (zzaRet.l != NULL) {
- (zzaRet.l)->trans[0] = zzaRet.r;
- (zzaRet.l)->label = set_dup(zzaArg(zztasp1,2 ).label);
- set_orin(&used_chars,(zzaRet.l)->label);
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==NOT) ) {
- zzmatch(NOT); zzCONSUME;
- zzmatch(L_BRACK); zzCONSUME;
- atom_list();
- zzmatch(R_BRACK);
-
- /* MR23 */ if (zzaRet.l != NULL) {
- (zzaRet.l)->trans[0] = zzaRet.r;
- (zzaRet.l)->label = set_dif(normal_chars,zzaArg(zztasp1,3 ).label);
- set_orin(&used_chars,(zzaRet.l)->label);
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==L_PAR) ) {
- zzmatch(L_PAR); zzCONSUME;
- reg_expr();
- zzmatch(R_PAR);
-
- /* MR23 */ if (zzaRet.l != NULL) {
- (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l;
- if (zzaArg(zztasp1,2 ).r) {
- (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */
- }
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==L_BRACE) ) {
- zzmatch(L_BRACE); zzCONSUME;
- reg_expr();
- zzmatch(R_BRACE);
-
- /* MR23 */ if (zzaRet.l != NULL) {
- (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l;
- (zzaRet.l)->trans[1] = zzaRet.r;
- if (zzaArg(zztasp1,2 ).r) {
- (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */
- }
- }
- zzCONSUME;
-
- }
- else {
- if ( (setwd3[LA(1)]&0x1) ) {
- atom();
-
- /* MR23 */ if (zzaRet.l != NULL) {
- (zzaRet.l)->trans[0] = zzaRet.r;
- (zzaRet.l)->label = set_dup(zzaArg(zztasp1,1 ).label);
- set_orin(&used_chars,(zzaRet.l)->label);
- }
- }
- else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x2);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-atom_list(void)
-#else
-atom_list()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- set_free(zzaRet.label);
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd3[LA(1)]&0x4) ) {
- near_atom();
- set_orin(&(zzaRet.label),zzaArg(zztasp2,1 ).label);
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x8);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-near_atom(void)
-#else
-near_atom()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- register int i;
- register int i_prime;
- anychar();
- zzaRet.letter=zzaArg(zztasp1,1 ).letter; zzaRet.label=set_of(zzaArg(zztasp1,1 ).letter);
- i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==RANGE) ) {
- zzmatch(RANGE); zzCONSUME;
- anychar();
- if (case_insensitive){
- i_prime = zzaRet.letter+MIN_CHAR;
- zzaRet.letter = (islower(i_prime) ?
- toupper(i_prime) : i_prime)-MIN_CHAR;
- i_prime = zzaArg(zztasp2,2 ).letter+MIN_CHAR;
- zzaArg(zztasp2,2 ).letter = (islower(i_prime) ?
- toupper(i_prime) : i_prime)-MIN_CHAR;
- }
- /* check to see if range okay */
- {
- int debugLetter1 = zzaRet.letter;
- int debugLetter2 = zzaArg(zztasp2,2 ).letter;
- }
- if (zzaRet.letter > zzaArg(zztasp2,2 ).letter
- && zzaArg(zztasp2,2 ).letter != 0xff){ /* MR16 */
- error("invalid range ", zzline);
- }
- for (i=zzaRet.letter; i<= (int)zzaArg(zztasp2,2 ).letter; ++i){
- set_orel(i,&(zzaRet.label));
- i_prime = i+MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- }
- }
- else {
- if ( (setwd3[LA(1)]&0x10) ) {
- }
- else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x20);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-atom(void)
-#else
-atom()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- register int i_prime;
- anychar();
- zzaRet.label = set_of(zzaArg(zztasp1,1 ).letter);
- i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &(zzaRet.label));
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x40);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-anychar(void)
-#else
-anychar()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (LA(1)==REGCHAR) ) {
- zzmatch(REGCHAR);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==OCTAL_VALUE) ) {
- zzmatch(OCTAL_VALUE);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==HEX_VALUE) ) {
- zzmatch(HEX_VALUE);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==DEC_VALUE) ) {
- zzmatch(DEC_VALUE);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TAB) ) {
- zzmatch(TAB);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==NL) ) {
- zzmatch(NL);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==CR) ) {
- zzmatch(CR);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==BS) ) {
- zzmatch(BS);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==LIT) ) {
- zzmatch(LIT);
- zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==L_EOF) ) {
- zzmatch(L_EOF);
- zzaRet.letter = 0;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- }
- }
- }
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- /* empty action */
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x80);
- }
-}
-
-/* adds a new nfa to the binary tree and returns a pointer to it */
-nfa_node *
-#ifdef __USE_PROTOS
-new_nfa_node(void)
-#else
-new_nfa_node()
-#endif
-{
- register nfa_node *t;
- static int nfa_size=0; /* elements nfa_array[] can hold */
-
- ++nfa_allocated;
- if (nfa_size<=nfa_allocated){
- /* need to redo array */
- if (!nfa_array){
- /* need some to do inital allocation */
- nfa_size=nfa_allocated+NFA_MIN;
- nfa_array=(nfa_node **) malloc(sizeof(nfa_node*)*
- nfa_size);
- }else{
- /* need more space */
- nfa_size=2*(nfa_allocated+1);
- nfa_array=(nfa_node **) realloc(nfa_array,
- sizeof(nfa_node*)*nfa_size);
- }
- }
- /* fill out entry in array */
- t = (nfa_node*) malloc(sizeof(nfa_node));
- nfa_array[nfa_allocated] = t;
- *t = nfa_model_node;
- t->node_no = nfa_allocated;
- return t;
-}
-
-
-/* initialize the model node used to fill in newly made nfa_nodes */
-void
-#ifdef __USE_PROTOS
-make_nfa_model_node(void)
-#else
-make_nfa_model_node()
-#endif
-{
- nfa_model_node.node_no = -1; /* impossible value for real nfa node */
- nfa_model_node.nfa_set = 0;
- nfa_model_node.accept = 0; /* error state default*/
- nfa_model_node.trans[0] = NULL;
- nfa_model_node.trans[1] = NULL;
- nfa_model_node.label = empty;
-}
-
-#if defined(DEBUG) || defined(_DEBUG)
-
-/* print out the pointer value and the node_number */
-void
-#ifdef __USE_PROTOS
-fprint_dfa_pair(FILE *f, nfa_node *p)
-#else
-fprint_dfa_pair(f, p)
-FILE *f;
-nfa_node *p;
-#endif
-{
- if (p){
- fprintf(f, "%x (%d)", p, p->node_no);
- }else{
- fprintf(f, "(nil)");
- }
-}
-
-/* print out interest information on a set */
-void
-#ifdef __USE_PROTOS
-fprint_set(FILE *f, set s)
-#else
-fprint_set(f,s)
-FILE *f;
-set s;
-#endif
-{
- unsigned int *x;
-
- fprintf(f, "n = %d,", s.n);
- if (s.setword){
- fprintf(f, "setword = %x, ", s.setword);
- /* print out all the elements in the set */
- x = set_pdq(s);
- while (*x!=nil){
- fprintf(f, "%d ", *x);
- ++x;
- }
- }else{
- fprintf(f, "setword = (nil)");
- }
-}
-
-/* code to be able to dump out the nfas
-return 0 if okay dump
-return 1 if screwed up
-*/
-int
-#ifdef __USE_PROTOS
-dump_nfas(int first_node, int last_node)
-#else
-dump_nfas(first_node, last_node)
-int first_node;
-int last_node;
-#endif
-{
- register int i;
- nfa_node *t;
-
- for (i=first_node; i<=last_node; ++i){
- t = NFA(i);
- if (!t) break;
- fprintf(stderr, "nfa_node %d {\n", t->node_no);
- fprintf(stderr, "\n\tnfa_set = %d\n", t->nfa_set);
- fprintf(stderr, "\taccept\t=\t%d\n", t->accept);
- fprintf(stderr, "\ttrans\t=\t(");
- fprint_dfa_pair(stderr, t->trans[0]);
- fprintf(stderr, ",");
- fprint_dfa_pair(stderr, t->trans[1]);
- fprintf(stderr, ")\n");
- fprintf(stderr, "\tlabel\t=\t{ ");
- fprint_set(stderr, t->label);
- fprintf(stderr, "\t}\n");
- fprintf(stderr, "}\n\n");
- }
- return 0;
-}
-#endif
-
-/* DLG-specific syntax error message generator
-* (define USER_ZZSYN when compiling so don't get 2 definitions)
-*/
-void
-#ifdef __USE_PROTOS
-zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text)
-#else
-zzsyn(text, tok, egroup, eset, etok, k, bad_text)
-char *text, *egroup, *bad_text;
-int tok;
-int etok;
-int k;
-SetWordType *eset;
-#endif
-{
-fprintf(stderr, ErrHdr, file_str[0]!=NULL?file_str[0]:"stdin", zzline);
-fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
-if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
-if ( k==1 ) fprintf(stderr, " missing");
-else
-{
-fprintf(stderr, "; \"%s\" not", bad_text);
-if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
-}
-if ( zzset_deg(eset)>0 ) zzedecode(eset);
-else fprintf(stderr, " %s", zztokens[etok]);
-if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
-fprintf(stderr, "\n");
-}
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg_p.g b/Tools/CCode/Source/Pccts/dlg/dlg_p.g deleted file mode 100644 index 58ca110693..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/dlg_p.g +++ /dev/null @@ -1,614 +0,0 @@ -/* This is the parser for the dlg
- * This is a part of the Purdue Compiler Construction Tool Set
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-1995
- */
-
-#header <<
-#include <ctype.h>
-#include "dlg.h"
->>
-
-<<
-
-/* MR20 G. Hobbelt
- Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled
-*/
-
-#ifdef __TURBOC__
-#pragma warn -aus /* unused assignment of 'xxx' */
-#endif
-
-int action_no = 0; /* keep track of actions outputed */
-int nfa_allocated = 0; /* keeps track of number of nfa nodes */
-nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
-nfa_node nfa_model_node; /* model to initialize new nodes */
-set used_chars; /* used to label trans. arcs */
-set used_classes; /* classes or chars used to label trans. arcs */
-set normal_chars; /* mask to get rid elements that aren't used
- in set */
-int flag_paren = FALSE;
-int flag_brace = FALSE;
-int mode_counter = 0; /* keep track of number of %%names */
-
->>
-
-#lexaction <<
-int func_action; /* should actions be turned into functions?*/
-int lex_mode_counter = 0; /* keeps track of the number of %%names */
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via <<%%lexmember...>> */
-/* MR1 */
-int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
-int lexAction = 0; /* <<%%lexaction ...>> MR1 */
-int parserClass = 0; /* <<%%parserclass ...>> MR1 */
-int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
-char theClassName[100]; /* MR11 */
-char *pClassName=theClassName; /* MR11 */
-int firstLexMember=1; /* MR1 */
-
-#ifdef __USE_PROTOS
-void xxputc(int c) { /* MR1 */
-#else
-void xxputc(c) /* MR1 */
- int c; /* MR1 */
-{ /* MR1 */
-#endif
- if (parserClass) { /* MR1 */
- *pClassName++=c; /* MR1 */
- *pClassName=0; /* MR1 */
- } else if (lexMember || lexPrefix) { /* MR1 */
- if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
- } else { /* MR1 */
- fputc(c,OUT); /* MR1 */
- }; /* MR1 */
-} /* MR1 */
-
-#ifdef __USE_PROTOS
-void xxprintf(char *format,char *string) { /* MR1 */
-#else
-void xxprintf(format,string) /* MR1 */
- char *format; /* MR1 */
- char *string; /* MR1 */
-{ /* MR1 */
-#endif
- if (lexMember || lexPrefix || parserClass) { /* MR1 */
- if (class_stream != NULL) /* MR1 */
- fprintf(class_stream,format,string); /* MR1 */
- } else { /* MR1 */
- fprintf(OUT,format,string); /* MR1 */
- }; /* MR1 */
-} /* MR1 */
->>
-
-#token "[\r\t\ ]+" << zzskip(); >> /* Ignore white */
-#token "\n" << zzline++; zzskip(); DAWDLE; >> /* Track Line # */
-#token L_EOF "\@"
-#token PER_PER "\%\%"
-#token NAME_PER_PER "\%\%[a-zA-Z_][a-zA-Z0-9_]*"
- << p_mode_def(&zzlextext[2],lex_mode_counter++); >>
-
-#token LEXMEMBER "\<\<\%\%lexmember" /* MR1 */
- <<lexMember=1; /* MR1 */
- if (firstLexMember != 0) { /* MR1 */
- firstLexMember=0; /* MR1 */
- p_class_def1(); /* MR1 */
- }; /* MR1 */
- zzmode(ACT); /* MR1 */
- >> /* MR1 */
-#token LEXACTION "\<\<\%\%lexaction" /* MR1 */
- <<lexAction=1;zzmode(ACT);>> /* MR1 */
-#token PARSERCLASS "\<\<\%\%parserclass" /* MR1 */
- <<parserClass=1; /* MR1 */
- zzmode(ACT); /* MR1 */
- >> /* MR1 */
-#token LEXPREFIX "\<\<\%\%lexprefix" /* MR1 */
- <<lexPrefix=1;zzmode(ACT);>> /* MR1 */
-
-#token ACTION "\<\<"
- << if (func_action)
- fprintf(OUT,"\n%s %sact%d()\n{ ",
- gen_cpp?"ANTLRTokenType":"static void",
- gen_cpp?ClassName("::"):"", ++action_no);
- zzmode(ACT); zzskip();
- >>
-#token GREAT_GREAT "\>\>"
-#token L_BRACE "\{"
-#token R_BRACE "\}"
-#token L_PAR "\("
-#token R_PAR "\)"
-#token L_BRACK "\["
-#token R_BRACK "\]"
-#token ZERO_MORE "\*"
-#token ONE_MORE "\+"
-#token OR "\|"
-#token RANGE "\-"
-#token NOT "\~"
-#token OCTAL_VALUE "\\0[0-7]*"
- << {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}>>
-#token HEX_VALUE "\\0[Xx][0-9a-fA-F]+"
- << {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}>>
-#token DEC_VALUE "\\[1-9][0-9]*"
- << {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}>>
-#token TAB "\\t" << zzlextext[0] = '\t';>>
-#token NL "\\n" << zzlextext[0] = '\n';>>
-#token CR "\\r" << zzlextext[0] = '\r';>>
-#token BS "\\b" << zzlextext[0] = '\b';>>
-
-/* MR1 */
-/* MR1 10-Apr-97 MR1 Allow #token regular expressions to cross lines */
-/* MR1 */
-#token CONTINUATION "\\ \n" << zzline++; zzskip();>> /* MR1 */
-
-/* NOTE: this takes ANYTHING after the \ */
-#token LIT "\\~[tnrb]" << zzlextext[0] = zzlextext[1];>>
-
-/* NOTE: this takes ANYTHING that doesn't match the other tokens */
-#token REGCHAR "~[\\]"
-
-
-grammar : << p_head(); p_class_hdr(); func_action = FALSE;>>
- ( {LEXACTION | LEXMEMBER | LEXPREFIX | PARSERCLASS } ACTION)* /* MR1 */
- <<if ( gen_cpp ) p_includes();>>
- start_states
- << func_action = FALSE; p_tables(); p_tail(); >>
- (ACTION)* "@"
- << if (firstLexMember != 0) p_class_def1(); >> /* MR1 */
- ;
-
-start_states : ( PER_PER do_conversion
- | NAME_PER_PER do_conversion (NAME_PER_PER do_conversion)*)
- PER_PER
- ;
-
-do_conversion : <<new_automaton_mode(); func_action = TRUE;>>
- rule_list
- <<
- dfa_class_nop[mode_counter] =
- relabel($1.l,comp_level);
- if (comp_level)
- p_shift_table(mode_counter);
- dfa_basep[mode_counter] = dfa_allocated+1;
- make_dfa_model_node(dfa_class_nop[mode_counter]);
- nfa_to_dfa($1.l);
- ++mode_counter;
- func_action = FALSE;
-#ifdef HASH_STAT
- fprint_hash_stats(stderr);
-#endif
- >>
- ;
-
-rule_list : rule <<$$.l=$1.l; $$.r=$1.r;>>
- (rule
- <<{nfa_node *t1;
- t1 = new_nfa_node();
- (t1)->trans[0]=$$.l;
- (t1)->trans[1]=$1.l;
- /* all accept nodes "dead ends" */
- $$.l=t1; $$.r=NULL;
- }
- >>
- )*
- | /* empty */
- <<$$.l = new_nfa_node(); $$.r = NULL;
- warning("no regular expressions", zzline);
- >>
- ;
-
-rule : reg_expr ACTION
-/* MR23 */ << if ($1.r != NULL) {
- $$.l=$1.l; $$.r=$1.r; ($1.r)->accept=action_no;
- }
- >>
- | ACTION
- <<$$.l = NULL; $$.r = NULL;
- error("no expression for action ", zzline);
- >>
- ;
-
-reg_expr : and_expr <<$$.l=$1.l; $$.r=$1.r;>>
- (OR and_expr
- <<{nfa_node *t1, *t2;
- t1 = new_nfa_node(); t2 = new_nfa_node();
- (t1)->trans[0]=$$.l;
- (t1)->trans[1]=$2.l;
-/* MR23 */ if ($$.r != NULL) ($$.r)->trans[1]=t2;
- if ($2.r) {
- ($2.r)->trans[1]=t2; /* MR20 */
- }
- $$.l=t1; $$.r=t2;
- }
- >>
- )*
- ;
-
-and_expr : repeat_expr
- <<
- $$.l=$1.l; $$.r=$1.r;
- >>
- (repeat_expr
-/* MR23 */ << if ($$.r != NULL) {
- ($$.r)->trans[1]=$1.l;
- $$.r=$1.r;
- }
- >>
- )*
- ;
-
-repeat_expr : expr <<$$.l=$1.l; $$.r=$1.r;>>
- { ZERO_MORE
- <<{ nfa_node *t1,*t2;
-/* MR23 */ if ($$.r != NULL) ($$.r)->trans[0] = $$.l;
- t1 = new_nfa_node(); t2 = new_nfa_node();
- t1->trans[0]=$$.l;
- t1->trans[1]=t2;
-/* MR23 */ if ($$.r != NULL) ($$.r)->trans[1]=t2;
- $$.l=t1;$$.r=t2;
- }
- >>
- | ONE_MORE
-/* MR23 */ <<if ($$.r != NULL) ($$.r)->trans[0] = $$.l;>>
- }
- | ZERO_MORE
- << error("no expression for *", zzline);>>
- | ONE_MORE
- << error("no expression for +", zzline);>>
- ;
-
-expr : << $$.l = new_nfa_node();
- $$.r = new_nfa_node();
- >>
- L_BRACK atom_list R_BRACK
- <<
-/* MR23 */ if ($$.l != NULL) {
- ($$.l)->trans[0] = $$.r;
- ($$.l)->label = set_dup($2.label);
- set_orin(&used_chars,($$.l)->label);
- }
- >>
- | NOT L_BRACK atom_list R_BRACK
- <<
-/* MR23 */ if ($$.l != NULL) {
- ($$.l)->trans[0] = $$.r;
- ($$.l)->label = set_dif(normal_chars,$3.label);
- set_orin(&used_chars,($$.l)->label);
- }
- >>
- | L_PAR reg_expr R_PAR
- <<
-/* MR23 */ if ($$.l != NULL) {
- ($$.l)->trans[0] = $2.l;
- if ($2.r) {
- ($2.r)->trans[1] = $$.r; /* MR20 */
- }
- }
- >>
- | L_BRACE reg_expr R_BRACE
- <<
-/* MR23 */ if ($$.l != NULL) {
- ($$.l)->trans[0] = $2.l;
- ($$.l)->trans[1] = $$.r;
- if ($2.r) {
- ($2.r)->trans[1] = $$.r; /* MR20 */
- }
- }
- >>
- | atom
- <<
-/* MR23 */ if ($$.l != NULL) {
- ($$.l)->trans[0] = $$.r;
- ($$.l)->label = set_dup($1.label);
- set_orin(&used_chars,($$.l)->label);
- }
- >>
- ;
-
-atom_list : << set_free($$.label); >>
- (near_atom <<set_orin(&($$.label),$1.label);>>)*
- ;
-
-near_atom : << register int i;
- register int i_prime;
- >>
- anychar
- <<$$.letter=$1.letter; $$.label=set_of($1.letter);
- i_prime = $1.letter + MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &($$.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &($$.label));
- >>
- { RANGE anychar
- << if (case_insensitive){
- i_prime = $$.letter+MIN_CHAR;
- $$.letter = (islower(i_prime) ?
- toupper(i_prime) : i_prime)-MIN_CHAR;
- i_prime = $2.letter+MIN_CHAR;
- $2.letter = (islower(i_prime) ?
- toupper(i_prime) : i_prime)-MIN_CHAR;
- }
- /* check to see if range okay */
- {
- int debugLetter1 = $$.letter;
- int debugLetter2 = $2.letter;
- }
- if ($$.letter > $2.letter
- && $2.letter != 0xff){ /* MR16 */
- error("invalid range ", zzline);
- }
- for (i=$$.letter; i<= (int)$2.letter; ++i){
- set_orel(i,&($$.label));
- i_prime = i+MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &($$.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &($$.label));
- }
- >>
- }
- ;
-
-atom : << register int i_prime;>>
- anychar
- <<$$.label = set_of($1.letter);
- i_prime = $1.letter + MIN_CHAR;
- if (case_insensitive && islower(i_prime))
- set_orel(toupper(i_prime)-MIN_CHAR,
- &($$.label));
- if (case_insensitive && isupper(i_prime))
- set_orel(tolower(i_prime)-MIN_CHAR,
- &($$.label));
- >>
- ;
-
-anychar : REGCHAR <<$$.letter = $1.letter - MIN_CHAR;>>
- | OCTAL_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
- | HEX_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
- | DEC_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
- | TAB <<$$.letter = $1.letter - MIN_CHAR;>>
- | NL <<$$.letter = $1.letter - MIN_CHAR;>>
- | CR <<$$.letter = $1.letter - MIN_CHAR;>>
- | BS <<$$.letter = $1.letter - MIN_CHAR;>>
- | LIT <<$$.letter = $1.letter - MIN_CHAR;>>
- /* NOTE: LEX_EOF is ALWAYS shifted to 0 = MIN_CHAR - MIN_CHAR*/
- | L_EOF <<$$.letter = 0;>>
- ;
-
-<</* empty action */>>
-
-#lexclass ACT
-#token "@" << error("unterminated action", zzline); zzmode(START); >>
-#token ACTION "\>\>"
- << if (func_action) fprintf(OUT,"}\n\n");
- zzmode(START);
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via <<%%lexmember ...>> */
-/* MR1 This is a consequence of not saving actions */
-/* MR1 */
-/* MR1 */ parserClass=0;
-/* MR1 */ lexPrefix=0;
-/* MR1 */ lexAction=0;
-/* MR1 */ lexMember=0;
- >>
-#token "\>" << xxputc(zzlextext[0]); zzskip(); >> /* MR1 */
-#token "\\\>" << xxputc('>'); zzskip(); >> /* MR1 */
-#token "\\" << xxputc('\\'); zzskip(); >> /* MR1 */
-#token "\n" << xxputc(zzlextext[0]); ++zzline; zzskip(); >> /* MR1 */
-#token "/\*" << zzmode(ACTION_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >> /* MR1 */
-#token "//" << zzmode(ACTION_CPP_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >> /* MR1 */
-#token "~[]" << xxputc(zzlextext[0]); zzskip(); >> /* MR1 */
- /* MR1 */
-#lexclass ACTION_COMMENTS /* MR1 */
-#token "\*/" << zzmode(ACT); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >> /* MR1 */
-#token "[\n\r]" << zzline++; xxputc(zzlextext[0]); zzskip();>> /* MR1 */
-#token "~[]" << xxputc(zzlextext[0]); zzskip();>> /* MR1 */
- /* MR1 */
-#lexclass ACTION_CPP_COMMENTS /* MR1 */
-#token "[\n\r]" << zzmode(ACT); zzline++; /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >> /* MR1 */
-#token "~[]" << xxputc(zzlextext[0]); zzskip();>> /* MR1 */
-
-<<
-/* adds a new nfa to the binary tree and returns a pointer to it */
-nfa_node *
-#ifdef __USE_PROTOS
-new_nfa_node(void)
-#else
-new_nfa_node()
-#endif
-{
- register nfa_node *t;
- static int nfa_size=0; /* elements nfa_array[] can hold */
-
- ++nfa_allocated;
- if (nfa_size<=nfa_allocated){
- /* need to redo array */
- if (!nfa_array){
- /* need some to do inital allocation */
- nfa_size=nfa_allocated+NFA_MIN;
- nfa_array=(nfa_node **) malloc(sizeof(nfa_node*)*
- nfa_size);
- }else{
- /* need more space */
- nfa_size=2*(nfa_allocated+1);
- nfa_array=(nfa_node **) realloc(nfa_array,
- sizeof(nfa_node*)*nfa_size);
- }
- }
- /* fill out entry in array */
- t = (nfa_node*) malloc(sizeof(nfa_node));
- nfa_array[nfa_allocated] = t;
- *t = nfa_model_node;
- t->node_no = nfa_allocated;
- return t;
-}
-
-
-/* initialize the model node used to fill in newly made nfa_nodes */
-void
-#ifdef __USE_PROTOS
-make_nfa_model_node(void)
-#else
-make_nfa_model_node()
-#endif
-{
- nfa_model_node.node_no = -1; /* impossible value for real nfa node */
- nfa_model_node.nfa_set = 0;
- nfa_model_node.accept = 0; /* error state default*/
- nfa_model_node.trans[0] = NULL;
- nfa_model_node.trans[1] = NULL;
- nfa_model_node.label = empty;
-}
->>
-
-<<
-#if defined(DEBUG) || defined(_DEBUG)
-
-/* print out the pointer value and the node_number */
-void
-#ifdef __USE_PROTOS
-fprint_dfa_pair(FILE *f, nfa_node *p)
-#else
-fprint_dfa_pair(f, p)
-FILE *f;
-nfa_node *p;
-#endif
-{
- if (p){
- fprintf(f, "%x (%d)", p, p->node_no);
- }else{
- fprintf(f, "(nil)");
- }
-}
-
-/* print out interest information on a set */
-void
-#ifdef __USE_PROTOS
-fprint_set(FILE *f, set s)
-#else
-fprint_set(f,s)
-FILE *f;
-set s;
-#endif
-{
- unsigned int *x;
-
- fprintf(f, "n = %d,", s.n);
- if (s.setword){
- fprintf(f, "setword = %x, ", s.setword);
- /* print out all the elements in the set */
- x = set_pdq(s);
- while (*x!=nil){
- fprintf(f, "%d ", *x);
- ++x;
- }
- }else{
- fprintf(f, "setword = (nil)");
- }
-}
-
-/* code to be able to dump out the nfas
- return 0 if okay dump
- return 1 if screwed up
- */
-int
-#ifdef __USE_PROTOS
-dump_nfas(int first_node, int last_node)
-#else
-dump_nfas(first_node, last_node)
-int first_node;
-int last_node;
-#endif
-{
- register int i;
- nfa_node *t;
-
- for (i=first_node; i<=last_node; ++i){
- t = NFA(i);
- if (!t) break;
- fprintf(stderr, "nfa_node %d {\n", t->node_no);
- fprintf(stderr, "\n\tnfa_set = %d\n", t->nfa_set);
- fprintf(stderr, "\taccept\t=\t%d\n", t->accept);
- fprintf(stderr, "\ttrans\t=\t(");
- fprint_dfa_pair(stderr, t->trans[0]);
- fprintf(stderr, ",");
- fprint_dfa_pair(stderr, t->trans[1]);
- fprintf(stderr, ")\n");
- fprintf(stderr, "\tlabel\t=\t{ ");
- fprint_set(stderr, t->label);
- fprintf(stderr, "\t}\n");
- fprintf(stderr, "}\n\n");
- }
- return 0;
-}
-#endif
->>
-
-<<
-/* DLG-specific syntax error message generator
- * (define USER_ZZSYN when compiling so don't get 2 definitions)
- */
-void
-#ifdef __USE_PROTOS
-zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text)
-#else
-zzsyn(text, tok, egroup, eset, etok, k, bad_text)
-char *text, *egroup, *bad_text;
-int tok;
-int etok;
-int k;
-SetWordType *eset;
-#endif
-{
- fprintf(stderr, ErrHdr, file_str[0]!=NULL?file_str[0]:"stdin", zzline);
- fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
- if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
- if ( k==1 ) fprintf(stderr, " missing");
- else
- {
- fprintf(stderr, "; \"%s\" not", bad_text);
- if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
- }
- if ( zzset_deg(eset)>0 ) zzedecode(eset);
- else fprintf(stderr, " %s", zztokens[etok]);
- if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
- fprintf(stderr, "\n");
-}
->>
diff --git a/Tools/CCode/Source/Pccts/dlg/err.c b/Tools/CCode/Source/Pccts/dlg/err.c deleted file mode 100644 index c3eaeae6d1..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/err.c +++ /dev/null @@ -1,99 +0,0 @@ -/*
- * A n t l r S e t s / E r r o r F i l e H e a d e r
- *
- * Generated from: dlg_p.g
- *
- * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001
- * Parr Research Corporation
- * with Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include <ctype.h>
-#include "dlg.h"
-#define zzSET_SIZE 8
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "err.h"
-
-ANTLRChar *zztokens[46]={
- /* 00 */ "Invalid",
- /* 01 */ "@",
- /* 02 */ "[\\r\\t\\ ]+",
- /* 03 */ "\\n",
- /* 04 */ "L_EOF",
- /* 05 */ "PER_PER",
- /* 06 */ "NAME_PER_PER",
- /* 07 */ "LEXMEMBER",
- /* 08 */ "LEXACTION",
- /* 09 */ "PARSERCLASS",
- /* 10 */ "LEXPREFIX",
- /* 11 */ "ACTION",
- /* 12 */ "GREAT_GREAT",
- /* 13 */ "L_BRACE",
- /* 14 */ "R_BRACE",
- /* 15 */ "L_PAR",
- /* 16 */ "R_PAR",
- /* 17 */ "L_BRACK",
- /* 18 */ "R_BRACK",
- /* 19 */ "ZERO_MORE",
- /* 20 */ "ONE_MORE",
- /* 21 */ "OR",
- /* 22 */ "RANGE",
- /* 23 */ "NOT",
- /* 24 */ "OCTAL_VALUE",
- /* 25 */ "HEX_VALUE",
- /* 26 */ "DEC_VALUE",
- /* 27 */ "TAB",
- /* 28 */ "NL",
- /* 29 */ "CR",
- /* 30 */ "BS",
- /* 31 */ "CONTINUATION",
- /* 32 */ "LIT",
- /* 33 */ "REGCHAR",
- /* 34 */ "\\>",
- /* 35 */ "\\\\>",
- /* 36 */ "\\",
- /* 37 */ "\\n",
- /* 38 */ "/\\*",
- /* 39 */ "//",
- /* 40 */ "~[]",
- /* 41 */ "\\*/",
- /* 42 */ "[\\n\\r]",
- /* 43 */ "~[]",
- /* 44 */ "[\\n\\r]",
- /* 45 */ "~[]"
-};
-SetWordType zzerr1[8] = {0x80,0xf,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr2[8] = {0x60,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr3[8] = {0x70,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType setwd1[46] = {0x0,0x6,0x0,0x0,0x30,0xc8,0xc8,
- 0x1,0x1,0x1,0x1,0x35,0x0,0x30,0x0,
- 0x30,0x0,0x30,0x0,0x30,0x30,0x0,0x0,
- 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
- 0x0,0x30,0x30,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr4[8] = {0x10,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType zzerr5[8] = {0x10,0xe8,0xbb,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType zzerr6[8] = {0x10,0xa0,0x9a,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType setwd2[46] = {0x0,0x0,0x0,0x0,0xeb,0x2,0x2,
- 0x0,0x0,0x0,0x0,0xd6,0x0,0xeb,0xd4,
- 0xeb,0xd4,0xeb,0x0,0xcb,0xcb,0xd0,0x0,
- 0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,
- 0x0,0xeb,0xeb,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr7[8] = {0x10,0xa0,0x82,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType zzerr8[8] = {0x10,0x0,0x44,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType zzerr9[8] = {0x10,0x0,0x0,0x7f, 0x3,0x0,0x0,0x0};
-SetWordType setwd3[46] = {0x0,0x0,0x0,0x0,0xf7,0x0,0x0,
- 0x0,0x0,0x0,0x0,0xc2,0x0,0xc2,0xc2,
- 0xc2,0xc2,0xc2,0xb8,0xc2,0xc2,0xc2,0x80,
- 0xc2,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
- 0x0,0xf7,0xf7,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
diff --git a/Tools/CCode/Source/Pccts/dlg/main.c b/Tools/CCode/Source/Pccts/dlg/main.c deleted file mode 100644 index 35bd827f8c..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/main.c +++ /dev/null @@ -1,281 +0,0 @@ -/* Main function for dlg version
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "stdpccts.h"
-
-char program[] = "dlg";
-char version[] = "1.33MR33"; /* MRXXX */
-int numfiles = 0;
-char *file_str[2] = {NULL, NULL};
-char *mode_file = "mode.h";
-char *class_name = DEFAULT_CLASSNAME;
-char *OutputDirectory = TopDirectory;
-
-/* Option variables */
-int comp_level = 0;
-int interactive = FALSE;
-int case_insensitive = FALSE;
-int warn_ambig = FALSE;
-int gen_cpp = FALSE;
-
-#ifdef __USE_PROTOS
-static int ci_strequ(char *a,char *b)
-#else
-static int ci_strequ(a,b)
- char *a;
- char *b;
-#endif
-{
- for ( ;*a != 0 && *b != 0; a++, b++) {
- if (toupper(*a) != toupper(*b)) return 0;
- }
- return (*a == *b);
-}
-
-/* Option List Stuff */
-#ifdef __USE_PROTOS
-void p_comp0(void) {comp_level = 0;}
-void p_comp1(void) {comp_level = 1;}
-void p_comp2(void) {comp_level = 2;}
-void p_stdio(void) { file_str[numfiles++] = NULL;}
-void p_file(char *s) { file_str[numfiles++] = s;}
-void p_cl_name(char *s, char *t)
- {
- if ( gen_cpp ) {
- class_name = t;
- }
- else {
- warning("-cl only valid in C++ mode; -cl ignored...",0);
- }
- }
-void p_mode_file(char *s, char *t){mode_file=t;}
-void p_outdir(char *s,char *t) {OutputDirectory=t;}
-void p_ansi(void) {gen_ansi = TRUE;}
-void p_interactive(void) {interactive = TRUE;}
-void p_case_s(void) { case_insensitive = FALSE; }
-void p_case_i(void) { case_insensitive = TRUE; }
-void p_warn_ambig(void) { warn_ambig = TRUE; }
-void p_cpp(void) { gen_cpp = TRUE; }
-#else
-void p_comp0() {comp_level = 0;}
-void p_comp1() {comp_level = 1;}
-void p_comp2() {comp_level = 2;}
-void p_stdio() { file_str[numfiles++] = NULL;}
-void p_file(s) char *s; { file_str[numfiles++] = s;}
-void p_cl_name(s,t)
- char *s, *t;
- {
- if ( gen_cpp ) {
- class_name = t;
- }
- else {
- warning("-cl only valid in C++ mode; -cl ignored...",0);
- }
- }
-void p_mode_file(s,t) char *s,*t;{mode_file=t;}
-void p_outdir(s,t) char *s,*t;{OutputDirectory=t;}
-void p_ansi() {gen_ansi = TRUE;}
-void p_interactive() {interactive = TRUE;}
-void p_case_s() { case_insensitive = FALSE; }
-void p_case_i() { case_insensitive = TRUE; }
-void p_warn_ambig() { warn_ambig = TRUE; }
-void p_cpp() { gen_cpp = TRUE; }
-#endif
-
-#ifdef __cplusplus
-typedef void (*WildFunc)(...);
-#else
-typedef void (*WildFunc)();
-#endif
-
-typedef struct {
- char *option;
- int arg;
- WildFunc process;
- char *descr;
- } Opt;
-
-Opt options[] = {
- { "-CC", 0, (WildFunc)p_cpp, "Generate C++ output" },
- { "-C0", 0, (WildFunc)p_comp0, "No compression (default)" },
- { "-C1", 0, (WildFunc)p_comp1, "Compression level 1" },
- { "-C2", 0, (WildFunc)p_comp2, "Compression level 2" },
- { "-ga", 0, (WildFunc)p_ansi, "Generate ansi C"},
- { "-Wambiguity", 0, (WildFunc)p_warn_ambig, "Warn if expressions ambiguous"},
- { "-m", 1, (WildFunc)p_mode_file, "Rename lexical mode output file"},
- { "-i", 0, (WildFunc)p_interactive, "Build interactive scanner (not valid for C++ mode)"},
- { "-ci", 0, (WildFunc)p_case_i, "Make lexical analyzer case insensitive"},
- { "-cl", 1, (WildFunc)p_cl_name, "Rename lexer class (DLGLexer); only used for -CC"},
- { "-cs", 0, (WildFunc)p_case_s, "Make lexical analyzer case sensitive (default)"},
- { "-o", 1, (WildFunc)p_outdir, OutputDirectoryOption},
- { "-", 0, (WildFunc)p_stdio, "Use standard i/o rather than file"},
- { "*", 0, (WildFunc)p_file, ""}, /* anything else is a file */
- { NULL, 0, NULL }
- };
-
-#ifdef __USE_PROTOS
-void ProcessArgs(int argc, char **argv, Opt *options)
-#else
-void ProcessArgs(argc, argv, options)
-int argc;
-char **argv;
-Opt *options;
-#endif
-{
- Opt *p;
-
- while ( argc-- > 0 )
- {
- p = options;
- while ( p->option != NULL )
- {
- if ( strcmp(p->option, "*") == 0 ||
- ci_strequ(p->option,*argv) )
- {
- if ( p->arg )
- {
- (*p->process)( *argv, *(argv+1) );
- argv++;
- argc--;
- }
- else
- (*p->process)( *argv );
- break;
- }
- p++;
- }
- argv++;
- }
-}
-
-#ifdef __USE_PROTOS
-int main(int argc, char *argv[])
-#else
-int main(argc, argv)
-int argc;
-char *argv[];
-#endif
-{
- init();
- fprintf(stderr, "%s Version %s 1989-2001\n", &(program[0]),
- &(version[0]));
- if ( argc == 1 )
- {
- Opt *p = options;
- fprintf(stderr, "%s [options] f1 f2 ... fn\n",argv[0]);
- while ( *(p->option) != '*' )
- {
- fprintf(stderr, "\t%s %s\t%s\n",
- p->option,
- (p->arg)?"___":" ",
- p->descr);
- p++;
- }
- }else{
- ProcessArgs(argc-1, &(argv[1]), options);
- if (interactive && gen_cpp) {
- fprintf(stderr,"\n");
-/*** MR21a This statement is wrong ! ***/
-#if 0
-*** fprintf(stderr,"Interactive lexer option (\"-i\") has no effect when in C++ mode\n");
-*** fprintf(stderr,"because of extra buffering provided by ANTLRTokenBuffer class.\n");
-*** fprintf(stderr,"\n");
-#endif
- }
- input_stream = read_stream(file_str[0]);
- if (input_stream) {
- /* don't overwrite unless input okay */
- if ( gen_cpp ) {
- output_stream = write_stream(ClassName(CPP_FILE_SUFFIX));
- if ( file_str[1]!=NULL ) {
- warning("output file implicit in C++ mode; ignored...",0);
- }
- class_stream = write_stream(ClassName(".h"));
- mode_stream = class_stream;
- }
- else {
- output_stream = write_stream(file_str[1]);
- mode_stream = write_stream(mode_file);
- }
- }
- /* make sure that error reporting routines in grammar
- know what the file really is */
- /* make sure that reading and writing somewhere */
- if (input_stream && output_stream && mode_stream){
- ANTLR(grammar(), input_stream);
- }
- p_class_def2(); /* MR1 */
- }
- if ( output_stream!=NULL ) fclose(output_stream);
- if ( !gen_cpp && mode_stream!=NULL ) fclose(mode_stream);
- if ( class_stream!=NULL ) fclose(class_stream);
- exit(PCCTS_EXIT_SUCCESS);
- return 0; /* get rid of warning message MR1 */
-}
-
-/* initialize all the variables */
-void
-#ifdef __USE_PROTOS
-init(void)
-#else
-init()
-#endif
-{
- register int i;
-
-#ifdef SPECIAL_INITS
- special_inits(); /* MR1 */
-#endif
- used_chars = empty;
- used_classes = empty;
- /* make the valid character set */
- normal_chars = empty;
- /* NOTE: MIN_CHAR is EOF */
- /* NOTE: EOF is not quite a valid char, it is special. Skip it*/
- for (i = 1; i<CHAR_RANGE; ++i){
- set_orel(i,&normal_chars);
- }
- make_nfa_model_node();
- clear_hash();
- /* NOTE: need to set this flag before the lexer starts getting */
- /* tokens */
- func_action = FALSE;
-}
-
-/* stuff that needs to be reset when a new automaton is being built */
-void
-#ifdef __USE_PROTOS
-new_automaton_mode(void) /* MR1 */
-#else
-new_automaton_mode() /* MR1 */
-#endif
-{
- set_free(used_chars);
- clear_hash();
-}
diff --git a/Tools/CCode/Source/Pccts/dlg/makefile b/Tools/CCode/Source/Pccts/dlg/makefile deleted file mode 100644 index d5cceb8be5..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/makefile +++ /dev/null @@ -1,156 +0,0 @@ -#
-# Makefile for DLG 1.33
-# Terence Parr
-# Purdue University, U of MN, Parr Research Corporation
-# 1989-1994
-#
-# Ported to IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-##
-## Uncomment the appropriate section to build
-##
-
-#
-# OS/2 & DOS 16 bit using MSC 6.0
-#
-#CC=cl
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
-#OUT_OBJ = -Fo
-#LIBS=/NOD:LLIBCE LLIBCEP
-#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
-# link @<<
-#$** /NOI
-#$@ /STACK:16384
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# bind $@ c:\os2\doscalls.lib
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for DOS
-#
-#CC=bcc
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= emu mathl cl
-#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
-# tlink @&&|
-#C0L $**
-#$@ /Tde /c
-#
-#$(LIBS)
-#$(DEF_FILE) $(LFLAGS) ;
-#|
-# copy *.exe ..\bin
-#
-
-#
-# 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
-#
-#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
-#
-
-#
-# Borland C++ for OS/2
-#
-#CC=bcc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= c2 os2
-#
-#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
-# tlink @&&|
-#c02 $** -c
-#dlg.exe
-#
-#C2 os2
-#
-#|
-# copy *.exe ..\bin
-#
-
-#
-# UNIX
-#
-CC=cc
-COPT=-O
-ANTLR=${BIN_DIR}/antlr
-DLG=${BIN_DIR}/dlg
-CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DZZLEXBUFSIZE=65536
-OBJ_EXT=o
-OUT_OBJ = -o
-OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
- relabel.o automata.o
-
-dlg : $(OBJ) $(SRC)
- $(CC) $(CFLAGS) -o ${BIN_DIR}/dlg $(OBJ)
-
-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:
- rm -f *.$(OBJ_EXT) core
diff --git a/Tools/CCode/Source/Pccts/dlg/makefile.cygwin b/Tools/CCode/Source/Pccts/dlg/makefile.cygwin deleted file mode 100644 index bbba820d13..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/makefile.cygwin +++ /dev/null @@ -1,157 +0,0 @@ -#
-# Makefile for DLG 1.33
-# Terence Parr
-# Purdue University, U of MN, Parr Research Corporation
-# 1989-1994
-#
-# Ported to IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-##
-## Uncomment the appropriate section to build
-##
-
-#
-# OS/2 & DOS 16 bit using MSC 6.0
-#
-#CC=cl
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
-#OUT_OBJ = -Fo
-#LIBS=/NOD:LLIBCE LLIBCEP
-#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
-# link @<<
-#$** /NOI
-#$@ /STACK:16384
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# bind $@ c:\os2\doscalls.lib
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for DOS
-#
-#CC=bcc
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= emu mathl cl
-#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
-# tlink @&&|
-#C0L $**
-#$@ /Tde /c
-#
-#$(LIBS)
-#$(DEF_FILE) $(LFLAGS) ;
-#|
-# copy *.exe ..\bin
-#
-
-#
-# 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
-#
-#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
-#
-
-#
-# Borland C++ for OS/2
-#
-#CC=bcc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= c2 os2
-#
-#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
-# tlink @&&|
-#c02 $** -c
-#dlg.exe
-#
-#C2 os2
-#
-#|
-# copy *.exe ..\bin
-#
-
-#
-# UNIX
-#
-BIN_DIR=../../../../bin
-CC=cc
-COPT=-O
-ANTLR=$(BIN_DIR)/antlr.exe
-DLG=${BIN_DIR}/dlg.exe
-CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DZZLEXBUFSIZE=65536
-OBJ_EXT=o
-OUT_OBJ = -o
-OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
- relabel.o automata.o
-
-dlg : $(OBJ) $(SRC)
- $(CC) $(CFLAGS) -o $(BIN_DIR)/dlg.exe $(OBJ)
-
-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:
- rm -f *.$(OBJ_EXT) core
diff --git a/Tools/CCode/Source/Pccts/dlg/makefile1 b/Tools/CCode/Source/Pccts/dlg/makefile1 deleted file mode 100644 index 4d00f7966e..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/makefile1 +++ /dev/null @@ -1,63 +0,0 @@ -#
-# Makefile for DLG 1.33
-# Terence Parr
-# Purdue University, U of MN, Parr Research Corporation
-# 1989-1994
-#
-# Ported to IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-##
-## Uncomment the appropriate section to build
-##
-
-
-#
-# UNIX
-#
-CC=cc
-ANTLR=../bin/antlr
-DLG=../bin/dlg
-ANSI=-ansi
-CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) $(ANSI) -DZZLEXBUFSIZE=32000
-OBJ_EXT=o
-OUT_OBJ = -o
-OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
- relabel.o automata.o
-
-dlg : $(OBJ) $(SRC)
- $(CC) $(CFLAGS) -o dlg $(OBJ)
- mv dlg ../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:
- rm -f *.$(OBJ_EXT) core
diff --git a/Tools/CCode/Source/Pccts/dlg/mode.h b/Tools/CCode/Source/Pccts/dlg/mode.h deleted file mode 100644 index 3f3279e52a..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/mode.h +++ /dev/null @@ -1,4 +0,0 @@ -#define START 0
-#define ACT 1
-#define ACTION_COMMENTS 2
-#define ACTION_CPP_COMMENTS 3
diff --git a/Tools/CCode/Source/Pccts/dlg/output.c b/Tools/CCode/Source/Pccts/dlg/output.c deleted file mode 100644 index 2e56a6d8c1..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/output.c +++ /dev/null @@ -1,850 +0,0 @@ -/* output.c, output generator for dlg
- *
- * Output Notes:
- *
- * DfaStates == number of dfa nodes in automaton (just a #define)
- * DfaState == type large enough to index every node in automaton
- * <256 unsigned char, <65536 unsigned short, etc.
- *
- * Thus, the elements in each of the automaton states (st%d) are type DfaState
- * and are size appropriately, since they must be able to index the next
- * automaton state.
- *
- * dfa[] == a linear array that points to all the automaton states (st%d)
- * (dfa_base[] should be the same, but isn't right now)
- *
- * accepts[] == Taking a closer look at this one, it probably shouldn't be type
- * DfaState because there is no real requirement that the number of
- * accepts states is less than the number of dfa state. However, if
- * the number of accept states was more than the number of DFA states
- * then the lexical specification would be really ambiguous.
- *
- * Another note. Is that is should be possible to fold accepts[] and
- * actions[] together. If this is done, I would suggest get rid of
- * accept[] and make actions[] have an entry for each state (st%d) in
- * the automaton.
- *
- * dfa_base[] == starting location for each lexical mode. This should be
- * Dfastate type (but isn't right now), since it points to the states
- * in the automaton.
- *
- * dfa_class_no[] == indicates the number of columns each lexical mode has.
- *
- * b_class_no[] == pointer to the start of the translation array used to
- * convert from input character to character class. This could cause
- * problems if there are more than 256 classes
- *
- * shift%d[] == the actual translation arrays that convert the input character
- * into the character class. These will have to change if there are
- * more than 256 character classes.
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "dlg.h"
-#ifdef MEMCHK
-#include "trax.h"
-#else
-#ifdef __STDC__
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif /* __STDC__ */
-#endif
-
-static char *mode_name[MAX_MODES];
-static int mode_number[MAX_MODES];
-static int cur_mode=0;
-
-int operation_no = 0; /* used to mark nodes so that infinite loops avoided */
-int dfa_basep[MAX_MODES]; /* start of each group of states */
-int dfa_class_nop[MAX_MODES]; /* number of elements in each group of states*/
-
-int gen_ansi = FALSE; /* allows ansi code to be generated */
-
-FILE *input_stream; /* where to read description from */
-FILE *output_stream; /* where to put the output */
-FILE *mode_stream; /* where to put the mode.h stuff */
-FILE *class_stream; /* where to put the scan.h stuff (if gen_cpp) */
-
-/* NOTE: This section is MACHINE DEPENDENT */
-#define DIF_SIZE 4
-#if defined(PC) && !defined(PC32)
-unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffful, 0x7ffffffful }; /* MR20 */
-char t0[] = "unsigned char";
-char t1[] = "unsigned short";
-char t2[] = "unsigned int";
-char t3[] = "unsigned long";
-char *typevar[DIF_SIZE] = { t0, t1, t2, t3};
-#else
-unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffffffful, 0x7ffffffful }; /* MR20 */
-char t0[] = "unsigned char";
-char t1[] = "unsigned short";
-char t2[] = "unsigned int";
-char t3[] = "unsigned long";
-char *typevar[DIF_SIZE] = { t0, t1, t2, t3};
-#endif
-
-/* Added by TJP August 1994 */
-/* Take in MyLexer and return MyLexer_h */
-
-static char *
-#ifdef __USE_PROTOS
-gate_symbol(char *name)
-#else
-gate_symbol(name)
-char *name;
-#endif
-{
- static char buf[100];
- sprintf(buf, "%s_h", name);
- return buf;
-}
-
-/* Added by TJP August 1994 */
-static char *
-#ifdef __USE_PROTOS
-mystrdup(char *s)
-#else
-mystrdup(s)
-char *s;
-#endif
-{
- char *p = (char *)malloc(strlen(s)+1);
- strcpy(p, s);
- return p;
-}
-
-#ifdef __USE_PROTOS
-void p_class_hdr(void)
-#else
-void p_class_hdr()
-#endif
-{
- if ( class_stream == NULL ) return;
- fprintf(class_stream, "#ifndef %s\n", gate_symbol(ClassName("")));
- fprintf(class_stream, "#define %s\n", gate_symbol(ClassName("")));
- fprintf(class_stream, "/*\n");
- fprintf(class_stream, " * D L G L e x e r C l a s s D e f i n i t i o n\n");
- fprintf(class_stream, " *\n");
- fprintf(class_stream, " * Generated from:");
- fprintf(class_stream, " %s", file_str[0]);
- fprintf(class_stream, "\n");
- fprintf(class_stream, " *\n");
- fprintf(class_stream, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n");
- fprintf(class_stream, " * Purdue University Electrical Engineering\n");
- fprintf(class_stream, " * DLG Version %s\n", version);
- fprintf(class_stream, " */\n\n");
- fprintf(class_stream, "\n");
- fprintf(class_stream, "#include \"%s\"\n", DLEXERBASE_H);
-}
-
-/* MR1 */
-/* MR1 16-Apr-97 Split printing of class header up into several parts */
-/* MR1 so that #lexprefix <<...>>and #lexmember <<...>> */
-/* MR1 can be inserted in the appropriate spots */
-/* MR1 */
-
-#ifdef __USE_PROTOS
-void p_class_def1(void)
-#else
-void p_class_def1()
-#endif
-{
- if ( class_stream == NULL ) return;
- fprintf(class_stream, "\nclass %s : public DLGLexerBase {\n", ClassName(""));
- fprintf(class_stream, "public:\n");
-}
-
-#ifdef __USE_PROTOS
-void p_class_def2(void)
-#else
-void p_class_def2()
-#endif
-{
- int i, m;
- if ( class_stream == NULL ) return;
- fprintf(class_stream, "public:\n");
- fprintf(class_stream, "\tstatic const int MAX_MODE;\n");
- fprintf(class_stream, "\tstatic const int DfaStates;\n");
- for (i=0; i<cur_mode; i++) {
- fprintf(class_stream, "\tstatic const int %s;\n", mode_name[i]);
- }
-
- fprintf(class_stream, "\ttypedef %s DfaState;\n\n", minsize(dfa_allocated));
- fprintf(class_stream, "\t%s(DLGInputStream *in,\n",ClassName(""));
- fprintf(class_stream, "\t\tunsigned bufsize=2000)\n");
- fprintf(class_stream, "\t\t: DLGLexerBase(in, bufsize, %d)\n", interactive);
- fprintf(class_stream, "\t{\n");
- fprintf(class_stream, "\t;\n");
- fprintf(class_stream, "\t}\n");
- fprintf(class_stream, "\tvoid mode(int);\n");
- fprintf(class_stream, "\tANTLRTokenType nextTokenType(void);\n");
- fprintf(class_stream, "\tvoid advance(void);\n");
- fprintf(class_stream, "protected:\n");
- for (i=1; i<=action_no; ++i) {
- fprintf(class_stream, "\tANTLRTokenType act%d();\n", i);
- }
-
- for(m=0; m<(mode_counter-1); ++m){
- for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i)
- fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1);
- }
- for(i=dfa_basep[m]; i<=dfa_allocated; ++i)
- fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1);
-
- fprintf(class_stream, "\tstatic DfaState *dfa[%d];\n", dfa_allocated);
- fprintf(class_stream, "\tstatic DfaState dfa_base[];\n");
-/* fprintf(class_stream, "\tstatic int dfa_base_no[];\n"); */
- fprintf(class_stream, "\tstatic unsigned char *b_class_no[];\n");
- fprintf(class_stream, "\tstatic DfaState accepts[%d];\n",dfa_allocated+1);
- fprintf(class_stream, "\tstatic DLGChar alternatives[%d];\n",dfa_allocated+1);
- /* WARNING: should be ANTLRTokenType for action table, but g++ 2.5.6 is hosed */
- fprintf(class_stream, "\tstatic ANTLRTokenType (%s::*actions[%d])();\n", ClassName(""), action_no+1);
- for(m=0; m<mode_counter; ++m) {
- fprintf(class_stream, "\tstatic unsigned char shift%d[%d];\n",
- m, CHAR_RANGE);
- }
- if (comp_level)
- fprintf(class_stream, "\tint ZZSHIFT(int c) { return b_class_no[automaton][1+c]; }\n");
- else
- fprintf(class_stream, "\tint ZZSHIFT(int c) { return 1+c; }\n");
-
-/* MR1 */
-/* MR1 11-APr-97 Kludge to allow inclusion of user-defined code in */
-/* MR1 DLGLexer class header */
-/* MR1 Deprecated in favor of 133MR1 addition #lexmember <<>> */
-/* MR1 */
-/* MR1 */ fprintf(class_stream,"//\n");
-/* MR1 */ fprintf(class_stream,
-/* MR1 */ "// 133MR1 Deprecated feature to allow inclusion of ");
-/* MR1 */ fprintf(class_stream,
-/* MR1 */ "user-defined code in DLG class header\n");
-/* MR1 */ fprintf(class_stream,"//\n");
-/* MR1 */
-/* MR1 */ fprintf(class_stream,"#ifdef DLGLexerIncludeFile\n");
-/* MR1 */ fprintf(class_stream,"#include DLGLexerIncludeFile\n");
-/* MR1 */ fprintf(class_stream,"#endif\n");
-
- fprintf(class_stream, "};\n");
-
- fprintf(class_stream, "typedef ANTLRTokenType (%s::*Ptr%sMemberFunc)();\n",
- ClassName(""), ClassName(""));
-
- fprintf(class_stream, "#endif\n");
-}
-
-/* generate required header on output */
-
-#ifdef __USE_PROTOS
-void p_head(void)
-#else
-void p_head()
-#endif
-{
- fprintf(OUT, "/*\n");
- fprintf(OUT, " * D L G tables\n");
- fprintf(OUT, " *\n");
- fprintf(OUT, " * Generated from:");
- fprintf(OUT, " %s", file_str[0]);
- fprintf(OUT, "\n");
- fprintf(OUT, " *\n");
- fprintf(OUT, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n");
- fprintf(OUT, " * Purdue University Electrical Engineering\n");
- fprintf(OUT, " * DLG Version %s\n", version);
- fprintf(OUT, " */\n\n");
- if ( gen_cpp) fprintf(OUT, "#include \"pcctscfg.h\"\n");
- if ( gen_cpp ) fprintf(OUT, "#include \"pccts_stdio.h\"\n");
- if ( !gen_cpp ) fprintf(OUT, "#include \"%s\"\n\n", mode_file);
- fprintf(OUT,"\n");
-}
-
-#ifdef __USE_PROTOS
-void p_includes(void)
-#else
-void p_includes()
-#endif
-{
- fprintf(OUT, "#include \"%s\"\n", APARSER_H);
- fprintf(OUT, "#include \"%s\"\n", DLEXERBASE_H);
- fprintf(OUT, "#include \"%s\"\n", ClassName(".h"));
-}
-
-/* generate code to tie up any loose ends */
-
-#ifdef __USE_PROTOS
-void p_tail(void) /* MR1 */
-#else
-void p_tail() /* MR1 */
-#endif
-{
- if ( gen_cpp ) {
- if ( strcmp(ClassName(""), DEFAULT_CLASSNAME)!=0 )
- fprintf(OUT, "#define DLGLexer %s\n", ClassName(""));
- fprintf(OUT, "#include \"%s\"\n", DLEXER_H); /* MR23 Rename DLexer.cpp to DLexer.h */
- return;
- }
- fprintf(OUT, "\n");
- fprintf(OUT, "\n");
- if (comp_level)
- fprintf(OUT, "#define ZZSHIFT(c) (b_class_no[zzauto][1+c])\n");
- else
- fprintf(OUT, "#define ZZSHIFT(c) (1+c)\n");
- if ( !gen_cpp ) fprintf(OUT, "#define MAX_MODE %d\n",mode_counter);
- fprintf(OUT, "#include \"dlgauto.h\"\n");
-}
-
-
-/* output the table of DFA for general use */
-
-#ifdef __USE_PROTOS
-void p_tables()
-#else
-void p_tables()
-#endif
-{
- if ( !gen_cpp ) {
- fprintf(OUT, "#define DfaStates\t%d\n", dfa_allocated);
- fprintf(OUT, "typedef %s DfaState;\n\n", minsize(dfa_allocated));
- }
-
- if ( gen_cpp ) {
- int i;
- fprintf(OUT, "\n");
- fprintf(OUT, "const int %s::MAX_MODE=%d;\n",
- ClassName(""),
- mode_counter);
- fprintf(OUT, "const int %s::DfaStates=%d;\n",
- ClassName(""),
- dfa_allocated);
- for (i=0; i<cur_mode; i++) {
- fprintf(OUT, "const int %s::%s=%d;\n",
- ClassName(""), mode_name[i], mode_number[i]);
- }
- fprintf(OUT, "\n");
- }
-
- p_node_table();
- p_dfa_table();
- p_accept_table();
- p_action_table();
- p_base_table();
- p_class_table();
- if (comp_level)
- p_bshift_table();
- if (interactive || gen_cpp )
- p_alternative_table();
-}
-
-
-/* figures out the smallest variable type that will hold the transitions
- */
-
-#ifdef __USE_PROTOS
-char *minsize(int elements)
-#else
-char *minsize(elements)
-int elements;
-#endif
-{
- int i = 0;
-
- while ((unsigned long) elements > typesize[i]) /* MR20 */
- ++i;
- return typevar[i];
-}
-
-
-#ifdef __USE_PROTOS
-void p_node_table(void)
-#else
-void p_node_table()
-#endif
-{
- register int i;
- register int m = 0;
-
- for(m=0; m<(mode_counter-1); ++m){
- for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i)
- p_single_node(i,dfa_class_nop[m]);
- }
- for(i=dfa_basep[m]; i<=dfa_allocated; ++i)
- p_single_node(i,dfa_class_nop[m]);
-}
-
-
-#ifdef __USE_PROTOS
-void p_single_node(int i,int classes)
-#else
-void p_single_node(i,classes)
-int i,classes;
-#endif
-{
- register int j;
- register int trans, items_on_line;
-
-#if 1
- /* extra state (classes+1) for invalid characters */
- fprintf(OUT, "%sDfaState %sst%d[%d] = {\n ",
- gen_cpp?ClassName("::"):"static ",
- gen_cpp?ClassName("::"):"",(i-1), (classes+1));
-#else
- fprintf(OUT, "static DfaState st%d[%d] = {\n ", (i-1), classes);
-#endif
- items_on_line = MAX_ON_LINE;
- for(j=0; j<classes; ++j){
- DAWDLE;
- trans = DFA(i)->trans[j];
- if (trans == NIL_INDEX)
- trans = dfa_allocated+1;
- /* all of DFA moved down one in array */
- fprintf(OUT, "%d", trans-1);
- fprintf(OUT, ", ");
- if (!(--items_on_line)){
- fprintf(OUT, "\n ");
- items_on_line = MAX_ON_LINE;
- }
- }
-#if 1
- /* put in jump to error state */
- fprintf(OUT, "%d\n};\n\n", dfa_allocated);
-#else
- fprintf(OUT, "\n};\n\n");
-#endif
-}
-
-
-#ifdef __USE_PROTOS
-void p_dfa_table(void)
-#else
-void p_dfa_table()
-#endif
-{
- register int i;
-
- fprintf(OUT, "\n%sDfaState *%sdfa[%d] = {\n",
- gen_cpp?ClassName("::"):"",gen_cpp?ClassName("::"):"", dfa_allocated);
- for (i=0; i<(dfa_allocated-1); ++i){
- fprintf(OUT, "\tst%d,\n", i);
- }
- fprintf(OUT, "\tst%d\n", i);
- fprintf(OUT, "};\n\n");
-}
-
-
-#ifdef __USE_PROTOS
-void p_accept_table(void)
-#else
-void p_accept_table()
-#endif
-{
- register int i = 1;
- register int items_on_line = 0;
- int true_interactive = TRUE;
-
- /* make sure element for one past (zzerraction) -WEC 12/16/92 */
- fprintf(OUT,"\n%sDfaState %saccepts[%d] = {\n ",
- gen_cpp?ClassName("::"):"",
- gen_cpp?ClassName("::"):"",
- dfa_allocated+1);
- /* don't do anything if no dfa nodes */
- if (i>dfa_allocated) goto skip_accepts;
- for (;;) {
- int accept=0; /* MR14a - Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de) */
- set accept_set;
- set nfa_states;
- unsigned int *t, *nfa_i;
- unsigned int *q, *regular_expr;
-
- accept_set = empty;
- nfa_states = DFA(i)->nfa_states;
- t = nfa_i = set_pdq(nfa_states);
- /* NOTE: picks lowest accept because accepts monotonic */
- /* with respect to nfa node numbers and set_pdq */
- /* returns in that order */
- while((*nfa_i != nil) && (!(accept = NFA(*nfa_i)->accept))){
- nfa_i++;
- }
-
- /* figure out if more than one accept state there */
- if (warn_ambig ){
- set_orel(accept, &accept_set);
- while(*nfa_i != nil){
- set_orel(NFA(*nfa_i)->accept, &accept_set);
- nfa_i++;
- }
- /* remove error action from consideration */
- set_rm(0, accept_set);
-
- if( set_deg(accept_set)>1){
- fprintf(stderr, "dlg warning: ambiguous regular expression ");
- q = regular_expr = set_pdq(accept_set);
- while(*regular_expr != nil){
- fprintf(stderr," %d ", *regular_expr);
- ++regular_expr;
- }
- fprintf(stderr, "\n");
- free(q);
- }
- }
-
- if ((DFA(i)->alternatives) && (accept != 0)){
- true_interactive = FALSE;
- }
- fprintf(OUT, "%d, ", accept);
-
- /* free up memory before we "break" below -ATG 4/6/95 */
- free(t);
- set_free(accept_set);
-
- if ((++i)>dfa_allocated)
- break;
- if ((++items_on_line)>=MAX_ON_LINE){
- fprintf(OUT,"\n ");
- items_on_line = 0;
- }
-/*
- free(t);
- set_free(accept_set);
-*/
- }
- /* make sure element for one past (zzerraction) -WEC 12/16/92 */
-skip_accepts:
- fprintf(OUT, "0\n};\n\n");
-}
-
-
-#ifdef __USE_PROTOS
-void p_action_table(void)
-#else
-void p_action_table()
-#endif
-{
- register int i;
- char* theClassName = ClassName("");
-
- if ( gen_cpp )
- fprintf(OUT, "Ptr%sMemberFunc %s::actions[%d] = {\n", theClassName,
- theClassName, action_no+1);
- else
- fprintf(OUT, "void (*actions[%d])() = {\n", action_no+1);
- if ( gen_cpp )
-/* fprintf(OUT, "\t(Ptr%sMemberFunc)&%s::erraction,\n", theClassName, theClassName);*/
- fprintf(OUT, "\t&%s::erraction,\n", theClassName);
- else
- fprintf(OUT, "\tzzerraction,\n");
- for (i=1; i<action_no; ++i) {
- if ( gen_cpp )
-/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d,\n", theClassName, theClassName, i);*/
- fprintf(OUT,"\t&%s::act%d,\n", theClassName, i);
- else
- fprintf(OUT,"\tact%d,\n", i);
- DAWDLE;
- }
- if ( gen_cpp )
-/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d\n", theClassName, theClassName, i);*/
- fprintf(OUT,"\t&%s::act%d\n", theClassName, i);
- else
- fprintf(OUT,"\tact%d\n", i);
- fprintf(OUT, "};\n\n");
-}
-
-
-#ifdef __USE_PROTOS
-void p_shift_table(int m) /* MR1 */
-#else
-void p_shift_table(m) /* MR1 */
-int m;
-#endif
-{
- register int i = 0, j;
- register int items_on_line = 0;
-
- fprintf(OUT, "%s unsigned char %sshift%d[%d] = {\n ",
- gen_cpp?"":"static",
- gen_cpp?ClassName("::"):"", m, CHAR_RANGE);
- for (;;) {
- /* find which partition character i is in */
- for (j=0; j<dfa_class_nop[mode_counter]; ++j){
- if (set_el(i,class_sets[j]))
- break;
- }
- fprintf(OUT,"%d",j);
- if ((++i)>=CHAR_RANGE)
- break;
- fprintf(OUT,", ");
- if ((++items_on_line)>=MAX_ON_LINE){
- fprintf(OUT,"\n ");
- items_on_line = 0;
- }
- }
- fprintf(OUT, "\n};\n\n");
-}
-
-
-#ifdef __USE_PROTOS
-void p_base_table(void)
-#else
-void p_base_table()
-#endif
-{
- register int m;
-
- fprintf(OUT, "%sDfaState %sdfa_base[] = {\n",
- gen_cpp?ClassName("::"):"static ",
- gen_cpp?ClassName("::"):"");
- for(m=0; m<(mode_counter-1); ++m)
- fprintf(OUT, "\t%d,\n", dfa_basep[m]-1);
- fprintf(OUT, "\t%d\n};\n\n", dfa_basep[m]-1);
-}
-
-
-#ifdef __USE_PROTOS
-void p_class_table(void) /* MR1 */
-#else
-void p_class_table() /* MR1 */
-#endif
-{
-#if 0
- register int m;
-
- fprintf(OUT,"%s int %sdfa_class_no[] = {\n",
- gen_cpp?"":"static",
- gen_cpp?ClassName("::"):"");
- for(m=0; m<(mode_counter-1); ++m)
- fprintf(OUT,"\t%d,\n", dfa_class_nop[m]);
- fprintf(OUT,"\t%d\n};\n\n", dfa_class_nop[m]);
-#endif
-}
-
-
-#ifdef __USE_PROTOS
-void p_bshift_table(void) /* MR1 */
-#else
-void p_bshift_table() /* MR1 */
-#endif
-{
- register int m;
-
- fprintf(OUT,"%s unsigned char *%sb_class_no[] = {\n",
- gen_cpp?"":"static",
- gen_cpp?ClassName("::"):"");
- for(m=0; m<(mode_counter-1); ++m)
- fprintf(OUT, "\tshift%d,\n", m);
- fprintf(OUT, "\tshift%d\n};\n\n", m);
-}
-
-
-#ifdef __USE_PROTOS
-void p_alternative_table(void) /* MR1 */
-#else
-void p_alternative_table() /* MR1 */
-#endif
-{
- register int i;
-
- if ( !gen_cpp ) fprintf(OUT, "#define ZZINTERACTIVE\n\n");
- if ( gen_cpp )
- fprintf(OUT, "DLGChar %salternatives[%d] = {\n", /* mr23 vhs %sDfaStates+1 */
- ClassName("::"),
- dfa_allocated+1); /* vhs ClassName("::")); */
- else
- fprintf(OUT, "static %s zzalternatives[DfaStates+1] = {\n",
- minsize(dfa_allocated));
-
- for(i=1; i<=dfa_allocated; ++i)
- fprintf(OUT, "\t%d,\n", DFA(i)->alternatives);
- fprintf(OUT, "/* must have 0 for zzalternatives[DfaStates] */\n");
- fprintf(OUT, "\t0\n};\n\n");
-}
-
-
-#ifdef __USE_PROTOS
-void p_mode_def(char *s,int m) /* MR1 */
-#else
-void p_mode_def(s,m) /* MR1 */
-char *s;
-int m;
-#endif
-{
- if ( gen_cpp )
- {
- mode_name[cur_mode] = mystrdup(s);
- mode_number[cur_mode] = m;
- cur_mode++;
- }
- else
- fprintf(mode_stream, "#define %s %d\n", s, m);
-}
-
-#ifdef __USE_PROTOS
-char * ClassName(char *suffix)
-#else
-char * ClassName(suffix)
-char *suffix;
-#endif
-{
- static char buf[200];
- extern char *class_name;
-
- sprintf(buf, "%s%s", class_name, suffix);
- return buf;
-}
-
-#ifdef DEBUG
-
-/* print out a particular nfa node that is pointed to by p */
-
-#ifdef __USE_PROTOS
-void p_nfa_node(nfa_node *p)
-#else
-void p_nfa_node(p)
-nfa_node *p;
-#endif
-{
- register nfa_node *t;
-
- if (p != NIL_INDEX){
- printf("NFA state : %d\naccept state : %d\n",
- NFA_NO(p),p->accept);
- if (p->trans[0] != NIL_INDEX){
- printf("trans[0] => %d on ", NFA_NO(p->trans[0]));
- p_set(p->label);
- printf("\n");
- }
- else
- printf("trans[0] => nil\n");
- if (p->trans[1] != NIL_INDEX)
- printf("trans[1] => %d on epsilon\n",
- NFA_NO(p->trans[1]));
- else
- printf("trans[1] => nil\n");
- printf("\n");
- }
-}
-#endif
-
-#ifdef DEBUG
-
-/* code to print out special structures when using a debugger */
-
-#ifdef __USE_PROTOS
-void p_nfa(p)
-#else
-void p_nfa(nfa_node *p)
-nfa_node *p; /* state number also index into array */
-#endif
-{
-/* each node has a marker on it so it only gets printed once */
-
- operation_no++; /* get new number */
- s_p_nfa(p);
-}
-
-#ifdef __USE_PROTOS
-void s_p_nfa(nfa_node *p)
-#else
-void s_p_nfa(p)
-nfa_node *p; /* state number also index into array */
-#endif
-{
- if ((p != NIL_INDEX) && (p->nfa_set != operation_no)){
- /* so it is only printed once */
- p->nfa_set = operation_no;
- p_nfa_node(p);
- s_p_nfa(p->trans[0]);
- s_p_nfa(p->trans[1]);
- }
-}
-
-#ifdef __USE_PROTOS
-void p_dfa_node(dfa_node *p)
-#else
-void p_dfa_node(p)
-dfa_node *p;
-#endif
-{
- int i;
-
- if (p != NIL_INDEX){
- printf("DFA state :%d\n",NFA_NO(p));
- if (p->done)
- printf("done\n");
- else
- printf("undone\n");
- printf("from nfa states : ");
- p_set(p->nfa_states);
- printf("\n");
- /* NOTE: trans arcs stored as ints rather than pointer*/
- for (i=0; i<class_no; i++){
- printf("%d ",p->trans[i]);
- }
- printf("\n\n");
- }
-}
-
-#ifdef __USE_PROTOS
-void p_dfa(void)
-#else
-void p_dfa()
-#endif
-{
-/* prints out all the dfa nodes actually allocated */
-
- int i;
-
- for (i = 1; i<=dfa_allocated; i++)
- p_dfa_node(NFA(i));
-}
-
-
-/* print out numbers in the set label */
-
-#ifdef __USE_PROTOS
-void p_set(set label)
-#else
-void p_set(label)
-set label;
-#endif
-{
- unsigned *t, *e;
-
- if (set_nil(label)){
- printf("epsilon\n");
- }else{
- t = e = set_pdq(label);
- while(*e != nil){
- printf("%d ", (*e+MIN_CHAR));
- e++;
- }
- printf("\n");
- free(t);
- }
-
-}
-#endif
diff --git a/Tools/CCode/Source/Pccts/dlg/parser.dlg b/Tools/CCode/Source/Pccts/dlg/parser.dlg deleted file mode 100644 index df9a637f9e..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/parser.dlg +++ /dev/null @@ -1,398 +0,0 @@ -<<
-/* parser.dlg -- DLG Description of scanner
- *
- * Generated from: dlg_p.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include <ctype.h>
-#include "dlg.h"
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-LOOKAHEAD
-
-void
-#ifdef __USE_PROTOS
-zzerraction(void)
-#else
-zzerraction()
-#endif
-{
- (*zzerr)("invalid token");
- zzadvance();
- zzskip();
-}
->>
-
-<<%%lexaction
-
-int func_action; /* should actions be turned into functions?*/
-int lex_mode_counter = 0; /* keeps track of the number of %%names */
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via <<%%lexmember...>> */
-/* MR1 */
-int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
-int lexAction = 0; /* <<%%lexaction ...>> MR1 */
-int parserClass = 0; /* <<%%parserclass ...>> MR1 */
-int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
-char theClassName[100]; /* MR11 */
-char *pClassName=theClassName; /* MR11 */
-int firstLexMember=1; /* MR1 */
-
-#ifdef __USE_PROTOS
-void xxputc(int c) { /* MR1 */
-#else
- void xxputc(c) /* MR1 */
- int c; /* MR1 */
- { /* MR1 */
-#endif
- if (parserClass) { /* MR1 */
- *pClassName++=c; /* MR1 */
- *pClassName=0; /* MR1 */
- } else if (lexMember || lexPrefix) { /* MR1 */
- if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
- } else { /* MR1 */
- fputc(c,OUT); /* MR1 */
- }; /* MR1 */
- } /* MR1 */
-
-#ifdef __USE_PROTOS
- void xxprintf(char *format,char *string) { /* MR1 */
-#else
- void xxprintf(format,string) /* MR1 */
- char *format; /* MR1 */
- char *string; /* MR1 */
- { /* MR1 */
-#endif
- if (lexMember || lexPrefix || parserClass) { /* MR1 */
- if (class_stream != NULL) /* MR1 */
- fprintf(class_stream,format,string); /* MR1 */
- } else { /* MR1 */
- fprintf(OUT,format,string); /* MR1 */
- }; /* MR1 */
- } /* MR1 */
->>
-
-
-%%START
-
-@
- <<
- NLA = 1;
- >>
-
-[\r\t\ ]+
- <<
- NLA = 2;
- zzskip();
- >>
-
-\n
- <<
- NLA = 3;
- zzline++; zzskip(); DAWDLE;
- >>
-
-\@
- <<
- NLA = L_EOF;
- >>
-
-\%\%
- <<
- NLA = PER_PER;
- >>
-
-\%\%[a-zA-Z_][a-zA-Z0-9_]*
- <<
- NLA = NAME_PER_PER;
- p_mode_def(&zzlextext[2],lex_mode_counter++);
- >>
-
-\<\<\%\%lexmember
- <<
- NLA = LEXMEMBER;
- lexMember=1; /* MR1 */
- if (firstLexMember != 0) { /* MR1 */
- firstLexMember=0; /* MR1 */
- p_class_def1(); /* MR1 */
- }; /* MR1 */
- zzmode(ACT); /* MR1 */
- >>
-
-\<\<\%\%lexaction
- <<
- NLA = LEXACTION;
- lexAction=1;zzmode(ACT);
- >>
-
-\<\<\%\%parserclass
- <<
- NLA = PARSERCLASS;
- parserClass=1; /* MR1 */
- zzmode(ACT); /* MR1 */
- >>
-
-\<\<\%\%lexprefix
- <<
- NLA = LEXPREFIX;
- lexPrefix=1;zzmode(ACT);
- >>
-
-\<\<
- <<
- NLA = ACTION;
- if (func_action)
- fprintf(OUT,"\n%s %sact%d()\n{ ",
- gen_cpp?"ANTLRTokenType":"static void",
- gen_cpp?ClassName("::"):"", ++action_no);
- zzmode(ACT); zzskip();
- >>
-
-\>\>
- <<
- NLA = GREAT_GREAT;
- >>
-
-\{
- <<
- NLA = L_BRACE;
- >>
-
-\}
- <<
- NLA = R_BRACE;
- >>
-
-\(
- <<
- NLA = L_PAR;
- >>
-
-\)
- <<
- NLA = R_PAR;
- >>
-
-\[
- <<
- NLA = L_BRACK;
- >>
-
-\]
- <<
- NLA = R_BRACK;
- >>
-
-\*
- <<
- NLA = ZERO_MORE;
- >>
-
-\+
- <<
- NLA = ONE_MORE;
- >>
-
-\|
- <<
- NLA = OR;
- >>
-
-\-
- <<
- NLA = RANGE;
- >>
-
-\~
- <<
- NLA = NOT;
- >>
-
-\\0[0-7]*
- <<
- NLA = OCTAL_VALUE;
- {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}
- >>
-
-\\0[Xx][0-9a-fA-F]+
- <<
- NLA = HEX_VALUE;
- {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}
- >>
-
-\\[1-9][0-9]*
- <<
- NLA = DEC_VALUE;
- {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}
- >>
-
-\\t
- <<
- NLA = TAB;
- zzlextext[0] = '\t';
- >>
-
-\\n
- <<
- NLA = NL;
- zzlextext[0] = '\n';
- >>
-
-\\r
- <<
- NLA = CR;
- zzlextext[0] = '\r';
- >>
-
-\\b
- <<
- NLA = BS;
- zzlextext[0] = '\b';
- >>
-
-\\ \n
- <<
- NLA = CONTINUATION;
- zzline++; zzskip();
- >>
-
-\\~[tnrb]
- <<
- NLA = LIT;
- zzlextext[0] = zzlextext[1];
- >>
-
-~[\\]
- <<
- NLA = REGCHAR;
- >>
-
-
-%%ACT
-
-@
- <<
- NLA = 1;
- error("unterminated action", zzline); zzmode(START);
- >>
-
-\>\>
- <<
- NLA = ACTION;
- if (func_action) fprintf(OUT,"}\n\n");
- zzmode(START);
- /* MR1 */
- /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
- /* MR1 via <<%%lexmember ...>> */
- /* MR1 This is a consequence of not saving actions */
- /* MR1 */
- /* MR1 */ parserClass=0;
- /* MR1 */ lexPrefix=0;
- /* MR1 */ lexAction=0;
- /* MR1 */ lexMember=0;
- >>
-
-\>
- <<
- NLA = 34;
- xxputc(zzlextext[0]); zzskip();
- >>
-
-\\\>
- <<
- NLA = 35;
- xxputc('>'); zzskip();
- >>
-
-\\
- <<
- NLA = 36;
- xxputc('\\'); zzskip();
- >>
-
-\n
- <<
- NLA = 37;
- xxputc(zzlextext[0]); ++zzline; zzskip();
- >>
-
-/\*
- <<
- NLA = 38;
- zzmode(ACTION_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >>
-
-//
- <<
- NLA = 39;
- zzmode(ACTION_CPP_COMMENTS); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >>
-
-~[]
- <<
- NLA = 40;
- xxputc(zzlextext[0]); zzskip();
- >>
-
-
-%%ACTION_COMMENTS
-
-@
- <<
- NLA = 1;
- >>
-
-\*/
- <<
- NLA = 41;
- zzmode(ACT); /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >>
-
-[\n\r]
- <<
- NLA = 42;
- zzline++; xxputc(zzlextext[0]); zzskip();
- >>
-
-~[]
- <<
- NLA = 43;
- xxputc(zzlextext[0]); zzskip();
- >>
-
-
-%%ACTION_CPP_COMMENTS
-
-@
- <<
- NLA = 1;
- >>
-
-[\n\r]
- <<
- NLA = 44;
- zzmode(ACT); zzline++; /* MR1 */
- xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
- >>
-
-~[]
- <<
- NLA = 45;
- xxputc(zzlextext[0]); zzskip();
- >>
-
-%%
diff --git a/Tools/CCode/Source/Pccts/dlg/relabel.c b/Tools/CCode/Source/Pccts/dlg/relabel.c deleted file mode 100644 index 0b8bc163d1..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/relabel.c +++ /dev/null @@ -1,217 +0,0 @@ -/* This group of functions does the character class compression.
- It goes over the dfa and relabels the arcs with the partitions
- of characters in the NFA. The partitions are stored in the
- array class.
-
- *
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "dlg.h"
-#ifdef MEMCHK
-#include "trax.h"
-#else
-#ifdef __STDC__
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif /* __STDC__ */
-#endif
-
-int class_no = CHAR_RANGE; /* number of classes for labels */
-int first_el[CHAR_RANGE]; /* first element in each class partition */
-set class_sets[CHAR_RANGE]; /* array holds partitions from class */
- /* compression */
-
-/* goes through labels on NFA graph and partitions the characters into
- * character classes. This reduces the amount of space required for each
- * dfa node, since only one arc is required each class instead of one arc
- * for each character
- * level:
- * 0 no compression done
- * 1 remove unused characters from classes
- * 2 compress equivalent characters into same class
- *
- * returns the number of character classes required
- */
-#ifdef __USE_PROTOS
-int relabel(nfa_node* start,int level)
-#else
-int relabel(start,level)
-int level;
-nfa_node *start;
-#endif
-{
- if (level){
- set_free(used_classes);
- partition(start,level);
- label_with_classes(start);
- }else{
- /* classes equivalent to all characters in alphabet */
- class_no = CHAR_RANGE;
- }
- return class_no;
-}
-
-/* makes character class sets for new labels */
-#ifdef __USE_PROTOS
-void partition(nfa_node* start,int level)
-#else
-void partition(start,level)
-nfa_node *start; /* beginning of nfa graph */
-int level; /* compression level to uses */
-#endif
-{
- set current_class;
- set unpart_chars;
- set temp;
-
- unpart_chars = set_dup(used_chars);
-#if 0
- /* EOF (-1+1) alway in class 0 */
- class_sets[0] = set_of(0);
- first_el[0] = 0;
- used_classes = set_of(0);
- temp = set_dif(unpart_chars, class_sets[0]);
- set_free(unpart_chars);
- unpart_chars = temp;
- class_no = 1;
-#else
- class_no = 0;
-#endif
- while (!set_nil(unpart_chars)){
- /* don't look for equivalent labels if c <= 1 */
- if (level <= 1){
- current_class = set_of(set_int(unpart_chars));
- }else{
- current_class = set_dup(unpart_chars);
- intersect_nfa_labels(start,¤t_class);
- }
- set_orel(class_no,&used_classes);
- first_el[class_no] = set_int(current_class);
- class_sets[class_no] = current_class;
- temp = set_dif(unpart_chars,current_class);
- set_free(unpart_chars);
- unpart_chars = temp;
- ++class_no;
- }
-
- /* free unpart_chars -ATG 5/6/95 */
- set_free(unpart_chars);
-
-#if 0
- /* group all the other unused characters into a class */
- set_orel(class_no,&used_classes);
- first_el[class_no] = set_int(current_class);
- class_sets[class_no] = set_dif(normal_chars,used_chars);
- ++class_no;
-#endif
-}
-
-
-/* given pointer to beginning of graph and recursively walks it trying
- * to find a maximal partition. This partion in returned in maximal_class
- */
-#ifdef __USE_PROTOS
-void intersect_nfa_labels(nfa_node* start,set* maximal_class)
-#else
-void intersect_nfa_labels(start,maximal_class)
-nfa_node *start;
-set *maximal_class;
-#endif
-{
- /* pick a new operation number */
- ++operation_no;
- r_intersect(start,maximal_class);
-}
-
-#ifdef __USE_PROTOS
-void r_intersect(nfa_node* start,set* maximal_class)
-#else
-void r_intersect(start,maximal_class)
-nfa_node *start;
-set * maximal_class;
-#endif
-{
- set temp;
-
- if(start && start->nfa_set != operation_no)
- {
- start->nfa_set = operation_no;
- temp = set_and(*maximal_class,start->label);
- if (!set_nil(temp))
- {
- set_free(*maximal_class);
- *maximal_class = temp;
- }else{
- set_free(temp);
- }
- r_intersect(start->trans[0],maximal_class);
- r_intersect(start->trans[1],maximal_class);
- }
-}
-
-
-/* puts class labels in place of old character labels */
-#ifdef __USE_PROTOS
-void label_with_classes(nfa_node* start)
-#else
-void label_with_classes(start)
-nfa_node *start;
-#endif
-{
- ++operation_no;
- label_node(start);
-}
-
-#ifdef __USE_PROTOS
-void label_node(nfa_node *start)
-#else
-void label_node(start)
-nfa_node *start;
-#endif
-{
- set new_label;
- register int i;
-
- /* only do node if it hasn't been done before */
- if (start && start->nfa_set != operation_no){
- start->nfa_set = operation_no;
- new_label = empty;
- for (i = 0; i<class_no; ++i){
- /* if one element of class in old_label,
- all elements are. */
- if (set_el(first_el[i],start->label))
- set_orel(i,&new_label);
- }
- set_free(start->label);
- start->label = new_label;
- /* do any nodes that can be reached from this one */
- label_node(start->trans[0]);
- label_node(start->trans[1]);
- }
-}
diff --git a/Tools/CCode/Source/Pccts/dlg/stdpccts.h b/Tools/CCode/Source/Pccts/dlg/stdpccts.h deleted file mode 100644 index 06ec67e44d..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/stdpccts.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef STDPCCTS_H
-#define STDPCCTS_H
-/*
- * stdpccts.h -- P C C T S I n c l u d e
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#ifndef ANTLR_VERSION
-#define ANTLR_VERSION 13333
-#endif
-
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include <ctype.h>
-#include "dlg.h"
-#define zzSET_SIZE 8
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "mode.h"
-#endif
diff --git a/Tools/CCode/Source/Pccts/dlg/support.c b/Tools/CCode/Source/Pccts/dlg/support.c deleted file mode 100644 index 84fe99d69c..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/support.c +++ /dev/null @@ -1,240 +0,0 @@ -/*
- * 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.
- *
- * DLG 1.33
- * Will Cohen
- * With mods by Terence Parr; AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "dlg.h"
-#ifdef MEMCHK
-#include "trax.h"
-#else
-#ifdef __STDC__
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif /* __STDC__ */
-#endif
-
-int err_found = 0; /* indicates whether problem found */
-
-#ifdef __USE_PROTOS
-void internal_error(char *s, char *file,int line) /* MR9 23-Sep-97 */
-#else
-void internal_error(s,file,line) /* MR9 23-Sep-97 */
-char *s,*file;
-int line;
-#endif
-{
- fprintf(stderr,s,file,line);
- exit(PCCTS_EXIT_FAILURE);
-}
-
-#ifdef __USE_PROTOS
-char *dlg_malloc(int bytes,char *file,int line)
-#else
-char *dlg_malloc(bytes,file,line)
-int bytes;
-char *file;
-int line;
-#endif
-{
- char *t;
-
- t = (char *) malloc(bytes);
- if (!t){
- /* error */
- internal_error("%s(%d): unable to allocate memory\n",
- file,line);
- }
- return t;
-}
-
-
-#ifdef __USE_PROTOS
-char *dlg_calloc(int n,int bytes,char *file,int line)
-#else
-char *dlg_calloc(n,bytes,file,line)
-int n,bytes;
-char *file;
-int line;
-#endif
-{
- char *t;
-
- t = (char *) calloc(n,bytes);
- if (!t){
- /* error */
- internal_error("%s(%d): unable to allocate memory\n",
- file,line);
- }
- return t;
-}
-
-
-#ifdef __USE_PROTOS
-FILE *read_stream(char *name)
-#else
-FILE *read_stream(name)
-char *name;
-#endif
-{
- FILE *f;
-
- if (name){
- if (name[0] == '-') {
- fprintf(stderr, "dlg: invalid option: '%s'\n", name);
- f = NULL;
- }else{
- f = fopen(name, "r");
- if (f == NULL){
- /* couldn't open file */
- fprintf(stderr,
- "dlg: Warning: Can't read file %s.\n",
- name);
- }
- }
- }else{
- /* open stdin if nothing there */
- f = stdin;
- }
- return f;
-}
-
-#ifdef __USE_PROTOS
-FILE *write_stream(char *name)
-#else
-FILE *write_stream(name)
-char *name;
-#endif
-{
- FILE *f;
-
- if (name){
- if (name[0] == '-') {
- fprintf(stderr, "dlg: invalid option: '%s'\n", name);
- f = NULL;
- }else{
- f = fopen(OutMetaName(name), "w");
- if (f == NULL){
- /* couldn't open file */
- fprintf(stderr,
- "dlg: Warning: Can't write to file %s.\n",
- name);
- }
- else
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(name)); /* MR1 */
-#else
- ; /* MR1 */
-#endif
- }
- }else{
- /* open stdout if nothing there */
- f = stdout;
- }
- return f;
-}
-
-
-#ifdef __USE_PROTOS
-void fatal(char *message,int line_no)
-#else
-void fatal(message,line_no)
-char *message;
-int line_no;
-#endif
-{
- fprintf(stderr,ErrHdr,
- (file_str[0] ? file_str[0] : "stdin"), line_no);
- fprintf(stderr, " Fatal: %s\n", message);
- exit(PCCTS_EXIT_FAILURE);
-}
-
-#ifdef __USE_PROTOS
-void error(char *message,int line_no)
-#else
-void error(message,line_no)
-char *message;
-int line_no;
-#endif
-{
- fprintf(stderr,ErrHdr,
- (file_str[0] ? file_str[0] : "stdin"), line_no);
- fprintf(stderr, " Error: %s\n", message);
- err_found = 1;
-}
-
-#ifdef __USE_PROTOS
-void warning(char *message,int line_no)
-#else
-void warning(message,line_no)
-char *message;
-int line_no;
-#endif
-{
- fprintf(stderr,ErrHdr,
- (file_str[0] ? file_str[0] : "stdin"), line_no);
- fprintf(stderr, " Warning: %s\n", message);
-}
-
-/* MR10: Jeff Vincent
- MR10: Changed to remove directory information from n only if
- MR10: if OutputDirectory was changed by user (-o option)
-*/
-
-#ifdef __USE_PROTOS
-char *OutMetaName(char *n)
-#else
-char *OutMetaName(n)
-char *n;
-#endif
-{
- static char *dir_sym = DirectorySymbol;
- static char newname[MaxFileName+1];
- char *p;
-
- /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */
- if (strcmp(OutputDirectory, TopDirectory) == 0)
- return n;
-
- /* p will point to filename without path information */
- if ((p = strrchr(n, *dir_sym)) != NULL)
- p++;
- else
- p = n;
-
- /* Copy new output directory into newname[] */
- strcpy(newname, OutputDirectory);
-
- /* if new output directory does not have trailing dir_sym, add it! */
- if (newname[strlen(newname)-1] != *dir_sym)
- strcat(newname, dir_sym);
-
- /* contatenate FILE NAME ONLY to new output directory */
- strcat(newname, p);
-
- return newname;
-}
diff --git a/Tools/CCode/Source/Pccts/dlg/tokens.h b/Tools/CCode/Source/Pccts/dlg/tokens.h deleted file mode 100644 index 73e502b7e1..0000000000 --- a/Tools/CCode/Source/Pccts/dlg/tokens.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef tokens_h
-#define tokens_h
-/* tokens.h -- List of labelled tokens and stuff
- *
- * Generated from: dlg_p.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * ANTLR Version 1.33MR33
- */
-#define zzEOF_TOKEN 1
-#define L_EOF 4
-#define PER_PER 5
-#define NAME_PER_PER 6
-#define LEXMEMBER 7
-#define LEXACTION 8
-#define PARSERCLASS 9
-#define LEXPREFIX 10
-#define ACTION 11
-#define GREAT_GREAT 12
-#define L_BRACE 13
-#define R_BRACE 14
-#define L_PAR 15
-#define R_PAR 16
-#define L_BRACK 17
-#define R_BRACK 18
-#define ZERO_MORE 19
-#define ONE_MORE 20
-#define OR 21
-#define RANGE 22
-#define NOT 23
-#define OCTAL_VALUE 24
-#define HEX_VALUE 25
-#define DEC_VALUE 26
-#define TAB 27
-#define NL 28
-#define CR 29
-#define BS 30
-#define CONTINUATION 31
-#define LIT 32
-#define REGCHAR 33
-
-#ifdef __USE_PROTOS
-void grammar(void);
-#else
-extern void grammar();
-#endif
-
-#ifdef __USE_PROTOS
-void start_states(void);
-#else
-extern void start_states();
-#endif
-
-#ifdef __USE_PROTOS
-void do_conversion(void);
-#else
-extern void do_conversion();
-#endif
-
-#ifdef __USE_PROTOS
-void rule_list(void);
-#else
-extern void rule_list();
-#endif
-
-#ifdef __USE_PROTOS
-void rule(void);
-#else
-extern void rule();
-#endif
-
-#ifdef __USE_PROTOS
-void reg_expr(void);
-#else
-extern void reg_expr();
-#endif
-
-#ifdef __USE_PROTOS
-void and_expr(void);
-#else
-extern void and_expr();
-#endif
-
-#ifdef __USE_PROTOS
-void repeat_expr(void);
-#else
-extern void repeat_expr();
-#endif
-
-#ifdef __USE_PROTOS
-void expr(void);
-#else
-extern void expr();
-#endif
-
-#ifdef __USE_PROTOS
-void atom_list(void);
-#else
-extern void atom_list();
-#endif
-
-#ifdef __USE_PROTOS
-void near_atom(void);
-#else
-extern void near_atom();
-#endif
-
-#ifdef __USE_PROTOS
-void atom(void);
-#else
-extern void atom();
-#endif
-
-#ifdef __USE_PROTOS
-void anychar(void);
-#else
-extern void anychar();
-#endif
-
-#endif
-extern SetWordType zzerr1[];
-extern SetWordType zzerr2[];
-extern SetWordType zzerr3[];
-extern SetWordType setwd1[];
-extern SetWordType zzerr4[];
-extern SetWordType zzerr5[];
-extern SetWordType zzerr6[];
-extern SetWordType setwd2[];
-extern SetWordType zzerr7[];
-extern SetWordType zzerr8[];
-extern SetWordType zzerr9[];
-extern SetWordType setwd3[];
|