feat: implement functions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef FZL_PARSER_H
|
||||
#define FZL_PARSER_H
|
||||
|
||||
#include "common/fzl_types.h"
|
||||
#include <compiler/fzl_reader.h>
|
||||
#include <compiler/fzl_token.h>
|
||||
#include <stddef.h>
|
||||
@@ -13,6 +14,8 @@ typedef enum
|
||||
FZL_NODETYPE_LITERAL,
|
||||
FZL_NODETYPE_IDENTIFIER,
|
||||
FZL_NODETYPE_CONDITIONAL,
|
||||
FZL_NODETYPE_FUNCTION,
|
||||
FZL_NODETYPE_RETURN,
|
||||
|
||||
FZL_NODETYPE_ADD,
|
||||
FZL_NODETYPE_SUB,
|
||||
@@ -93,6 +96,23 @@ typedef struct fzl_node
|
||||
struct fzl_node *true_block;
|
||||
struct fzl_node *else_block;
|
||||
} cond;
|
||||
|
||||
// Function declaration
|
||||
struct
|
||||
{
|
||||
struct fzl_node **args;
|
||||
size_t args_count;
|
||||
|
||||
struct fzl_node *body;
|
||||
fzl_token_t *name;
|
||||
fzl_token_t *type;
|
||||
} fn;
|
||||
|
||||
// Return value
|
||||
struct
|
||||
{
|
||||
struct fzl_node *value;
|
||||
} ret;
|
||||
};
|
||||
} fzl_node_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user