diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-03-24 18:31:59 +0100 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-03-24 18:31:59 +0100 |
| commit | 6b6cec716aa2baac0065e8fa0e52b89e1e0c4f1e (patch) | |
| tree | 4a5e06e08866738fb127bce125f34030ffeb9627 | |
| parent | 19a305ae711f9d552e98f74db7f1c264fe99dbb2 (diff) | |
| parent | 0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c (diff) | |
| download | minishell-6b6cec716aa2baac0065e8fa0e52b89e1e0c4f1e.tar.gz minishell-6b6cec716aa2baac0065e8fa0e52b89e1e0c4f1e.tar.bz2 minishell-6b6cec716aa2baac0065e8fa0e52b89e1e0c4f1e.zip | |
parser_lexer
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | include/ms_parse.h | 37 |
2 files changed, 38 insertions, 0 deletions
@@ -2,3 +2,4 @@ minishell *.o *.ghc *.a +tags diff --git a/include/ms_parse.h b/include/ms_parse.h index 4a6ebfa..c6885ca 100644 --- a/include/ms_parse.h +++ b/include/ms_parse.h @@ -15,6 +15,18 @@ # include "minishell.h" +/* +** TAG_CMD: command name +** TAG_ARG: command argument +** TAG_ENDCMD: `;` +** TAG_PIPE: `|` +** TAG_AND: `&&` +** TAG_OR: `||` +** TAG_REDIR_OUT: `>` +** TAG_REDIR_IN: `<` +** TAG_REDIR_APPEND: `>>` +*/ + typedef enum { TAG_CMD, @@ -28,6 +40,31 @@ typedef enum TAG_REDIR_APPEND } t_tag; +/* +** AST (Abstract Syntax Tree) +** A node of the ast is represented by a tag (his type) and a content associated with it. +** (i.e a TAG_CMD would be paired with the command executable name) +** Each node also has children node which must be evaluated before him +** +** examle: "echo foo bar && ls" +** +** tags: +** TAG_AND +** / \ +** / \ +** TAG_CMD TAG_CMD +** / \ +** TAG_ARG TAG_ARG +** +** content: +** && +** / \ +** / \ +** echo ls +** / \ +** foo bar +*/ + typedef struct t_ast { t_tag tag; char* contents; |
