diff options
| author | mirenn <me@mirenn.dev> | 2026-03-12 16:36:27 +0100 |
|---|---|---|
| committer | mirenn <me@mirenn.dev> | 2026-04-14 09:44:28 +0200 |
| commit | 6bb1a9b95b09663436c2fe30a8e2185a3f741af1 (patch) | |
| tree | 5546f4c44b3e9ca09776dae0078db25af229247b /src/ast.h | |
| parent | a8d572933d3a29e73bbbe20bc49e1fe988e55cfa (diff) | |
| download | inpla-6bb1a9b95b09663436c2fe30a8e2185a3f741af1.tar.gz inpla-6bb1a9b95b09663436c2fe30a8e2185a3f741af1.zip | |
float support
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -5,8 +5,8 @@ #include "config.h" typedef enum { - AST_SYM=0, AST_NAME, AST_INTVAR, AST_AGENT, - AST_CNCT, AST_CNCT_TCO_INTVAR, AST_CNCT_TCO_CONS, AST_CNCT_TCO, + AST_SYM=0, AST_NAME, AST_FLOATVAR, AST_AGENT, + AST_CNCT, AST_CNCT_TCO_FLOATVAR, AST_CNCT_TCO_CONS, AST_CNCT_TCO, AST_RULE, AST_BODY, AST_IF, AST_THEN_ELSE, // this is for ASTLIST @@ -19,7 +19,7 @@ typedef enum { AST_TUPLE, // operation - AST_INT, AST_LD, AST_PLUS, AST_SUB, AST_MUL, AST_DIV, AST_MOD, + AST_FLOAT, AST_LD, AST_PLUS, AST_SUB, AST_MUL, AST_DIV, AST_MOD, AST_LT, AST_LE, AST_EQ, AST_NE, AST_UNM, AST_AND, AST_OR, AST_NOT, // for built-in lists @@ -36,7 +36,7 @@ typedef enum { typedef struct abstract_syntax_tree { AST_ID id; int intval; - long longval; + double doubleval; char *sym; struct abstract_syntax_tree *left,*right; } Ast; @@ -44,7 +44,7 @@ typedef struct abstract_syntax_tree { void ast_heapInit(void); void ast_heapReInit(void); Ast *ast_makeSymbol(char *name); -Ast *ast_makeInt(long num); +Ast *ast_makeFloat(double num); Ast *ast_makeAST(AST_ID id, Ast *left, Ast *right); Ast *ast_makeTuple(Ast *tuple); Ast *ast_reverseList(Ast *l); @@ -54,10 +54,10 @@ Ast *ast_getNth(Ast *p,int nth); Ast *ast_getTail(Ast *p); void ast_puts(Ast *p); Ast *ast_paramToCons(Ast *ast); -int ast_recordConst(char *name, int val); +int ast_recordConst(char *name, double val); Ast *ast_remove_tuple1(Ast *p); Ast *ast_unfoldABR(Ast *left_params, char *sym, Ast *paramlist, Ast *annotate); -int ast_getRecordedVal(int entry); +double ast_getRecordedVal(int entry); #define ast_makeCons(x1,x2) ast_makeAST(AST_LIST,x1,x2) #define ast_makeList1(x1) ast_makeAST(AST_LIST,x1,NULL) |
