comparison lwcc/tree.c @ 498:1bd2d590d734

Rejig parser to eliminate lemon No longer use lemon for building the parser. It adds too much complexity, really, and a hand written recursive descent parser is far more flexible. The current iteration can handle exactly one statement: "return <int>".
author William Astle <lost@l-w.ca>
date Thu, 08 Aug 2019 23:32:23 -0600
parents a3e277c58df9
children f3e9732973f1
comparison
equal deleted inserted replaced
497:4b865c9d4371 498:1bd2d590d734
49 "TYPE_LDOUBLE", 49 "TYPE_LDOUBLE",
50 "FUNDEF", 50 "FUNDEF",
51 "FUNDECL", 51 "FUNDECL",
52 "FUNARGS", 52 "FUNARGS",
53 "BLOCK", 53 "BLOCK",
54 "STMT_RETURN",
55 "CONST_INT",
54 }; 56 };
55 57
56 58
57 59
58 node_t *node_create(int type, ...) 60 node_t *node_create(int type, ...)
75 case NODE_TYPE_PTR: 77 case NODE_TYPE_PTR:
76 nargs = 1; 78 nargs = 1;
77 break; 79 break;
78 80
79 case NODE_IDENT: 81 case NODE_IDENT:
82 case NODE_CONST_INT:
80 r -> strval = lw_strdup(va_arg(args, char *)); 83 r -> strval = lw_strdup(va_arg(args, char *));
81 break; 84 break;
82 85
83 case NODE_FUNDEF: 86 case NODE_FUNDEF:
84 nargs = 4; 87 nargs = 4;