Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

kydefs.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     kydefs.h  -  Definitions of types and macros used by KYGrammar class
00003                              -------------------
00004     begin                : June 21 2002
00005     copyright            : (C) 2003 by Vojtìch Toman
00006     email                : vtoman@lit.cz
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00025 #ifndef KYDEFS_H
00026 #define KYDEFS_H
00027 
00028 
00029 #include "defs.h"
00030 #include "arithdefs.h"
00031 #include "grammardefs.h"
00032 #include "hashtable.h"
00033 #include "list.h"
00034 #include "stack.h"
00035 
00036 
00040 #define TERMINAL_ALPHABET_DEFAULT_SIZE  256
00041 
00042 
00046 typedef unsigned int RuleFreq;
00047 
00048 
00052 typedef unsigned long RuleId;
00053 
00054 
00055 
00056 struct Rule;    //forward definition of the Rule structure
00057 
00058 
00059 
00065 struct RuleElement
00066 {
00068   SymbolType type;
00069 
00071   RuleElement *prev;
00072 
00074   RuleElement *next;
00075   
00076 
00078   union
00079   {
00081     TerminalValue value;
00082 
00084     Rule *rule;
00085   };
00086 };
00087 
00088 
00094 enum RuleMatchResult
00095 {
00097   Matches = 1,
00098 
00100   DoesntMatch = 2,
00101 
00103   Ignore = 3
00104 };
00105 
00106 
00112 struct Rule
00113 {
00114 public:
00116   RuleFreq refCount;
00117 
00119   FreqValue counter;
00120 
00122   RuleElement *body;
00123 
00125   RuleElement *last;
00126 
00128   RuleId id;
00129 
00131   unsigned long matchRun;
00132 
00134   RuleMatchResult matchResult;
00135 };
00136 
00137 
00143 typedef List<Rule> RuleSet;
00144 
00145 
00151 struct RuleElementNeighbour
00152 {
00154   RuleElement *origin;
00155 
00157   Rule *rule;
00158 };
00159 
00160 
00164 typedef List<RuleElementNeighbour> NeighboursDescriptionList;
00165 
00166 
00170 typedef List<Rule> RuleElementRepresentedByList;
00171 
00172 
00176 struct NeighboursDescription
00177 {
00179   NeighboursDescriptionList neighbours;
00180 
00182   RuleElementRepresentedByList representedBy;
00183 };
00184 
00185 
00189 typedef HashTable<unsigned long, NeighboursDescription, List, 3079> TerminalDigrams;
00190 
00191 
00195 typedef HashTable<unsigned long, NeighboursDescription, List, 98317> VariableDigrams;
00196 
00197 
00201 struct MatchingRule
00202 {
00204   Rule *rule;
00205 
00207   unsigned int length;
00208 };
00209 
00210 
00214 struct InputItem
00215 {
00217   InputItem *next;
00218 
00220   TerminalValue value;
00221 };
00222 
00223 
00227 struct TestedElement
00228 {
00230   RuleElement *rel;
00231 
00233   TestedElement *next;
00234 };
00235 
00236 
00240 struct TestedRule
00241 {
00243   Rule *rule;
00244 
00246   unsigned int matchedLength;
00247 
00249   bool matchesCompletely;
00250 
00252   TestedElement *currentElements;
00253 
00255   InputItem *lastInputItem;
00256 };
00257 
00258 
00262 typedef List<TestedRule> TestedRules;
00263 
00264 
00265 
00266 #endif //KYDEFS_H
00267 
00268 
00269 

Generated on Wed Feb 5 10:43:02 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002