Hi Geertjan!

Well, this is very good news!

Since I did some work in the cnd area let me know if you have any questions on the status of Apache cnd [1].

I have been wanting to read and answer this email for several weeks without success [2]. Let me try to do that now. I'm afraid I'll have to make some questions (but be warned these may be stupid questions at these hours).

Kind regards,
Antonio

[1] I don't have free time anymore, so just send me direct email instead.

[2] As you may know there were _two_ Java releases in recent weeks.

El 5/11/26 a las 11:36, Geertjan Wielenga via dev escribió:
Hi all,

I now have the full 8.2 C/C++ plugin compiled and working in Apache
NetBeans 31:

https://github.com/geertjanw/cnd

Ok. This is CDDL+GPLv2. ASF doesn't like that.


I also have the subset that was donated to Apache from Oracle compiled and
working in Apache NetBeans 31:

https://github.com/geertjanw/cnd-apache

This is based on NetBeans CND branch, right? If so this is APLv2 (and I imagine you want to keep this APLv2 with those additional commits I see there). So this works in NetBeans 31. Good!

I'm confused, because the "subset that was donated to Apache from Oracle" could never be ran because it was missing cnd.antlr (or cnd.apt?).


I propose that we, for the next release of Apache NetBeans, i.e, after the
Apache NetBeans 32 release we're currently working on, to take the Apache
Netbeans cnd branch:

https://github.com/apache/netbeans/tree/cnd

...and fix it up as I did at https://github.com/geertjanw/cnd-apache and

By "fix it" you mean make the current cnd branch work in NetBeans 31, right?

that we then include it from then on, with me (and hopefully others) as
maintainers, plus I'll create a plugin of the delta between the above two
repos, i.e., just the Oracle NetBeans 8.2 C/C++ editor functionality
upgraded to the latest release, and make that available as a plugin in the
Plugin Portal (plus a button when C/C++ is enabled 'click here for a great
editor experience' or something).

So what you mean is that NetBeans will have an upgraded "cnd" branch that builds on top of NetBeans 31 (and later) and that you then will be keeping a plugin in the Plugin Portal with the other pieces (CDDL licensed) from the 8.2 CND branch. Am I understanding correctly?

If I'm understanding correctly until here then let's continue. If not then just forget the comment/rant below.


Comments, feedback, praise, and resistance, very welcome. :-)

** CND:  The original 8.2 CCDL/GPLv2 licensed code.

CND is a very old codebase with _lots_ of hacks. This includes abusing System properties that modify the way it works or the way it tests things (also the Java version is around JDK6 or JDK8). This is so because Sun used CND to build some other products (Sun Studio IDE, for instance) and so does Oracle with his Oracle Developer Studio [3].

<intermission>I imagine Oracle wouldn't be happy to have an open source C/C++ alternative to Oracle Developer Studio</intermission>

CND is (was?) very good at understanding the C/C++/Fortran/ASM grammars. Also CND was able to understand the C preprocessor directives very well, including evaluating things at runtime, which is a pretty hard task. - The "cnd.apt" module [4] (APT - Abstract Processing Tree) understood the C/C++ preprocessor. - The "cnd.asm" module [5] was able to build an Abstract Syntax Tree of different assembly languages.
- And so for C anc C++ and Fortran.

IIRC the cnd.api.model [6] was used to have a in-memory representation of the differnet languages.

Maintaining all this CND infrastructure and keeping it up-to-date with recent C/C++ versions is difficult. The Antlr version used in CND is very old (and had licensing issues) and updating the grammars for new C or C++ versions is complicated.

The benefits of all this is that (as somebody said in another thread) you can open very large projects (including complex #if/#ifdef blocks) and give the user good hints about the codebase by understanding the grammar of the source code without consuming many resources.

Also CND included some parts of LLVM (https://llvm.org/) which were transpiled from C++ to Java (probably with a precursor of Graal). This allows you to further analyze C/C++ code (having something similar to https://clang.llvm.org/docs/LibClang.html).

CND had many other features. For instance, the formatting/indenting of C/C++ was spectacular, and has very complex user interface with lots of options.

Finally CND had a superb debugger support, that included the GDB debugger _and_ the DBX debugger (Solaris). For GDB this used GDB/MI. So good that a binary version of this CDDL code is included in Apache Netbeans as an external dependency.

** cnd - The APLv2 branch

The APLv2 branch delegates all this understanding of the syntax and grammars of C and C++ to an external LSP server, be it ccls (cpplite, where you specify the "compile-commands.json" [7] by hand) or clangd (by generating a "compile-commands.json" from Makefiles).

The advantages of using an LSP server for all this work are well known: you delegate the responsibility of keeping up-to date with C/C++ grammar changes to other team (the one that builds the LSP server) at the cost of using an LSP server that consumes more resources, and that may hiccup when confronted with large codebases.


So to summarize all this nonsense: the plan to update the "cnd" branch to compile with latest NetBeans version and the use other "CND" (CDDL) stuff as plugins sound great, but may or may not work when working together because CND and cnd use different approaches to C and C++ grammar.

So here goes another question: can you clarify what "click here for a great editor experience" actually means for you? What would you like to have?

Maybe thinking of the features you need first will save some time.

For instance, the editor support for syntax-highlighting Makefiles, C/C++, Shell scripts, DWARF support, etc. is easy to extract from CND and include in cnd in advance.

Also C/C++ formatting is not worth doing with the CND code, I think. People now use ".clang-format" or similar tools (https://editorconfig.org/) for huge projects (e.g. the Linux Kernel).

Thanks and kind regards,
Antonio

[3] https://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/o11-152-ide-brief-1405348.pdf

[4] https://github.com/geertjanw/cnd/tree/main/cnd/cnd.apt

[5] https://github.com/geertjanw/cnd/tree/main/cnd/cnd.asm/

[6] https://github.com/geertjanw/cnd/tree/main/cnd/cnd.api.model

[7] https://clang.llvm.org/docs/JSONCompilationDatabase.html


Gj


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to