snc: restructured parsing of types
We now build normal syntax nodes during parsing, re-using node types from the expression syntax (E_VAR, E_BINOP, E_PRE, E_SUBSCR, E_FUNC). Together with the recent change in generating types, this means we no longer need the backward parent links in the type structure. Most of the code in var_types.c is now much easier to understand and modify. Also made the tentative change to represent "const" not as a type node with a child pointer, but rather with a boolean flag. This is in anticipation of adding the "pv" type operator in the hope that using yet another flag to represent it will make analysis of a type easier. It could well be that I revert this change if it turns out that this makes things more difficult. A first indication is that in var_types.c this already complicates some of the routines. So I left most of the T_CONST cases in there, only disabled them with #if 0...#endif.
Showing
- src/snc/analysis.c 20 additions, 15 deletionssrc/snc/analysis.c
- src/snc/expr.h 0 additions, 10 deletionssrc/snc/expr.h
- src/snc/gen_code.c 1 addition, 0 deletionssrc/snc/gen_code.c
- src/snc/gen_ss_code.c 11 additions, 12 deletionssrc/snc/gen_ss_code.c
- src/snc/gen_tables.c 1 addition, 0 deletionssrc/snc/gen_tables.c
- src/snc/snl.lem 28 additions, 26 deletionssrc/snc/snl.lem
- src/snc/type_check.c 3 additions, 3 deletionssrc/snc/type_check.c
- src/snc/types.h 1 addition, 2 deletionssrc/snc/types.h
- src/snc/var_types.c 238 additions, 211 deletionssrc/snc/var_types.c
- src/snc/var_types.h 46 additions, 43 deletionssrc/snc/var_types.h
Loading
Please register or sign in to comment