From 5359c692033fa1379340cd30dc82f2d5cfb9429a Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 10 Sep 2023 12:41:25 +0200 Subject: [PATCH] Added typedefs and comments of definition structures --- inc/definition.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 inc/definition.h diff --git a/inc/definition.h b/inc/definition.h new file mode 100644 index 0000000..c3c3621 --- /dev/null +++ b/inc/definition.h @@ -0,0 +1,62 @@ + +#ifndef CARROT_DEFINITION_H +#define CARROT_DEFINITION_H + +#include +#include +#include +#include +#include + +// 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