-
Notifications
You must be signed in to change notification settings - Fork 11
/
ast.c
740 lines (569 loc) · 22.6 KB
/
ast.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
#include "ast.h"
ast_node *create_translation_unit()
{
ast_node *tu = (ast_node*)malloc(sizeof(ast_node));
tu->node_type = AST_NODE_TRANSLATIONAL_UNIT;
vec_init(&tu->child_nodes);
return tu;
}
ast_node *add_program_unit(ast_node *parent, ast_node *child)
{
vec_push(&parent->child_nodes, child);
return parent;
}
ast_node_statements *create_statement_node(int node_type, void *child)
{
ast_node_statements *stmt = (ast_node_statements*)malloc(sizeof(ast_node_statements));
stmt->node_type = node_type;
switch (node_type)
{
case AST_NODE_COMPOUND_STATEMENT:
stmt->child_nodes.compound_statement = child;
break;
case AST_NODE_DECLARATION:
stmt->child_nodes.declaration = child;
break;
case AST_NODE_ARRAY_DECLARATION:
stmt->child_nodes.array_declaration = child;
break;
case AST_NODE_ASSIGNMENT:
stmt->child_nodes.assignment = child;
break;
case AST_NODE_ARRAY_ASSIGNMENT:
stmt->child_nodes.array_assignment = child;
break;
case AST_NODE_CONDITIONAL_IF:
stmt->child_nodes.if_else = child;
break;
case AST_NODE_LOOP_FOR:
stmt->child_nodes.loop_for = child;
break;
case AST_NODE_LOOP_WHILE:
stmt->child_nodes.loop_while = child;
break;
case AST_NODE_LOOP_BREAK:
case AST_NODE_LOOP_CONTINUE:
stmt->child_nodes.loop_control = child;
break;
case AST_NODE_FUNC_RETURN:
stmt->child_nodes.return_statement = child;
break;
case AST_NODE_FUNC_CALL:
stmt->child_nodes.function_call = child;
break;
case AST_NODE_DIGITAL_READ_CALL:
case AST_NODE_DIGITAL_WRITE_CALL:
case AST_NODE_DELAY_CALL:
case AST_NODE_PWM_CALL:
case AST_NODE_START_COUNTER_CALL:
case AST_NODE_STOP_COUNTER_CALL:
case AST_NODE_READ_COUNTER_CALL:
case AST_NODE_INIT_RPMSG_CALL:
case AST_NODE_RECV_RPMSG_CALL:
case AST_NODE_SEND_RPMSG_CALL:
stmt->child_nodes.utility_function_call = child;
break;
case AST_NODE_PRINT_STRING_FUNCTION_CALL:
stmt->child_nodes.print_string_function_call = child;
break;
case AST_NODE_PRINT_EXP_FUNCTION_CALL:
stmt->child_nodes.print_expression_function_call = child;
break;
}
return stmt;
}
ast_node_compound_statement *create_compound_statement_node()
{
ast_node_compound_statement *cmpd_stmt = (ast_node_compound_statement*)malloc(sizeof(ast_node_compound_statement));
cmpd_stmt->node_type = AST_NODE_COMPOUND_STATEMENT;
vec_init(&cmpd_stmt->child_nodes);
return cmpd_stmt;
}
ast_node_compound_statement *add_compound_statement_node(ast_node_compound_statement *parent, ast_node_statements *child)
{
vec_push(&parent->child_nodes, child);
return parent;
}
ast_node_declaration *create_declaration_node(sym_ptr symbol, ast_node_expression *exp)
{
ast_node_declaration *decl = (ast_node_declaration*)malloc(sizeof(ast_node_declaration));
decl->node_type = AST_NODE_DECLARATION;
decl->expression = exp;
decl->symbol_entry = symbol;
return decl;
}
ast_node_array_declaration *create_array_declaration_node(sym_ptr symbol, ast_node_expression *size, char *initial_string)
{
ast_node_array_declaration *decl = (ast_node_array_declaration*)malloc(sizeof(ast_node_array_declaration));
decl->node_type = AST_NODE_ARRAY_DECLARATION;
decl->initial_string = initial_string;
decl->size = size;
decl->symbol_entry = symbol;
return decl;
}
ast_node_assignment *create_assignment_node(sym_ptr symbol, ast_node_expression *exp)
{
ast_node_assignment *assgn = (ast_node_assignment*)malloc(sizeof(ast_node_assignment));
assgn->node_type = AST_NODE_ASSIGNMENT;
assgn->expression = exp;
assgn->symbol_entry = symbol;
return assgn;
}
ast_node_array_assignment *create_array_assignment_node(sym_ptr symbol, ast_node_expression *index, ast_node_expression *exp)
{
ast_node_array_assignment *assign = (ast_node_array_assignment*)malloc(sizeof(ast_node_array_assignment));
assign->node_type = AST_NODE_ARRAY_ASSIGNMENT;
assign->expression = exp;
assign->index = index;
assign->symbol_entry = symbol;
return assign;
}
ast_node_array_access *create_array_access_node(sym_ptr symbol, ast_node_expression *index)
{
ast_node_array_access *access = (ast_node_array_access*)malloc(sizeof(ast_node_array_access));
access->node_type = AST_NODE_ARRAY_ACCESS;
access->index = index;
access->symbol_entry = symbol;
return access;
}
ast_node_expression *create_expression_node(int node_type, int opt, int value, ast_node *left, ast_node *right)
{
ast_node_expression *exp = (ast_node_expression*)malloc(sizeof(ast_node_expression));
exp->node_type = node_type;
exp->opt = opt;
exp->value = value;
exp->left = left;
exp->right = right;
return exp;
}
ast_node_range_expression *create_range_expression_node(ast_node_expression *start, ast_node_expression *stop, ast_node_expression *increment)
{
ast_node_range_expression *exp = (ast_node_range_expression*)malloc(sizeof(ast_node_range_expression));
exp->node_type = AST_NODE_RANGE_EXP;
if (!start)
{
start = create_expression_node(AST_NODE_ARITHMETIC_EXP, AST_NODE_CONSTANT, 0, NULL, NULL);
}
exp->start = start;
exp->stop = stop;
if (!increment)
{
increment = create_expression_node(AST_NODE_ARITHMETIC_EXP, AST_NODE_CONSTANT, 1, NULL, NULL);
}
exp->increment = increment;
return exp;
}
ast_node_constant *create_constant_node(int data_type, int value)
{
ast_node_constant *cnst = (ast_node_constant*)malloc(sizeof(ast_node_constant));
cnst->node_type = AST_NODE_CONSTANT;
cnst->data_type = data_type;
cnst->value = value;
return cnst;
}
ast_node_variable *create_variable_node(int data_type, sym_ptr symbol)
{
ast_node_variable *var = (ast_node_variable*)malloc(sizeof(ast_node_variable));
var->node_type = AST_NODE_VARIABLE;
var->data_type = data_type;
var->symbol_entry = symbol;
return var;
}
ast_node_conditional_if *create_conditional_if_node(ast_node_expression *condition, ast_node_compound_statement *body, ast_node_conditional_else_if *else_if, ast_node_compound_statement *else_node)
{
ast_node_conditional_if *cond_if = (ast_node_conditional_if*)malloc(sizeof(ast_node_conditional_if));
cond_if->node_type = AST_NODE_CONDITIONAL_IF;
cond_if->condition = condition;
cond_if->body = body;
cond_if->else_if = else_if;
cond_if->else_part = else_node;
return cond_if;
}
ast_node_conditional_else_if *create_else_if_node()
{
ast_node_conditional_else_if *cond_else_if = (ast_node_conditional_else_if*)malloc(sizeof(ast_node_conditional_else_if));
cond_else_if->node_type = AST_NODE_CONDITIONAL_ELSE_IF;
vec_init(&cond_else_if->else_if);
return cond_else_if;
}
ast_node_conditional_else_if *add_else_if_node(ast_node_conditional_else_if *parent, ast_node_expression *condition, ast_node_compound_statement *body)
{
ast_node_conditional_if *temp = (ast_node_conditional_if*)malloc(sizeof(ast_node_conditional_if));
temp->node_type = AST_NODE_CONDITIONAL_ELSE_IF;
temp->condition = condition;
temp->body = body;
temp->else_if = NULL;
temp->else_part = NULL;
vec_push(&parent->else_if, temp);
return parent;
}
ast_node_loop_for *create_loop_for_node(ast_node_variable *init, ast_node_range_expression *range, ast_node_compound_statement *body)
{
ast_node_loop_for *loop_for = (ast_node_loop_for*)malloc(sizeof(ast_node_loop_for));
loop_for->node_type = AST_NODE_LOOP_FOR;
loop_for->init = init;
loop_for->range = range;
loop_for->body = body;
return loop_for;
}
ast_node_loop_while *create_loop_while_node(ast_node_expression *condition, ast_node_compound_statement *body)
{
ast_node_loop_while *loop_while = (ast_node_loop_while*)malloc(sizeof(ast_node_loop_while));
loop_while->node_type = AST_NODE_LOOP_FOR;
loop_while->condition = condition;
loop_while->body = body;
return loop_while;
}
ast_node_loop_control *create_loop_control_node(int node_type)
{
ast_node_loop_control *loop_control = (ast_node_loop_control*)malloc(sizeof(ast_node_loop_control));
loop_control->node_type = node_type;
return loop_control;
}
ast_node_function_def *create_function_def_node(sym_ptr symbol_entry, ast_node_param *params, ast_node_compound_statement *body, ast_node_expression *return_stmt)
{
ast_node_function_def *function_def = (ast_node_function_def*)malloc(sizeof(ast_node_function_def));
function_def->node_type = AST_NODE_FUNCTION_DEFS;
function_def->symbol_entry = symbol_entry;
function_def->params = params;
function_def->body = body;
function_def->return_statment = return_stmt;
return function_def;
}
ast_node_param *create_parameter_node()
{
ast_node_param *params = (ast_node_param*)malloc(sizeof(ast_node_param));
params->node_type = AST_NODE_FUNC_PARAM;
vec_init(¶ms->variable);
return params;
}
ast_node_param *add_parameter_node(ast_node_param *parent, ast_node_variable *var)
{
vec_push(&parent->variable, var);
return parent;
}
ast_node_function_call *create_function_call_node(sym_ptr symbol, ast_node_arguments *arguments)
{
ast_node_function_call *function_call = (ast_node_function_call*)malloc(sizeof(ast_node_function_call));
function_call->node_type = AST_NODE_FUNC_CALL;
function_call->symbol_entry = symbol;
function_call->args = arguments;
return function_call;
}
ast_node_arguments *create_argument_node()
{
ast_node_arguments *arguments = (ast_node_arguments*)malloc(sizeof(ast_node_arguments));
arguments->node_type = AST_NODE_FUNC_ARGS;
vec_init(&arguments->arguments);
return arguments;
}
ast_node_arguments *add_argument_node(ast_node_arguments *parent, ast_node_expression *argument)
{
vec_push(&parent->arguments, argument);
return parent;
}
ast_node_utility_function_call *create_digital_read_call_node(ast_node_expression *pin_number)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_DIGITAL_READ_CALL;
utility_function_call->pin_number = pin_number;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_digital_write_call_node(ast_node_expression *pin_number, ast_node_expression *value)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_DIGITAL_WRITE_CALL;
utility_function_call->pin_number = pin_number;
utility_function_call->value = value;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_delay_call_node(ast_node_expression *time_ms)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_DELAY_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = time_ms;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_pwm_call_node(ast_node_expression *freq, ast_node_expression *duty)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_PWM_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = freq;
utility_function_call->duty_cycle = duty;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_start_counter_call_node()
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_START_COUNTER_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_stop_counter_call_node()
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_STOP_COUNTER_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_read_counter_call_node()
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_READ_COUNTER_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_init_rpmsg_call_node()
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_INIT_RPMSG_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_recv_rpmsg_call_node()
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = AST_NODE_RECV_RPMSG_CALL;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_send_rpmsg_call_node(int node_type, ast_node_expression *rpmsg_data)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = node_type;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = rpmsg_data;
utility_function_call->symbol_entry = NULL;
return utility_function_call;
}
ast_node_utility_function_call *create_send_rpmsg_call_node_arrays(int node_type, sym_ptr array_identifier)
{
ast_node_utility_function_call *utility_function_call = (ast_node_utility_function_call*)malloc(sizeof(ast_node_utility_function_call));
utility_function_call->node_type = node_type;
utility_function_call->pin_number = NULL;
utility_function_call->value = NULL;
utility_function_call->time_ms = NULL;
utility_function_call->frequency = NULL;
utility_function_call->duty_cycle = NULL;
utility_function_call->rpmsg_data = NULL;
utility_function_call->symbol_entry = array_identifier;
return utility_function_call;
}
ast_node_print_string_function_call *create_print_string_function_call_node(char *string, int add_newline)
{
ast_node_print_string_function_call *print_function_call = (ast_node_print_string_function_call*)malloc(sizeof(ast_node_print_string_function_call));
print_function_call->node_type = AST_NODE_PRINT_STRING_FUNCTION_CALL;
print_function_call->add_newline = add_newline;
print_function_call->string = string;
return print_function_call;
}
ast_node_print_expression_function_call *create_print_expression_function_call_node(ast_node_expression *expression, int add_newline)
{
ast_node_print_expression_function_call *print_function_call = (ast_node_print_expression_function_call*)malloc(sizeof(ast_node_print_expression_function_call));
print_function_call->node_type = AST_NODE_PRINT_EXP_FUNCTION_CALL;
print_function_call->add_newline = add_newline;
print_function_call->expression = expression;
return print_function_call;
}
void ast_node_dump(ast_node* ast)
{
ast_node_type(ast->node_type);
int i = 0;
ast_node *temp;
vec_foreach(&ast->child_nodes, temp, i)
{
ast_node_type(temp->node_type);
}
}
void ast_node_type(int node_type)
{
switch (node_type)
{
case AST_NODE:
printf("ast node");
break;
case AST_NODE_TRANSLATIONAL_UNIT:
printf("ast translational unit");
break;
case AST_NODE_STATEMENTS:
printf("ast statements");
break;
case AST_NODE_FUNCTION_DEFS:
printf("ast function definition");
break;
case AST_NODE_COMPOUND_STATEMENT:
printf("ast compound statement");
break;
case AST_NODE_EMPTY_STATEMENT:
printf("ast empty statement");
break;
case AST_NODE_DECLARATION:
printf("ast declaration");
break;
case AST_NODE_ARRAY_DECLARATION:
printf("ast array declaration");
break;
case AST_NODE_ASSIGNMENT:
printf("ast assignment");
break;
case AST_NODE_ARRAY_ASSIGNMENT:
printf("ast array assignment");
break;
case AST_NODE_ARITHMETIC_EXP:
printf("ast arithmetic expression");
break;
case AST_NODE_BOOLEAN_EXP:
printf("ast boolean expression");
break;
case AST_NODE_RELATIONAL_EXP:
printf("ast relational expression");
break;
case AST_NODE_LOGICAL_EXP:
printf("ast logical expression");
break;
case AST_NODE_RANGE_EXP:
printf("ast node range expression");
break;
case AST_NODE_CONSTANT:
printf("ast constant");
break;
case AST_NODE_CONSTANT_CHAR:
printf("ast_constant_char");
break;
case AST_NODE_VARIABLE:
printf("ast variable");
break;
case AST_NODE_CONDITIONAL_IF:
printf("ast if statement");
break;
case AST_NODE_CONDITIONAL_ELSE_IF:
printf("ast elseif statement");
break;
case AST_NODE_LOOP_FOR:
printf("ast for statement");
break;
case AST_NODE_LOOP_WHILE:
printf("ast while statement");
break;
case AST_NODE_LOOP_CONTROL:
printf("ast control statement");
break;
case AST_NODE_LOOP_BREAK:
printf("ast break statement");
break;
case AST_NODE_LOOP_CONTINUE:
printf("ast continue statement");
break;
case AST_NODE_FUNC_CALL:
printf("ast function call");
break;
case AST_NODE_FUNC_PARAM:
printf("ast parameters");
break;
case AST_NODE_FUNC_ARGS:
printf("ast arguments");
break;
case AST_NODE_DIGITAL_READ_CALL:
printf("ast digital read");
break;
case AST_NODE_DIGITAL_WRITE_CALL:
printf("ast digital write");
break;
case AST_NODE_DELAY_CALL:
printf("ast delay");
break;
case AST_NODE_PWM_CALL:
printf("pwm call");
break;
case AST_NODE_START_COUNTER_CALL:
printf("start counter call");
break;
case AST_NODE_STOP_COUNTER_CALL:
printf("stop counter call");
break;
case AST_NODE_READ_COUNTER_CALL:
printf("read counter call");
break;
case AST_NODE_INIT_RPMSG_CALL:
printf("init rpmsg call");
break;
case AST_NODE_RECV_RPMSG_CALL:
printf("recv rpmsg call");
break;
case AST_NODE_SEND_RPMSG_CALL:
case AST_NODE_SEND_INT_RPMSG_CALL:
case AST_NODE_SEND_CHAR_RPMSG_CALL:
case AST_NODE_SEND_BOOL_RPMSG_CALL:
case AST_NODE_SEND_INTS_RPMSG_CALL:
case AST_NODE_SEND_CHARS_RPMSG_CALL:
case AST_NODE_SEND_BOOLS_RPMSG_CALL:
printf("send rpmsg call");
break;
case AST_NODE_PRINT_STRING_FUNCTION_CALL:
printf("print_string function call");
break;
case AST_NODE_PRINT_EXP_FUNCTION_CALL:
printf("print_expression function call");
break;
default:
printf("ast invalid");
break;
}
printf("\n");
}