relabel.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/* 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
/* 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
#else
int level;
#endif
{
if (level){
}else{
/* classes equivalent to all characters in alphabet */
}
return class_no;
}
/* makes character class sets for new labels */
#ifdef __USE_PROTOS
#else
int level; /* compression level to uses */
#endif
{
#if 0
/* EOF (-1+1) alway in class 0 */
class_sets[0] = set_of(0);
first_el[0] = 0;
used_classes = set_of(0);
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){
}else{
}
unpart_chars = temp;
++class_no;
}
/* free unpart_chars -ATG 5/6/95 */
#if 0
/* group all the other unused characters into a class */
++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
#else
#endif
{
/* pick a new operation number */
++operation_no;
}
#ifdef __USE_PROTOS
#else
set * maximal_class;
#endif
{
{
{
*maximal_class = temp;
}else{
}
}
}
/* puts class labels in place of old character labels */
#ifdef __USE_PROTOS
#else
void label_with_classes(start)
#endif
{
++operation_no;
}
#ifdef __USE_PROTOS
#else
void label_node(start)
#endif
{
register int i;
/* only do node if it hasn't been done before */
for (i = 0; i<class_no; ++i){
/* if one element of class in old_label,
all elements are. */
}
/* do any nodes that can be reached from this one */
}
}