On Tue, 2010-05-18 at 15:59 +0200, Michael Matz wrote: > Hi, > > On Tue, 18 May 2010, Diego Novillo wrote: > > > On Mon, May 17, 2010 at 16:15, Sandeep Soni <soni.sande...@gmail.com> wrote: > > > > > 1. What should be the format of representation of the GIMPLE tuples in > > > text? > > > > I liked Andrew's suggestion about S-expressions. > > I can see that for describing types, maybe. But isn't that artificially > awkward for representing tuple instructions? I mean most instructions > will look like > > (= i_1 (+ k_1 m_1)) > or > (= j_1 (call func arg1 arg2)) > > I don't see how that is much easier to parse compared to > i_1 = k_1 + m_1 > j_1 = func (arg1, arg2)
My intuition might be that once a Gimple parser exists, most of its use would be writing various translators (e.g. external front-ends) to this syntax, so people might probably code more Gimple-syntax printers than Gimple-syntax parsers. Still, I prefer the Lispy S-expression syntax everywhere -including Gimple- because it is so simple to define and to implement, and because GCC MELT already have [almost] the infrastructure for it. However, I tend to think that the Gimple syntax would also [at least optionally] contain the location information, so it would be instead (= (@ "foo.cobol" 23 2) i_1 (+ k_1 m_1))) or even (= (@ "foo.cobol" 23 3) i_1 (+ (@ "foo.cobol" 23 5) k_1 m_1))) I am using, perhaps wrongly, @ as an "operator" giving the location information as a file name, line number, column number. I am not sure to have the syntax right (because I am not sure to remember what exactly has a location information). I believe a Gimple-syntax should provide the features (or hooks, or syntax) to convey all the Gimple information, and this includes the source file location. This is needed both for external (GPLv3+ or compatibly licensed) programs producing Gimple (such as an hypothetical Cobol frontend) and for external (GPLv3+ or compatibly licensed) programs consuming Gimple (like sophisticated static analyzers) or for external programs both consuming & producing Gimple (e.g. an "optimization" implemented by an external program). Otherwise, what is the purpose of Gimple-syntax? Why making it if it does not contain all the information inside GCC? BTW, is it possible today to have a GCC plugin providing a front-end to GCC? [last time I looked, I believe the answer is no] Cheers.