diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-27 16:02:07 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-27 16:02:07 -0400 |
commit | 62dfeef42d6c2e279165b6dbe73ee3abf98db146 (patch) | |
tree | 1fed7f782a1ead7308a0ee7a4439d74f50fa272e /parse.c | |
parent | df10470f1f10f1f1f2f5cad792976de8d734bf27 (diff) |
basic type inference
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -69,7 +69,7 @@ typedef enum { BINARY_MINUS } BinaryOp; -#define EXPR_FLAG_FLEXIBLE 0x01 +#define EXPR_FLAG_FLEXIBLE 0x01 /* e.g. 4 => float/i32/etc. */ typedef struct Expression { Location where; @@ -101,6 +101,7 @@ typedef struct Expression { #define DECL_FLAG_INFER_TYPE 0x01 #define DECL_FLAG_CONST 0x02 #define DECL_FLAG_HAS_EXPR 0x04 +#define DECL_FLAG_FOUND_TYPE 0x08 /* OPTIM: Instead of using dynamic arrays, do two passes. */ typedef struct Declaration { @@ -446,6 +447,7 @@ static bool parse_expr(Parser *p, Expression *e, Token *end) { e->type.kind = TYPE_BUILTIN; e->type.builtin = BUILTIN_FLOAT; e->floatl = num->floatval; + printf("%g\n",(double)e->floatl); break; case NUM_LITERAL_INT: e->kind = EXPR_INT_LITERAL; |