Normed stuff and all complete the code to start the exec of arthmetic part
This commit is contained in:
parent
16113d5f51
commit
19c35d8c9f
3 changed files with 62 additions and 48 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/27 21:23:07 by rparodi #+# #+# */
|
||||
/* Updated: 2024/07/27 21:24:04 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/07/27 22:54:43 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,7 +17,8 @@ t_error _binary_op_add(t_ast_node self, t_state *state, t_i64 *out)
|
|||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
|
||||
if (self == NULL || state == NULL || out == NULL || self->kind == AST_ARITHMETIC_BINARY)
|
||||
if (self == NULL || state == NULL || out == NULL || \
|
||||
self->kind == AST_ARITHMETIC_BINARY)
|
||||
return (ERROR);
|
||||
if (_get_node_number(self->data.arithmetic_binary.lhs, state, &lhs))
|
||||
return (ERROR);
|
||||
|
|
@ -29,12 +30,13 @@ t_error _binary_op_add(t_ast_node self, t_state *state, t_i64 *out)
|
|||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
t_error _binary_op_sub(t_ast_node self, t_state *state, t_i64 *out)
|
||||
t_error _binary_op_sub(t_ast_node self, t_state *state, t_i64 *out)
|
||||
{
|
||||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
|
||||
if (self == NULL || state == NULL || out == NULL || self->kind == AST_ARITHMETIC_BINARY)
|
||||
if (self == NULL || state == NULL || out == NULL || \
|
||||
self->kind == AST_ARITHMETIC_BINARY)
|
||||
return (ERROR);
|
||||
if (_get_node_number(self->data.arithmetic_binary.lhs, state, &lhs))
|
||||
return (ERROR);
|
||||
|
|
@ -51,7 +53,8 @@ t_error _binary_op_mul(t_ast_node self, t_state *state, t_i64 *out)
|
|||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
|
||||
if (self == NULL || state == NULL || out == NULL || self->kind == AST_ARITHMETIC_BINARY)
|
||||
if (self == NULL || state == NULL || out == NULL || \
|
||||
self->kind == AST_ARITHMETIC_BINARY)
|
||||
return (ERROR);
|
||||
if (_get_node_number(self->data.arithmetic_binary.lhs, state, &lhs))
|
||||
return (ERROR);
|
||||
|
|
@ -63,12 +66,13 @@ t_error _binary_op_mul(t_ast_node self, t_state *state, t_i64 *out)
|
|||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
t_error _binary_op_div(t_ast_node self, t_state *state, t_i64 *out)
|
||||
t_error _binary_op_div(t_ast_node self, t_state *state, t_i64 *out)
|
||||
{
|
||||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
|
||||
if (self == NULL || state == NULL || out == NULL || self->kind == AST_ARITHMETIC_BINARY)
|
||||
if (self == NULL || state == NULL || out == NULL || \
|
||||
self->kind == AST_ARITHMETIC_BINARY)
|
||||
return (ERROR);
|
||||
if (_get_node_number(self->data.arithmetic_binary.lhs, state, &lhs))
|
||||
return (ERROR);
|
||||
|
|
@ -80,12 +84,13 @@ t_error _binary_op_div(t_ast_node self, t_state *state, t_i64 *out)
|
|||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
t_error _binary_op_mod(t_ast_node self, t_state *state, t_i64 *out)
|
||||
t_error _binary_op_mod(t_ast_node self, t_state *state, t_i64 *out)
|
||||
{
|
||||
t_i64 lhs;
|
||||
t_i64 rhs;
|
||||
|
||||
if (self == NULL || state == NULL || out == NULL || self->kind == AST_ARITHMETIC_BINARY)
|
||||
if (self == NULL || state == NULL || out == NULL || \
|
||||
self->kind == AST_ARITHMETIC_BINARY)
|
||||
return (ERROR);
|
||||
if (_get_node_number(self->data.arithmetic_binary.lhs, state, &lhs))
|
||||
return (ERROR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue