MiniDevil As beautiful as a shell
parser.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* parser.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: baelgadi <baelgadi@student.42.fr> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2025/12/07 22:19:44 by zotaj-di #+# #+# */
9 /* Updated: 2026/03/04 04:45:24 by baelgadi ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include "parser.h"
14 #include <stddef.h>
15 
26 t_ast *parse(t_token *tokens)
27 {
28  if (!tokens)
29  return (NULL);
30  if (validate_syntax(tokens) < 0)
31  return (NULL);
32  return (parse_pipeline(&tokens));
33 }
t_ast * parse(t_token *tokens)
Parse a token list into an AST.
Definition: parser.c:26
Parser entry point & sub parser prototypes.
int validate_syntax(t_token *tokens)
Run all validation checks on a token list.
t_ast * parse_pipeline(t_token **tokens)
Parse a pipeline of commands connected by pipes.
AST node (union based ↑)
Definition: structs.h:151
Lexer token (singly linked list)
Definition: structs.h:71