[antlr-interest] Any HTML editors for rich editing of documents conforming to an ANTLR grammar?

Sam Harwell sharwell at pixelminegames.com
Fri Jul 29 08:16:32 PDT 2011


Hi Colin,

In very general terms, the task at hand is you'd like to create an IDE for a
language described by an ANTLR grammar. I haven't used either of these
products, but the closest groups I know of to producing a product like you
describe below are Xtext: http://www.eclipse.org/Xtext/ and Actipro
SyntaxEditor:
http://www.actiprosoftware.com/products/dotnet/wpf/syntaxeditor/default.aspx

You probably shouldn't try to create a new solution in this area. I've been
working on IDEs for the past several years, and I can tell the task is
nowhere near as straightforward as it seems.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Colin Yates
Sent: Friday, July 29, 2011 5:32 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Any HTML editors for rich editing of documents
conforming to an ANTLR grammar?

Hi all,

Most of the products we develop use documents which are parsed by ANTLR to
describe the real world to the application.  These are none-trivial and need
to be internally consistent.  Some of these documents (not the grammar) can
run into hundreds of pages and asking people to edit them via notepad or a
HTML text area is, er, well, not the best :)

I have had a quick search for a tool to help write documents (that conform
to the grammar - *not* the grammar itself!) but came to the conclusion that
I am going to have to write my own.  The requirements I have are:

 - auto-suggest for syntactically valid constructs
 - auto-suggest for semantically valid constructs (for example, if the first
part of the grammar defines a list of Xs then when a X is referred to later
on it should auto-suggest an X, even if the construct for referring to X is
quoted text)
 - line and character high-lighting of syntactical or semantical validations
 - and so on....

Catching and identifying the location of syntax errors is pretty trivial (
http://yatesco.wordpress.com/2011/07/15/capturing-line-numbers-from-antlr-pa
rsing-errors/),
but that is just the start. One big issue is that there needs to be an API
that executes *very* quickly of the form:
List<Suggestion> calculateSuggestions(String currentWordFragment, int line,
int character) to retrieve a list of syntacticly and semantically correct
words.  To figure that out, there needs to be a way of identifying which
bits of grammar that position in the document has.

I don't want to write one editor specific to each grammar, rather I want to
abstract the required information into a generic library with one
implementation of ANTLR.

And I cannot, I just cannot believe I am the first person to want to do this
:).

So, a couple of questions - is there anything already out there that will do
this?  Would using an intermediate form tree, rather than constructing my
own internal representation help (I can't see that it would)?

Another way of asking is is "how do I use ANTLRWorks for documents that
conform to a grammar rather than the grammar itself" :)

Col

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list