The.
This commit is contained in:
parent
139d6fcb22
commit
363188d7d6
@ -10,7 +10,7 @@ static char* asttype_names[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASTTypeNum* ast_type_num_init(AST* val) {
|
ASTTypeNum* ast_type_num_init(int val) {
|
||||||
talloc(ASTTypeNum, num);
|
talloc(ASTTypeNum, num);
|
||||||
|
|
||||||
num->val = val;
|
num->val = val;
|
||||||
|
@ -24,7 +24,9 @@ void yyerror (char const *);
|
|||||||
|
|
||||||
exp:
|
exp:
|
||||||
NUM { $$ = ast_type_num_init($1); }
|
NUM { $$ = ast_type_num_init($1); }
|
||||||
| NUM PLUS NUM { AST* argv[2] = {ast_type_num_init($1), ast_type_num_init($1)}; $$ = ast_type_call_init("+", 2, argv);}
|
| NUM PLUS NUM {
|
||||||
;
|
AST* argv[2] = {ast_type_num_init($1), ast_type_num_init($1)};
|
||||||
|
$$ = ast_type_call_init("+", 2, argv);
|
||||||
|
};
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -18,10 +18,10 @@ AST* ast_init(ASTType type, void* data);
|
|||||||
void ast_destroy(AST* ast);
|
void ast_destroy(AST* ast);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
AST* val;
|
int val;
|
||||||
} ASTTypeNum;
|
} ASTTypeNum;
|
||||||
|
|
||||||
ASTTypeNum* ast_type_num_init(AST* val);
|
ASTTypeNum* ast_type_num_init(int val);
|
||||||
void ast_type_num_destroy(ASTTypeNum* num);
|
void ast_type_num_destroy(ASTTypeNum* num);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user