diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index 14293032..66ac51df 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -215,6 +215,16 @@ typedef struct s_stackmatch t_stackmatch; extern t_stackmatch g_stackmatch[]; +struct s_treematch g_treemacth[]; +{ + t_type token; + void (*add)(t_btree **ast, t_type ) +}; + +typedef struct s_treematch t_treematch; + +extern t_treematch g_treematch[]; + int ft_parse(t_btree **ast, t_list **token); int produce_sym(t_sym stack, t_sym *new_sym, t_list **lst); int eval_sym(t_sym stack, t_sym new_sym); diff --git a/42sh/src/parser/build_tree.c b/42sh/src/parser/build_tree.c new file mode 100644 index 00000000..1ba0fd59 --- /dev/null +++ b/42sh/src/parser/build_tree.c @@ -0,0 +1,12 @@ +#include "parser.h" + +t_treematch g_treematch[] = +{ + TK_WORD, + +int build_tree(t_btree **ast) +{ + int i; + + i = 0; + while (g