Generate Syntax Colors for a Domain Specific Language

In about 15 minutes of work, without typing a single line of actual code, I created syntax coloring for the domain specific language described here.

The result in a JEditorPane (and notice the non-printable characters are displayed, optionally, too) is as follows:

The user of the application is able to customize the colors:

Again, I did not type a single line of code to create the above. It was all as simple as using a lexer generator (JavaCC in this case) and then connecting the generated files into 100% standard NetBeans Lexer API implementations. I.e., all copy and paste stuff, together with a small bit of configuration and tweaking.

If anyone is interested in step by step instructions for getting to the above, again, without doing any actual coding at all, please leave a message and, based on whether there is some demand for this, I'll write a tutorial describing the procedure for this particular domain specific language.

Update: Here is a YouTube movie describing step by step how to do the above, which I created because of comments below asking for a tutorial:


I would be interested in a tutorial. Thanks.

Posted by Chris on January 22, 2012 at 04:23 AM PST #

I like to have the tutorial. I am working for Peoplesoft ERP

Posted by Nagarajan on January 22, 2012 at 05:15 AM PST #

while (true) { beg("Please provide a tutorial!"); }

That's really useful and current tutorials are old or takes a lot more than 15 minutes... :)

Posted by Eduardo Costa on January 22, 2012 at 06:29 AM PST #

Which tutorial is old, Eduardo?

Posted by Geertjan on January 22, 2012 at 08:37 AM PST #

I would like to see this tutorial as well. I made a tutorial using ANTLR and it took more than 15 min to implement.

Posted by James Reid on January 22, 2012 at 09:16 AM PST #

Write the tutorial, please. My users create their own syntax every other month.

Posted by Daniel Zamora on January 22, 2012 at 09:22 AM PST #

I would really appreciate a tutorial on how to do this too :)

Posted by Anthony Ve on January 22, 2012 at 01:42 PM PST #

I would like to see the above mentioned tutorial come to pass.

Posted by guest on January 22, 2012 at 06:20 PM PST #

Very interesting, I'll be very interesting as well by a tutorial

Posted by Ouaibsky on January 23, 2012 at 09:26 AM PST #

Here it is:

Posted by Geertjan on February 13, 2012 at 10:59 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016