ANTLR3C
3.3.1
|
Data Structures | |
struct | ANTLR3_HASH_BUCKET_struct |
Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket. More... | |
struct | ANTLR3_HASH_ENTRY_struct |
Internal structure representing an element in a hash bucket. More... | |
struct | ANTLR3_HASH_ENUM_struct |
Internal structure representing an enumeration of a table. More... | |
struct | ANTLR3_HASH_KEY_struct |
struct | ANTLR3_HASH_TABLE_struct |
Structure that tracks a hash table. More... | |
struct | ANTLR3_INT_TRIE_NODE_struct |
Structure that defines an element/node in an ANTLR3_INT_TRIE. More... | |
struct | ANTLR3_INT_TRIE_struct |
Structure that defines an ANTLR3_INT_TRIE. More... | |
struct | ANTLR3_LIST_struct |
Structure that represents a LIST collection. More... | |
struct | ANTLR3_STACK_struct |
Structure that represents a Stack collection. More... | |
struct | ANTLR3_TOPO_struct |
A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order. More... | |
struct | ANTLR3_TRIE_ENTRY_struct |
Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE. More... | |
struct | ANTLR3_VECTOR_ELEMENT_struct |
struct | ANTLR3_VECTOR_FACTORY_struct |
Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed. More... | |
struct | ANTLR3_VECTOR_struct |
Macros | |
#define | ANTLR3_FACTORY_VPOOL_SIZE 256 |
Default vector pool size if otherwise unspecified. More... | |
#define | ANTLR3_HASH_TYPE_INT 0 |
Indicates the hashed file has integer keys. More... | |
#define | ANTLR3_HASH_TYPE_STR 1 |
Indicates the hashed file has numeric keys. More... | |
#define | ANTLR3_VECTOR_INTERNAL_SIZE 16 |
Typedefs | |
typedef struct ANTLR3_HASH_BUCKET_struct | ANTLR3_HASH_BUCKET |
Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket. More... | |
typedef struct ANTLR3_HASH_ENTRY_struct | ANTLR3_HASH_ENTRY |
Internal structure representing an element in a hash bucket. More... | |
typedef struct ANTLR3_HASH_ENUM_struct | ANTLR3_HASH_ENUM |
Internal structure representing an enumeration of a table. More... | |
typedef struct ANTLR3_HASH_KEY_struct | ANTLR3_HASH_KEY |
typedef struct ANTLR3_HASH_TABLE_struct | ANTLR3_HASH_TABLE |
Structure that tracks a hash table. More... | |
typedef struct ANTLR3_INT_TRIE_struct | ANTLR3_INT_TRIE |
Structure that defines an ANTLR3_INT_TRIE. More... | |
typedef struct ANTLR3_INT_TRIE_NODE_struct | ANTLR3_INT_TRIE_NODE |
Structure that defines an element/node in an ANTLR3_INT_TRIE. More... | |
typedef struct ANTLR3_LIST_struct | ANTLR3_LIST |
Structure that represents a LIST collection. More... | |
typedef struct ANTLR3_STACK_struct | ANTLR3_STACK |
Structure that represents a Stack collection. More... | |
typedef struct ANTLR3_TOPO_struct | ANTLR3_TOPO |
A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order. More... | |
typedef struct ANTLR3_TRIE_ENTRY_struct | ANTLR3_TRIE_ENTRY |
Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE. More... | |
typedef struct ANTLR3_VECTOR_struct | ANTLR3_VECTOR |
typedef struct ANTLR3_VECTOR_ELEMENT_struct | ANTLR3_VECTOR_ELEMENT |
typedef struct ANTLR3_VECTOR_FACTORY_struct | ANTLR3_VECTOR_FACTORY |
Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed. More... | |
typedef struct ANTLR3_HASH_KEY_struct * | pANTLR3_HASH_KEY |
typedef struct ANTLR3_INT_TRIE_NODE_struct * | pANTLR3_INT_TRIE_NODE |
typedef struct ANTLR3_TRIE_ENTRY_struct * | pANTLR3_TRIE_ENTRY |
typedef struct ANTLR3_VECTOR_ELEMENT_struct * | pANTLR3_VECTOR_ELEMENT |
#define ANTLR3_FACTORY_VPOOL_SIZE 256 |
Default vector pool size if otherwise unspecified.
#define ANTLR3_HASH_TYPE_INT 0 |
Indicates the hashed file has integer keys.
#define ANTLR3_HASH_TYPE_STR 1 |
Indicates the hashed file has numeric keys.
#define ANTLR3_VECTOR_INTERNAL_SIZE 16 |
typedef struct ANTLR3_HASH_BUCKET_struct ANTLR3_HASH_BUCKET |
Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket.
typedef struct ANTLR3_HASH_ENTRY_struct ANTLR3_HASH_ENTRY |
Internal structure representing an element in a hash bucket.
Stores the original key so that duplicate keys can be rejected if necessary, and contains function can be supported. If the hash key could be unique I would have invented the perfect compression algorithm ;-)
typedef struct ANTLR3_HASH_ENUM_struct ANTLR3_HASH_ENUM |
Internal structure representing an enumeration of a table.
This is returned by antlr3Enumeration() Allows the programmer to traverse the table in hash order without knowing what is in the actual table.
Note that it is up to the caller to ensure that the table structure does not change in the hash bucket that is currently being enumerated as this structure just tracks the next pointers in the bucket series.
typedef struct ANTLR3_HASH_KEY_struct ANTLR3_HASH_KEY |
typedef struct ANTLR3_HASH_TABLE_struct ANTLR3_HASH_TABLE |
Structure that tracks a hash table.
typedef struct ANTLR3_INT_TRIE_struct ANTLR3_INT_TRIE |
Structure that defines an ANTLR3_INT_TRIE.
For this particular implementation, as you might expect, the key is turned into a "string" by looking at bit(key, depth) of the integer key. Using 64 bit keys gives us a depth limit of 64 (or bit 0..63) and potentially a huge trie. This is the algorithm for a Patricia Trie. Note also that this trie [can] accept multiple entries for the same key and is therefore a kind of elastic bucket patricia trie.
If you find this code useful, please feel free to 'steal' it for any purpose as covered by the BSD license under which ANTLR is issued. You can cut the code but as the ANTLR library is only about 50K (Windows Vista), you might find it easier to just link the library. Please keep all comments and licenses and so on in any version of this you create of course.
Jim Idle.
typedef struct ANTLR3_INT_TRIE_NODE_struct ANTLR3_INT_TRIE_NODE |
Structure that defines an element/node in an ANTLR3_INT_TRIE.
typedef struct ANTLR3_LIST_struct ANTLR3_LIST |
Structure that represents a LIST collection.
typedef struct ANTLR3_STACK_struct ANTLR3_STACK |
Structure that represents a Stack collection.
typedef struct ANTLR3_TOPO_struct ANTLR3_TOPO |
A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order.
This is a generally useful utility object that does not care what the things are it is sorting. Generally the set to be sorted will be numeric indexes into some other structure such as an ANTLR3_VECTOR. I have provided a sort method that given ANTLR3_VECTOR as an input will sort the vector entries in place, as well as a sort method that just returns an array of the sorted noded indexes, in case you are not sorting ANTLR3_VECTORS but some set of your own device.
Of the two main algorithms that could be used, I chose to use the depth first search for unvisited nodes as a) This runs in linear time, and b) it is what we used in the ANTLR Tool to perform a topological sort of the input grammar files based on their dependencies.
typedef struct ANTLR3_TRIE_ENTRY_struct ANTLR3_TRIE_ENTRY |
Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE.
typedef struct ANTLR3_VECTOR_struct ANTLR3_VECTOR |
typedef struct ANTLR3_VECTOR_ELEMENT_struct ANTLR3_VECTOR_ELEMENT |
typedef struct ANTLR3_VECTOR_FACTORY_struct ANTLR3_VECTOR_FACTORY |
Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed.
typedef struct ANTLR3_HASH_KEY_struct * pANTLR3_HASH_KEY |
typedef struct ANTLR3_INT_TRIE_NODE_struct * pANTLR3_INT_TRIE_NODE |
typedef struct ANTLR3_TRIE_ENTRY_struct * pANTLR3_TRIE_ENTRY |
typedef struct ANTLR3_VECTOR_ELEMENT_struct * pANTLR3_VECTOR_ELEMENT |