Added typedefs and comments of definition structures
This commit is contained in:
parent
89839ad499
commit
5359c69203
|
@ -0,0 +1,62 @@
|
|||
|
||||
#ifndef CARROT_DEFINITION_H
|
||||
#define CARROT_DEFINITION_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// carrot_definition_unit_s: A whole file (with possible included sub-files) of rules.
|
||||
// A definition unit describes a single format or language.
|
||||
typedef struct carrot_definition_unit carrot_definition_unit_s;
|
||||
|
||||
// carrot_rule_definition_s: The definition of a rule with all of the patterns it contains.
|
||||
// A rule definition starts with the name of the rule inside of a pair of arrow brackets ( < > ),
|
||||
// followed by an equals sign and some patterns, until a semicolon ends the rule definition.
|
||||
typedef struct carrot_rule_definition carrot_rule_definition_s;
|
||||
|
||||
// carrot_pattern_s: A pattern consisting of a sequence of pattern elements. These elements
|
||||
// can be terminal or the names of whole other rules themselves.
|
||||
typedef struct carrot_pattern_sequence carrot_pattern_sequence_s;
|
||||
|
||||
// carrot_pattern_element_s: An element of a pattern; this can be a terminal symbol or the name
|
||||
// of another rule in arrow brackets ( < > ). It denotes a piece of data, one or multiple tokens,
|
||||
// which have to exist for the pattern to begin (which are static, defined literals)
|
||||
// or can be extracted (like variable terminals).
|
||||
typedef struct carrot_pattern_element carrot_pattern_element_s;
|
||||
|
||||
// carrot_terminal_s: An ending symbol of the parsing tree. This can be the name of a variable terminal
|
||||
// or a static, defined literal.
|
||||
//
|
||||
// A variable terminal could be "[word]", "[keyword]" or one of some others (as they are defined in
|
||||
// docs/variable_terminals.md)
|
||||
//
|
||||
// A static, defined literal is a literal piece of data which must exist at that position in a rule
|
||||
// in exactly the way as it was stated in the definition.
|
||||
typedef struct carrot_terminal carrot_terminal_s;
|
||||
|
||||
struct carrot_definition {
|
||||
|
||||
};
|
||||
|
||||
struct carrot_rule_definition {
|
||||
|
||||
};
|
||||
|
||||
struct carrot_pattern {
|
||||
|
||||
};
|
||||
|
||||
struct carrot_pattern_element {
|
||||
|
||||
};
|
||||
|
||||
struct carrot_terminal {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue