Re: Plugin that parse tree

2011-01-27 Thread Daniel Marjamäki
I see. Good. 2011/1/27 Tom Tromey : >> "Ian" == Ian Lance Taylor writes: > > Ian> The problem with warnings for this kind of code in C/C++ is that it > Ian> often arises in macro expansions.  I think it would be necessary to > Ian> first develop a scheme which lets us determine whether code r

Re: Plugin that parse tree

2011-01-27 Thread Tom Tromey
> "Ian" == Ian Lance Taylor writes: Ian> The problem with warnings for this kind of code in C/C++ is that it Ian> often arises in macro expansions. I think it would be necessary to Ian> first develop a scheme which lets us determine whether code resulted Ian> from a macro expansion or not, w

Re: Plugin that parse tree

2011-01-25 Thread Ian Lance Taylor
Kevin André writes: > Is that ever going to be fixed? If a front end mangles its AST > representation, then it cannot be used for static analysis. > > Even if the constant folding in the front end is necessary for > checking semantics, you could still keep the original source in the > AST and sim

Re: Plugin that parse tree

2011-01-25 Thread Kevin André
On Mon, Jan 24, 2011 at 16:49, Ian Lance Taylor wrote: > Daniel Marjamäki writes: > >> Do you have any opinion about adding a warning for: >> >> int f(char c) >> { >>     return 10 * (c == 13) ? 1 : 2; >> } >> As far as I see the multiplication doesn't exist in the gimple format >> (looking at a

Re: Plugin that parse tree

2011-01-25 Thread Daniel Marjamäki
2011/1/24 Ian Lance Taylor : > Daniel Marjamäki writes: > >> 2011/1/24 Ian Lance Taylor : >> >>> The problem with warnings for this kind of code in C/C++ is that it >>> often arises in macro expansions. >> >> I see... so it won't be included in gcc. :-( > > Actually, I think it could be included i

Re: Plugin that parse tree

2011-01-24 Thread Ian Lance Taylor
Daniel Marjamäki writes: > 2011/1/24 Ian Lance Taylor : > >> The problem with warnings for this kind of code in C/C++ is that it >> often arises in macro expansions. > > I see... so it won't be included in gcc. :-( Actually, I think it could be included in gcc, provided you (or somebody) first i

Re: Plugin that parse tree

2011-01-24 Thread Daniel Marjamäki
2011/1/24 Ian Lance Taylor : > The problem with warnings for this kind of code in C/C++ is that it > often arises in macro expansions. I see... so it won't be included in gcc. :-( It was my goal to get it into GCC. But I still think it's an interesting idea that I'll look into. Regards, Daniel

Re: Plugin that parse tree

2011-01-24 Thread Ian Lance Taylor
Daniel Marjamäki writes: > Do you have any opinion about adding a warning for: > > int f(char c) > { > return 10 * (c == 13) ? 1 : 2; > } > > The multiplication has no effect. The function returns either 1 or 2. > > It would be interesting to know how a MELT script could look like for > such

Re: Plugin that parse tree

2011-01-24 Thread Daniel Marjamäki
Do you have any opinion about adding a warning for: int f(char c) { return 10 * (c == 13) ? 1 : 2; } The multiplication has no effect. The function returns either 1 or 2. It would be interesting to know how a MELT script could look like for such a case. As far as I see the multiplication do

Re: Plugin that parse tree

2011-01-24 Thread piervit
Hello! I am discovering gcc and his plugin system. I have tried MELT. I would like to say that the lispy syntax is not so difficult. It mights look unattractive to have such number of parenthesis but we quikly get used to the structure. The harder for me is to have a good view of the GCC interna

Re: Plugin that parse tree

2011-01-23 Thread Daniel Marjamäki
Hello! > Either change your test file to .cpp, or add "-x c++" to the command-line. that worked. thank you. I don't want to limit my plugin to C++. But to start with it is ok. > The major issue is to understand all the details of GCC internal > representations (i.e. Trees, Gimples). Did you u

Re: Plugin that parse tree

2011-01-23 Thread Dave Korn
On 23/01/2011 10:58, Daniel Marjamäki wrote: > I fail to use 'global_namespace': > daniel@daniel:~/gcc/build/gcc$ ./xgcc -fplugin=./myplugin2.so -c test1.c > cc1: error: cannot load plugin ./myplugin2.so You're running the C compiler (cc1) here, not the C++ one (cc1plus), because you've passed

Re: Plugin that parse tree

2011-01-23 Thread Basile Starynkevitch
On Sun, 23 Jan 2011 15:49:48 +0100 Daniel Marjamäki wrote: > GCC-MELT is an interesting project. But it seems to be very difficult > to write lisp scripts. You don't have a C interface also, do you? The few people who tried writing MELT code are founding on the contrary that coding in MELT is ea

Re: Plugin that parse tree

2011-01-23 Thread Daniel Marjamäki
GCC-MELT is an interesting project. But it seems to be very difficult to write lisp scripts. You don't have a C interface also, do you? I would like to see how I can use plain C. Regards, Daniel 2011/1/23 Basile Starynkevitch : > On Sun, 23 Jan 2011 11:58:21 +0100 > Daniel Marjamäki wrote: > >

Re: Plugin that parse tree

2011-01-23 Thread Basile Starynkevitch
On Sun, 23 Jan 2011 11:58:21 +0100 Daniel Marjamäki wrote: > Hello! > > I want to write a plugin that parse the AST. Could I get some hint > about how to do it? You could use GCC MELT for that purpose. See www.gcc-melt.org Regards -- Basile STARYNKEVITCH http://starynkevitch.net/Basi

Plugin that parse tree

2011-01-23 Thread Daniel Marjamäki
Hello! I want to write a plugin that parse the AST. Could I get some hint about how to do it? I have been reading this excellent article: http://codesynthesis.com/~boris/blog/2010/05/10/parsing-cxx-with-gcc-plugin-part-2/ The problem is that I fail to follow those advices. I fail to use 'global

Re: parse tree

2010-02-17 Thread Andrew Haley
On 02/17/2010 04:50 AM, dib.cool...@gmail.com wrote: > hi... > I am a student of b.sc first yr in comp.science > can you tell me > > which parsing technique is used in ANSI c language and in gcc? A hand-written recursive descent parser. It's in gcc/c-parse.c. > an

parse tree

2010-02-16 Thread dib . coolguy
hi... I am a student of b.sc first yr in comp.science can you tell me which parsing technique is used in ANSI c language and in gcc? and how the parse tree is generated in parsing phase? For instance if a code fragment is : #include int main(){ int a[50],i; for (i=0;i<50;i++) scanf(

Re: about the parse tree

2005-04-12 Thread Mike Stump
On Monday, April 11, 2005, at 07:47 PM, zouq wrote: i want very much to learn more about the parse tree in gcc. tree.def is fairly dense and contains many of the details about trees. Have you read that? can some one show me some way to learn it a little easier, i have tried to debug it, but

about the parse tree

2005-04-11 Thread zouq
i want very much to learn more about the parse tree in gcc. but it`s much more complicate than i have thought. can some one show me some way to learn it a little easier, i have tried to debug it, but the structure is difficult to understand, and i can`t find any document about it, except the