<commit_before>#ifndef __M1_AST_H__
#define __M1_AST_H__

#include "m1_symtab.h"
#include "m1_instr.h"
#include "m1_compiler.h"


typedef enum data_types {
    TYPE_INT    = 0,
    TYPE_NUM    = 1,
    TYPE_STRING = 2,
    TYPE_PMC    = 3,
    TYPE_VOID   = 4,
    TYPE_USERDEFINED = 5
    
} data_type;

typedef struct m1_chunk {
    data_type             rettype;
    char                 *name;
    struct m1_chunk      *next;
    struct m1_expression *block;
    /* TODO: add parameters */
    
    struct m1_symboltable locals;
        
} m1_chunk;

typedef struct m1_structfield {
    char     *name; 
    data_type type;     
    unsigned  offset;
    
    struct m1_structfield *next;
    
} m1_structfield;

typedef struct m1_struct {
    char    *name;
    unsigned numfields;
    unsigned size; /* can calculate from fields but better keep a "cached" value */
    
    struct m1_structfield *fields;
    
} m1_struct;


typedef struct m1_assignment {
    struct m1_expression *lhs;
    struct m1_expression *rhs;
    
} m1_assignment;

typedef struct m1_funcall {
    char *name;
    /* TODO: add args */<commit_msg>forgot to commit ast.h  last time<commit_after>#ifndef __M1_AST_H__
#define __M1_AST_H__

#include "m1_symtab.h"
#include "m1_instr.h"
#include "m1_compiler.h"


typedef enum data_types {
    TYPE_INT    = 0,
    TYPE_NUM    = 1,
    TYPE_STRING = 2,
    TYPE_PMC    = 3,
    TYPE_VOID   = 4,
    TYPE_USERDEFINED = 5
    
} data_type;

typedef struct m1_chunk {
    data_type             rettype;
    char                 *name;
    struct m1_chunk      *next;
    struct m1_expression *block;
    /* TODO: add parameters */
    
    struct m1_symboltable locals;
    struct m1_symboltable constants;
        
} m1_chunk;

typedef struct m1_structfield {
    char     *name; 
    data_type type;     
    unsigned  offset;
    
    struct m1_structfield *next;
    
} m1_structfield;

typedef struct m1_struct {
    char    *name;
    unsigned numfields;
    unsigned size; /* can calculate from fields but better keep a "cached" value */
    
    struct m1_structfield *fields;
    
} m1_struct;


typedef struct m1_assignment {
    struct m1_expression *lhs;
    struct m1_expression *rhs;
    
} m1_assignment;

typedef struct m1_funcall {
    char *name;
    /* TODO: add args */
{'fraction_non_alphanumeric': 0.0752920813500649, 'fraction_numerical': 0.023799221116399826, 'mean_word_length': 2.345875542691751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3642250', 'n_tokens_mistral': 850, 'n_tokens_neox': 805, 'n_words': 208}