April 2, 2013

My P4 Exploration of Xtext

Community

Back in 2011, I attended an Eclipse DemoCamp hosted by eBay. I saw an interesting talk on how to create your own language using the Xtext framework. The presenter gave a great overview of this tool and walked the audience through a couple of examples. I was fascinated by the creation of domain-specific languages and Xtext's utilization of features that Eclipse users know and love.

With this in mind, I had an idea to explore some of the features of Xtext using the p4 command line as an example. After going through the online tutorial, I was able to define keywords in a grammar and view p4 commands in Eclipse with the appropriate syntax coloring.

p4 syntax coloring example

One sleepless night, I discovered an awesome set of hand drawn icons. I decided to introduce some of these icons into the Outline view. (Yes, this is what I do when I can't sleep at night.)

outline view example

In addition to the Outline view, I thought these icons would also be a great companion to content assist.

content assist example

There is still much more to learn but I found this to be a great starting point. I encourage anyone that's interested to go through the Xtext tutorials and give it a try. I've submitted what I've done so far into the public depot at //depot/guest/liz_lam/p4dsl.

Feel free to check it out and I hope it helps in your own explorations.