Live data from Hacker News

Extracting the abstract syntax tree from GCC

lwn.net

61–70 of 112 posts

Re: Extracting the abstract syntax tree from GCC

#61
post #53

Earlier quoted context omitted.

You're certainly free to keep typing this stuff however the irony is that we all understand RMS clear, consistent position on the matter. The issue is that, by his own admission, he doesn't understand the other side.

> we all understand RMS clear, consistent position on the matter. Then why are "we" all still using his software (which was given a license to match his philosophy) and complaining when he maintains his "clear, consistant position on the matter" and refuses to compromise his beliefs. To use a poor analogy, it's like going to church and complaining when they talk about God. There are lots of other options out there fo…

The fundamental issue is that for RMS (and perhaps you?), using software is like going to church and accepting the the moral code of whomever produced that software. However, for most people, that is not the case whatsoever. My baker can have all sorts of moral codes that I don't endorse when I eat his bread.

I don't support the FSF, I do support access to source code, and the freedom to extend the source code. Sometimes the FSF supports our shared goal, sometimes the FSF sees it other ways than I do, but that doesn't mean that I'm going to stop using emacs because I disagree with poor management of GCC.

The world is big enough for a plurality of ideologies.

Responding to your edit: >RMS popularity among newer programmers is always low (for the exact reasons outlined here, his software isn't "free" enough), and yet I find that after years of experience, we begin to appreciate that without his staunch support, we would be developing software in a very different world.

I find this to be an exceptionally unconvincing argument, because my experience has always been exactly the reverse. Newer programmers get excited about having access to source code, and they see RMS as the one saying the most about it, and just assume that RMS is responsible. After a while, they learn about the history of BSD and open source and realize that shared access to source code is a very natural way for software projects to develop. Without RMS being a frontman, we'd still the BSDs, we'd probably still have Linux. We'd have needed a compiler like GCC, but that void would probably have been filled sooner than Clang did it.

Re: Extracting the abstract syntax tree from GCC

#62

Its hard for me to come up with a way in which this is not RMS advocating restricting the freedom of users of GCC. If he is so opposed to proprietary software using GCC output why not use a license that prohibits that? Its not even too late for new versions since the FSF owns the copyright to all GCC code.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

Yep, and its a classic RMS move. This happened before: http://www.jwz.org/doc/lemacs.html

Re: Extracting the abstract syntax tree from GCC

#63
post #60

Earlier quoted context omitted.

While incidentally true and pursuant to his real goal, I don't believe this is his ultimate goal. His goal is, and always has been, to make sure that you as the user of the software built upon his work, are always capable of opening it up and looking under the hood, and making adjustments as you see fit. Throw a proprietory module on the end which relies on his work but gets around the GPL, and you've lost that right…

I believe you've just restated what I wrote. Quoting from the Free Software Definition page at https://www.gnu.org/philosophy/free-sw.html : > You should also have the freedom to make modifications and use them privately in your own work or play, without even mentioning that they exist. If you do publish your changes, you should not be required to notify anyone in particular, or in any particular way. There is nothin…

True! Sorry, I was responding mostly to this phrase:

> If gcc is diminished, then fewer people will be aware of, much less agree with or advance, the ideals of software freedom. The technical advantages of gcc are used as marketing for software freedom.

Re: Extracting the abstract syntax tree from GCC

#64

Earlier quoted context omitted.

> And yet, the referenced discussion breaks down into RMS on one side and people who want to make gcc work better for themselves on the other. At the risk of someone building a closed backend off an artifact of the GCC frontend; at the risk of someone profiting off RMS' work without following his conditions for making that work free. It's important to remember that he isn't against Emacs getting the information it ne…

Emacs does need the full AST. The whole point of Emacs is to allow users to write applications that were UNANTICIPATED by its developers. You can't predict exactly what sort of information users will need, so you can't make some "safe" amount of information available. It's mind boggling that this even needs to be explained. I get the sense that rms doesn't really grok the Emacs philosophy anymore.

Urk! You might well be right, I've been assuming he doesn't grok C++, which he doesn't use.

This would be terrible, for as far as I'm concerned, his single greatest contribution to computing is the EMACS philosophy that he developed out of a primitive set of TECO macros. (I believe everything else would have happened more or less, e.g. without Linux, BSD would be ruling now after a 2 year pause for that AT&T lawsuit.)

Re: Extracting the abstract syntax tree from GCC

#65

Its hard for me to come up with a way in which this is not RMS advocating restricting the freedom of users of GCC. If he is so opposed to proprietary software using GCC output why not use a license that prohibits that? Its not even too late for new versions since the FSF owns the copyright to all GCC code.

There are 2 different kinds of outputs here. A license that restricted or applied GPL to the object code emitted by the compiler would create gigantic waves. The compiler's AST isn't usually an output. This does seem like a dated issue, 20 years ago, there weren't as many C and C++ parsers, now there are a number of free ones. I feel pretty confident that 20 years ago, there would have been some proprietary compilers…

> I feel pretty confident that 20 years ago, there would have been some proprietary compilers derived from GCC if they could emit the AST in an unrestricted sort of way.

Your confidence is 100% justified, because Open64 exists. It always has been possible to emit AST from GCC by simply modifying GCC yourself to do so. GCC is a free software after all. Open64 did that, and AMD used to sell a compiler using GCC frontend together with highly optimizing proprietary backend. More on http://tirania.org/blog/archive/2004/Apr-18.html

What has not been possible is not to emit AST from GCC, but to emit AST from GCC and continue to benefit from GCC changes after that.

Re: Extracting the abstract syntax tree from GCC

#66
Typically, it's not a good idea to argue with RMS. The pragmatic approach would be to just write the plugin for GCC, and keep it separate. GNU can certainly control what is mainlined, but the GPL is not violated simply by creating a GPL plugin that provides a useful output target.

If Emacs were enhanced to support a standardized file format which contains the relevant information, then it could accept this format from any tool. The GCC plugin could output this format, as could Clang/LLVM. Because the format is universal, it likely would be mainlined.

Then, it's up to the user. If the user wants to integrate the two, the user can apply the appropriate patch to GCC to incorporate this independent plugin. Likely, many downstream package maintainers would add this as a standard option if demand were high enough. This is the very freedom that RMS has advocated for. It can be done without poking the bear.

Re: Extracting the abstract syntax tree from GCC

#67

This is precisely what we do in Renjin in order to translate C/Fortran to Java: https://github.com/bedatadriven/renjin/blob/master/tools/gcc... This little plugin simply dumps GCC's gimple to JSON, yielding for example: https://github.com/bedatadriven/renjin/blob/master/tools/gcc... LLVM's design looks very attractive, but for scientific computing Fortran is really important, and AFAICT, LLVM doesn't have an intermed…

> LLVM doesn't have an intermediate representation comparable to Gimple: LLIR seems to be at the level of the registers rather than the nice abstract Gimple

LLVM variables are sometimes called registers but they are machine independent. The bit width is arbitrary (e.g., you can create a 129-bit integer). The use of the term register is a misleading analogy; often LLVM-IR is compared to assembly language so the use of the term register was also used.

I do not know GIMPLE and couldn't find a good description of the IR instructions. But, it seems that LLVM IR is somewhat similar to low GIMPLE.

Re: Extracting the abstract syntax tree from GCC

#68
post #52

> It took many years before the GNU Compiler Collection (GCC) changed its runtime library exemption in a way that allowed for GCC plugins, largely because of fears that companies might distribute proprietary, closed-source plugins. Am I the only one who finds it ironic that purported "free as in freedom" software is/was being held back because of fears of what someone can do with that freedom? Though once useful, the…

The most free world is not the one where there are the fewest restrictions. Restricting peoples' natural freedom to kill each other or steal from each other, for example, arguably makes everyone more free. The GPL is based on the same principle. Restricting certain antisocial behavior increases net freedom.

"natural freedom to kill each other"

Although that's not a binary thing, I have the natural and legal right to kill in legitimate self-defense. In rare situations, stealing is allowed to prevent a greater loss.

In this case, most of us, even those of us who don't like the GPL in practice like me, are not primarily arguing the GPL, but RMS's stewardship of GCC and GNU Emacs about something that's allowed in I believe every FOSS license.

Just not in these two projects under the aegis of the FSF. Unless and until they fork, or RMS is somehow convinced, whic history says is not the way to bet.

Re: Extracting the abstract syntax tree from GCC

#69

Typically, it's not a good idea to argue with RMS. The pragmatic approach would be to just write the plugin for GCC, and keep it separate. GNU can certainly control what is mainlined, but the GPL is not violated simply by creating a GPL plugin that provides a useful output target. If Emacs were enhanced to support a standardized file format which contains the relevant information, then it could accept this format fro…

You're ignoring that a lot more work needs to be done in GNU Emacs, and that's another program under RMS's stewardship, and one where he could be much more obstructive.

The only outstanding threat to fork that I know of is coming from a GNU Emacs maintainer, to I believe fork GNU Emacs. Again. Oh boy, again to support C++ development! How could I have forgotten that?!?!?!!!

But you're right, arguing with RMS on this is likely to be completely unproductive. But it is morally necessary before potentially disastrous forking of GNU Emacs and maybe GCC.

Re: Extracting the abstract syntax tree from GCC

#70

This is why I prefer the BSD license for everything I do. In Stallman's universe, "freedom" only exists as long as it furthers his cause. What a waste. As far as I'm concerned, if I write something and release the source, I'm more than happy with people using it for whatever they want.

[deleted]
Post reply on HN