RE:Syntax checking

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu May 06 1999 - 12:05:24 MEST


Dear Damir,

>Among other things, I'm using ROOT for teaching, doing some simple
>simulation projects with students.

As user community grows, my original assumption does not
hold any more. I'll have to enlarge scope of usage.
This is an inevitable aspect of successful software and I take
this quite positive.

>Just as an example, a few students (they just begin C programming)
>sometimes put colons instead of semicolons in a "for" statement.
>for(i=0,i<10,i++) instead of for(i=0;i<10;i++)
>This crashes their ROOT 2.20 (have to upgrade, I know) session, even
>once quit ROOT without explanation.
>I don't know if the rewinding scheme implemented by masa solves this. 

This case, in particular, is a parsing problem of for statement. I fixed
this in cint5.14.2 so that ROOT session cleanly recovers.


>It works quite well, except for syntax checking, that is not the primary
>goal of cint, as Masa stated a few months ago. I agree with this, but I
>wonder if it would be difficult to implement a syntax checker, perhaps
>the one in gcc, before launching a macro. Do such things exist ?
>I would still like some sort of syntax checking before actually launching
>the macro. Through g++ ?
>
>Any comments ?

C has lint for syntax checking. I haven't heard similar tool for C++.
It is nice if there is such tool. 
There are 2 possible solutions ROOT team is considering for this needs.

1) I try to improve cint as you teach me specific problem. Things can be
   improved gradually with your feedback. Drawback is that as I implement
   more checking it adds parsing overhead. In most cases, this is not a
   big problem. But sometimes, overhead can be significant.

2) We are considering auto-compile capability for macros. This, not only 
   checks syntax, but also compiles and runs the macro on-the-fly with 
   the compiler.

Thank you
Masaharu Goto



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET