From: Lukáš Jiřiště Date: Sat, 25 Jul 2026 04:29:09 +0000 (+0200) Subject: Create some structures for parsing X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=db0c83a86530f9808747b754b3b384b570666105;p=KyciFTA Create some structures for parsing I am not yet sure about how to approach the parsing entirely, the structure may prove to be quite useless. --- diff --git a/src/main.c b/src/main.c index 8b72e33..8cfe01c 100644 --- a/src/main.c +++ b/src/main.c @@ -20,6 +20,7 @@ int main(int argc, char **argv) ft_printf("An error has occured.\n"); return (1); } + //parse_into_logic(parse_tree); ft_parse_tree_print(parse_tree); ft_parse_tree_free(parse_tree); return (0); diff --git a/src/parsing.c b/src/parsing.c new file mode 100644 index 0000000..530cd65 --- /dev/null +++ b/src/parsing.c @@ -0,0 +1,53 @@ +#include "libft.h" + +typedef double (*probability_function)(double time); + +typedef struct s_atom +{ + int state; + char *name; + double failure_probability; + probability_function func; +} t_atom; + +typedef enum e_gate_type +{ + and_gate, + or_gate, + nook_gate, +} t_gate_type; + +typedef struct s_gate +{ + int state; + int n; // for NooK gate + int k; // for NooK gate + t_gate_type type; +} t_gate; + +typedef struct s_fta_member +{ + t_tree_node *parent; + union + { + t_atom atom; + t_gate gate; + } +} t_fta_member; + +typedef struct s_fta_object +{ + char *name; + char *class_name; +} + +typedef struct s_fta_class +{ + char *class_name; + t_vec objects_used; +} + +t_tree *parse_into_logic(const t_parse_tree_node *tree) +{ + +}