feat!: Merge remote-tracking branch 'origin/ast-def' into dev

This commit is contained in:
Gu://em_ 2026-01-08 18:51:12 +01:00
commit 653491c2fa
8 changed files with 99 additions and 14 deletions

View file

@ -1,25 +1,46 @@
# define the subdirectories
SUBDIRS = \
ast \
parser \
lexer \
io_backend \
execution \
expansion
# + utils if needed
ast \
parser \
lexer \
io_backend \
execution \
expansin \
utils
bin_PROGRAMS = 42sh
42sh_SOURCES = 42sh.c
42sh_SOURCES = main.c
42sh_CPPFLAGS = -I%D%
42sh_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla
42sh_LDADD = \
ast/libast.a \
parser/libparser.a \
lexer/liblexer.a \
io_backend/libio_backend.a \
expansion/libexpansion.a \
execution/libexecution.a
ast/libast.a \
parser/libparser.a \
lexer/liblexer.a \
io_backend/libio_backend.a \
expansion/libexpansion.a \
execution/libexecution.a \
utils/libutils.a
################################################# Test
bin_PROGRAMS = 42sh_asan
42sh_asan_SOURCES = main.c
42sh_asan_CPPFLAGS = -I%D%
42sh_asan_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla -g -fsanitize=address
42sh_asan_LDADD = \
ast/libast.a \
parser/libparser.a \
lexer/liblexer.a \
io_backend/libio_backend.a \
expansion/libexpansion.a \
execution/libexecution.a \
utils/libutils.a

View file

@ -0,0 +1,37 @@
#ifndef AST_H
#define AST_H
#include "lists.h"
enum ast_type
{
AST_END = 0,
AST_IF,
AST_CMD
};
union ast_node
{
struct ast_if;
struct ast_cmd;
};
struct ast
{
enum ast_type type;
union ast_node data;
};
struct ast_if
{
struct ast* condition;
struct ast* then_clause;
struct ast* else_clause;
};
struct ast_cmd
{
struct list* cmd;
};
#endif /* ! AST_H */

View file

@ -0,0 +1,4 @@
#ifndef EXECUTION_H
#define EXECUTION_H
#endif /* ! EXECUTION_H */

View file

@ -0,0 +1,4 @@
#ifndef EXPANSION_H
#define EXPANSION_H
#endif /* ! EXPANSION_H */

View file

@ -0,0 +1,4 @@
#ifndef LEXER_H
#define LEXER_H
#endif /* ! LEXER_H */

View file

@ -0,0 +1,4 @@
#ifndef PARSER_H
#define PARSER_H
#endif /* ! PARSER_H */

11
src/utils/Makefile.am Normal file
View file

@ -0,0 +1,11 @@
lib_LIBRARIES = libutils.a
# libutils_a_SOURCES = \
# utils.c \
# utils.h
# libutils_a_CPPFLAGS = -I$(top_srcdir)/src
# libutils_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla
# noinst_LIBRARIES = libutils.a