[HN Gopher] Extracting the abstract syntax tree from GCC (2015)
___________________________________________________________________
Extracting the abstract syntax tree from GCC (2015)
Author : edward
Score : 25 points
Date : 2021-03-26 10:37 UTC (1 days ago)
(HTM) web link (lwn.net)
(TXT) w3m dump (lwn.net)
| new_realist wrote:
| Free software intentionally hobbled for political ends. For the
| best software, go elsewhere.
| new_realist wrote:
| Just another example of poor leadership from Stallman.
| jhgb wrote:
| Yep, it should have been GCC, not LLVM, that earned Apple more
| big bucks. Totally a bad decision.
| Ericson2314 wrote:
| It's really depressing to see these people not believe copy left
| is enough, and think we have to main our programs and make them
| less composible in addition. Intentional impediments to code
| interopt are absolute heresy given my own ideology of free
| software, and I wish rather than being on the defensive someone
| would argue that more forthrightly.
|
| I hope in the last 5 years the situation has changed.
| kmeisthax wrote:
| Richard Stallman's schtick with copyleft isn't so much to lock
| a particular program into a Free Software license, it's to use
| Free Software as a cudgel to demand licensing concessions from
| other software vendors.
|
| An obvious example of this would be GPLv3's anti-TiVo clause,
| although in that _particular_ case there 's a direct connection
| between locking down hardware and your nominal right to modify
| the software being practically curtailed. The bargain the GPL
| tries to strike is "you can do whatever you like with the
| program as long as you don't restrict the user's freedoms to
| use, distribute, or modify the program". GPLv2 only talks about
| legal restrictions to user freedom, v3 extends that to curtail
| technical restrictions, too.
|
| One oft-overlooked controversy is that of GNU readline. You
| see, RMS decided _specifically_ to release readline as a _GPL
| library_ so that anything that used it had to be GPL, too. This
| actually worked - for example, CLISP relicensed itself
| specifically to comply with GPL terms on readline. There 's an
| old e-mail thread between RMS and CLISP's author, Bruno Haible,
| which I'm going to have to make an extended quote of as it's
| _really_ telling:
|
| (quoted from https://web.archive.org/web/20131111095101/http://
| clisp.cvs....)
|
| Bruno: I could provide a libnoreadline.a and let the user
| choose to link lisp.a with either GNU's libreadline.a or my
| libnoreadline.a . Would that convince you that lisp.a "can be
| reasonably considered independent and separate work" ?
|
| RMS: No, and I doubt it would convince a judge either. I'll
| have to insist that you stop using readline unless you make the
| program free.
|
| Bruno: If someone was to turn the readline library into a
| shared library (a library that is needed at runtime by the
| executable, but not contained in the executable): Would that
| mean that any executable that uses a readline shared lib would
| have to be accompanied with full source?
|
| RMS: Yes. The sum total of what you are doing is still
| tantamount to distributing one program which contains readline
| but is not under the GPL.
|
| Bruno: So the only reason why you may object is that my lisp.a
| has an INTERFACE that allows it to be linked to libreadline.a .
| As far as I know, only the readline CODE is copyrighted, not
| its INTERFACE. (Would you object because my libnoreadline.a has
| a similar interface?)
|
| RMS: I say this based on discussions I had with our lawyer long
| ago. The issue first arose when NeXT proposed to distribute a
| modified GCC in two parts and let the user link them. Jobs
| asked me whether this was lawful. It seemed to me at the time
| that it was, following reasoning like what you are using; but
| since the result was very undesirable for free software, I said
| I would have to ask the lawyer.
|
| What the lawyer said surprised me; he said that judges would
| consider such schemes to be "subterfuges" and would be very
| harsh toward them. He said a judge would ask whether it is
| "really" one program, rather than how it is labeled.
|
| ---
|
| RMS doesn't entirely answer the question about interfaces,
| because he responds with an example about NeXT, but I can smell
| the same logic here. Bruno is asking if APIs carry copyright,
| and Richard Stallman does not say no. He specifically argues
| that the existence of a version of CLISP that can be linked
| with readline is enough to trip the GPL. This is dangerously
| close to the Oracle v. Google case, played out 30 years ahead
| of it's time on a private mailing list between two people who
| really shouldn't be fighting.
|
| The only reason why RMS doesn't explicitly say "yes APIs are
| copyrightable" is probably because...
|
| 1. Arguing against Free reimplementations is hypocritical -
| especially today when we have three non-GPL readline
| implementations.
|
| 2. Bruno decided to GPL CLISP anyway (because Linux was getting
| lots of contributions).
|
| I'm surprised the FSF hasn't commented on this case further,
| though I can imagine why. Seeing the absolute stalwart of Free
| Software argue in favor of Larry Ellison has been a huge yikes
| moment for me. In fact, one way to interpret Oracle v. Google
| (in the light of OpenJDK existing), is that of a massive GPL
| compliance lawsuit. Free reimplementation is how we _got_ GNU
| and BSD; but RMS being any kind of right here imperils the
| right to reimplement... all so that Steve Jobs couldn 't extend
| GCC.
| emmanueloga_ wrote:
| I remember reading an article about the difficulties of
| extracting AST from clang [1]. Even when there are less politics
| involved, seems like a hard problem. With GCC, the problem
| becomes an Stallman order of magnitude harder :-)
|
| 1: https://foonathan.net/2017/04/cppast/
| rektide wrote:
| llvm used to have a -ast-dump-xml that I used but it got removed
| in like 2009 or so.
|
| annoying. wish tools would free the information inside.
| johndough wrote:
| There is clang -Xclang -ast-dump=json
| -fsyntax-only main.c
|
| these days. Probably not exactly the same, but still very
| useful.
| yudlejoza wrote:
| Wait, wait, wait. I was going to point out llvm/clang, but they
| disabled that too?
|
| It's a BSD/MIT-license tool. Any idea why they did that?
|
| second big-picture question: how hard is it to code up ast (as
| long as the source language is not C++)? we have lexers,
| parser, PEGs, what not.
| detaro wrote:
| AFAIK the xml-ast was always just intended as a debugging
| tool for llvm developers, not an API for externals (and thus
| came with no stability promise). You always were supposed to
| just link against clang/llvm and use the APIs it specifically
| provides to access the AST.
| Someone wrote:
| The best way to get that info nowadays likely is through
| libclang, but other options are clang plugins, lib tooling, or
| Clang tools.
|
| See https://clang.llvm.org/docs/Tooling.html for considerations
| on what approach to pick.
| touisteur wrote:
| Yes, libadalang, inspired by libclang, is 'it' for me. And I
| can write queries directly instead of parsing some
| intermediary shit and wishing I was after generic
| instantiation... I worked around gnat2xml but it's faaaaar
| better like this.
___________________________________________________________________
(page generated 2021-03-27 23:00 UTC)