Monday July 27, 2009
Lexing & Parsing on the NetBeans Platform
I went through the New Language Support Tutorial for the first time today. It uses javaCC to create an editor (syntax coloring and syntax checking) for a simple language using the new Parsing API. The result is this:
As I went through the tutorial, I tweaked some things slightly and added a few screenshots. Now most of it should be clearer than before. (I also included a link to the completed 'SJLanguageHierarchy.java' file, which should save a bit of time.)
Interestingly, members of the NetBeans Platform community have been creating an ANTLR version of the same tutorial, covering syntax coloring, syntax error checking, indentation, and formating. Not bad going, Jeff Johnston! Go here to see the index page of that set of tutorials:
http://wiki.netbeans.org/Netbeans_Rcp_Antlr_Integration_Index
On a related note, take a look at Thibaut Colar's FAN language support module (in progress here) and Pawel Boguszewski's recently released OCaml plugin, now available on Kenai. I don't think Pawel's plugin uses the new Parsing API, but I think Thibaut's one might be doing so, especially since he told me he found Caoyuan's Erlang plugin sources very useful.
There are several NetBeans Platform developers on the dev mailing list working on language support, including Andreas Stefik, Tomas Lazaro, Jason Cech, James Read, Ernie Rael, and the aforementioned Jeff Johnston. So, the mailing list is definitely the place you want to be for cutting edge info on language support on the NetBeans Platform.
I've added the start of a new section to the NetBeans Developer Wiki on parsing on the NetBeans Platform, which currently has two entries, one for javaCC and one for ANTLR.
Jul 27 2009, 10:47:15 AM PDT Permalink


