c refactor to remove struct

10 views
Skip to first unread message

yang wang

unread,
Jun 8, 2019, 10:57:17 PM6/8/19
to antlr-discussion
I'd like to refactor c code to remove struct using antl4. Who can give me some help?
example:
#include<stdio.h>

struct A
{
 
int a;
 
int b;
};

int main()
{
 
struct A t;
  t
.a = 3;
  t
.b = 4;
  printf
("t.a = %ld\n", t.a);
 
return 0;
}

to :

#include<stdio.h>
/*
struct A
{
  int a;
  int b;
};
*/

int main()
{
 
//struct A t;
 
int t_a;
 
int t_b;
 
//t.a = 3;
  t_a
= 3;
 
//t.b = 4;
  t_b
= 4;
 
 
//printf("t.a = %ld\n", t.a);
  printf
("t.a = %ld\n", t_a);
 
return 0;
}

Reply all
Reply to author
Forward
0 new messages