Hi Colin, I wasn't trying to say the DSL is a bad idea. I only meant that creating a full-featured editor is extremely challenging, and tends to not work as expected in the end (any combination of slow, inaccurate, and/or inconsistent). If you focus on providing syntax highlighting along with a background parser that can display syntax errors, it shouldn't be difficult to create a very usable tool.
The level of difficulty also depends heavily on the complexity of the language and what your accuracy demands are for the auto-complete process. Currently I'm experimenting with Java, with my goals being extremely fast IDE assist operations (under 25ms latency) and a high degree of accuracy and consistency even in documents with multiple syntax errors. For the task of identifying the current context, I'm using a new parsing algorithm that I designed specifically for this task and might not apply to any other application. Sam -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Colin Yates Sent: Friday, July 29, 2011 11:04 AM To: [email protected] Subject: [antlr-interest] Fwd: Any HTML editors for rich editing of documents conforming to an ANTLR grammar? (oops - clicked reply instead of reply-all) ---------- Forwarded message ---------- From: Colin Yates <[email protected]> Date: 29 July 2011 16:34 Subject: Re: [antlr-interest] Any HTML editors for rich editing of documents conforming to an ANTLR grammar? To: Sam Harwell <[email protected]> Hi Sam, Thanks for the info. I had seen both of those, but they are too heavyweight for my needs - the editor must be a HTML5 construct. Shipping any desktop tool is a no-no as this is a web-application. Regarding "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." Not sure what to think of that - there are quite a few assumptions in there :). I shall take it as a friendly warning of "here be dragons" as I am sure that is the intent. Unfortunately I don't see any other option. We have decided that a DSL is the right way forward for allowing clients to describe their reality to our tool (previously it was through a chinese-whispers process of spreadsheets into spreadsheets which we parsed and populated templates in the persistent store - *that* is nowhere near as straightforward as it seems :)), and we have decided that ANTLR is the right tool to allow us to build the DSL. I am surprised that there isn't more traffic in this area - I would have thought my use-case is very common. If it is, then how do others allow clients to build non-trivial documents conforming to a grammar defined in ANTLR? If I do have to do this from scratch then I expect I shall: - define an abstraction for the things the editor cares about (current errors, ability to identify context based on cursor position, safe suggestions for example) - provide an implementation that is hard coded for one document in the first instance - dive into the internals in the second instance to see how much I can grab from the ANTLR internals of the generated tokeniser and parser in the second instance Creating a HTML5 construct to appear to work is pretty trivial I expect (and I cannot believe it hasn't already been done). I see the 2nd and 3rd points above being the can-of-worms, particularly the ability to figure out the relevant part of the grammar that matches the place in the document the user is currently editing. With respect, I see it as non-trivial, but not un-doable. It would make a nice open-source project as well.... Thanks for the help - I don't mean to be dismissive - keep the ideas coming :) Col On 29 July 2011 16:16, Sam Harwell <[email protected]> wrote: > 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: [email protected] > [mailto:[email protected]] On Behalf Of Colin Yates > Sent: Friday, July 29, 2011 5:32 AM > To: [email protected] > 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/<http://yatesco.wordpress.com/2011/07/15/capturing-line-numbers -from-antlr-parsing-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 > > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
