STR-721: bug with pp-c
I just started to learn stratego for C-transformation, and I had a problem with pp-c.
$ cat original.c
#include "stdio.h" typedef struct A { int a; } A; int main(void) { A** app; A* ap; A a; a.a = 2; ap = &a; app = ≈ printf("value=%i
", (*app)->a);
}$ cat original.c | parse-c | pp-c > bug.c
$ cat bug.ctypedef struct A { int a; } A; int main (void) { A * * app; A * ap; A a; a.a = 2; ap = &(a); app = &(ap); printf("value=%i
", *(app)->a);
}The transformed code does not compile because of *(app)->a. Isn’t this a bug?
$ gcc bug.c
Submitted on 27 April 2007 at 05:52
bug2.c: In functionmain': bug2.c:15: error: request for member
a’ in something not a structure or union
Issue Log
STR-721, martin:
Yes, this is a bug, but I don’t think we will fix this. The C grammar that is part of Stratego/XT is rather poor and it is not intended to be used to implement real C transformations. It’s main purpose is pretty-printing the generated code of the Stratego compiler. For this reason we have removed the tools parse-c and pp-c from the latest unstable distributions (the tool parse-c gave many people the impression that this tool can actually be used to parse C ;) ).If you want to do something with C, then I advice to use the C grammar and tools of the C-Transformers project, or the C grammar of the SDF Library (but that one does not come with a pretty-printer).
Log in to post comments