Question

The question of today is the following: I'm developing a code generator for my department at university. It's very simple: they want to use a custom "scripting" language really human readable, parse that and then translate these instructions in Java. I used SableCC to do the trick, it was really smooth. The problem now is that I have to create a plugin editor for Eclipse, mainly for a syntax highligthing purpose and possibly to catch validation errors.

I've found many tutorials about "how to create a custom editor in Eclipse" but what I can't figure out is: I've already created my parser and my scanner rigth? It's nonsense to do that again for the editor. Is there a way to integrate my scanner inside the plugin? What class should I extend or implement? Can you suggest any tutorial?

Was it helpful?

Solution

I'd suggest to look into Xtext - you would basically have to port your grammar to the Xtext format, but from there, Xtext generates a full Eclipse editor with syntax coloring, error marking, outline view, content assist, etc. Also, as you mention code generation, it will allow you to generate code from the parsed input easily using Xpand, a statically typed template language. They have very nice tutorials and screencasts on their site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top