Hi Mario,

I have written 3 language plugins for Netbeans.  I think the answer to your 
question depends on what you want to do, and what you already have in hand.

The Netbeans platform differentiates between support for lexing and support for 
parsing.  While I have not used JFlex, JFlex is a lexer / token generator.  You 
could add token coloring to NetBeans using it (glossing over details about how 
to adapt JFlex tokens to Netbeans).  Unlike a parser generator, JFlex won't 
parse syntax which by definition limits the functionality you'll be able to 
implement for your language users in the IDE.  As an aside, all of the JFlex 
web pages I've found without digging too deeply are circa 2011.

JavaCC and ANTLR are parser generators that create parsers that in turn 
generate syntax trees (again, glossing over important implementation details).  
In addition to finding errors in the users' input to support features like 
markup in the editor (as opposed to just coloring tokens with a lexer), 
components such as the Navigator need data that a parser can produce.

In my case my integrations use JavaCC for no other reason other than that I had 
already written the parsers for my languages in JavaCC (first and second order 
predicate logic languages, and a music language), but having walked through the 
ANTLR tutorials it seems to be a matter of personal preference at the end of 
the day.  My suggestion is use whichever one you're familiar with, or in my 
case already have code for which saved me the step of re-writing grammars for 
different parser generators.

I hope to be trying to migrate my language support to the Apache Netbeans 
platform soon, but other things have been persistently stuck at the top of my 
stack :-/.  At that point I will be able to speak to issues regarding JavaCC 
support moving forward.

Best,
Peter

________________________________
From: Mario Schroeder <ma.schroe...@gmail.com>
Sent: Tuesday, October 30, 2018 1:37 PM
To: dev@netbeans.incubator.apache.org
Subject: recommendation for language support

Hi,

I would appreciate when someone could set me on the right track. I'm
wondering what is the best way to write a plugin with a support for a new
language.

I have found this old tutorial:
http://wiki.netbeans.org/How_to_create_support_for_a_new_language
It uses JavaCC. The tutorial is linked to another one, which makes use of
ANTLR. When I have a look at NetBeans source code, there are some templates
written with JFlex. So I'm confused. Which one should I use?

I would prefer ANTLR, since there seems to be more documentation for it.
Does anyone have a recommendation?

Regards,
Mario

Reply via email to