Open felixpk opened 2 years ago
/cib
Branch issue-38-_C2AST_Generate_AST_from_C_code created!
AbstractSyntaxTreeNode
Expression
Instruction
Operation
printf("i is %d\n", i);
becomes printf("i is %d\\n", i);
(encoding problem)
comments are ignored (pycparser limitation)
If the input code contains an array like int numbers[10];
we need to convert it to int *numbers = malloc(sizeof(int) * 10);
this implies that we also have to free
the allocated memory after the last usage of numbers
.
Structs are not implemented in dewolf
struct {
int age;
char* name;
} p1;
p1.age = 18;
p1.name = "Peter";
(Not sure how to convert it)
Proposal
Writing AST tests can be quite verbose, therefore I propose to implement a converter which translates c code to dewolfs AST implementation.
Approach