X

Geertjan's Blog

  • January 22, 2012

Generate Syntax Colors for a Domain Specific Language

Geertjan Wielenga
Product Manager

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: http://www.youtube.com/watch?v=aOwdeoOlZ7E

Join the discussion

Comments ( 10 )
  • Chris Sunday, January 22, 2012

    I would be interested in a tutorial. Thanks.


  • Nagarajan Sunday, January 22, 2012

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


  • Eduardo Costa Sunday, January 22, 2012

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

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


  • Geertjan Sunday, January 22, 2012

    Which tutorial is old, Eduardo?


  • James Reid Sunday, January 22, 2012

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


  • Daniel Zamora Sunday, January 22, 2012

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

    Gracias.


  • Anthony Ve Sunday, January 22, 2012

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


  • guest Monday, January 23, 2012

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


  • Ouaibsky Monday, January 23, 2012

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


  • Geertjan Monday, February 13, 2012
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.