SyntaxEditor for WPF - ANTLR v4 Support?

by Avatar Bill Henning (Actipro) - 2 comments
Friday, January 24, 2014 at 12:16pm

PostBannerSyntaxEditorDevNotes

SyntaxEditor for WPF has a free add-on included with it that provides integration with ANTLR 3.4 parsers. The add-on is described in detail in this blog post from several years back.

What is ANTLR?

ANTLR, ANother Tool for Language Recognition, was created by Terence Parr and is one of the most widely-used parsing frameworks available.  ANTLR is a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. ANTLR provides excellent support for tree construction, tree walking, translation, error recovery, and error reporting.

SyntaxEditor for WPF customers know that we also have our own LL(*) Parsing Framework that has a lot of benefits over ANTLR, but due to the general popularity of ANTLR, we are pleased to support it as well.

ANTLR v4

In the past few months, ANTLR v4 was released.  There is updated tooling for Visual Studio that allows ANTLR v4 parsers to generated.  The thing is that the entire infrastructure of ANTLR parsers has changed in v4, and with those breaking changes, it prevents our add-on from working.

In ANTLR v3, you could run the parser on the document text via our add-on (and in a worker thread so it doesn't block the main UI thread), and it would return the AST results of the parsing operation asynchronously when it completed.

In ANTLR v4, the parser is not the same as there is no automatic AST generation.  Parse results can be examined via the use of the visitor pattern or a parse tree walker.  If you wish to have your own AST, you have to roll your own and construct it using a visitor or walker.  This change negates a lot of the features our add-on provided since now, you basically must hand code an IParser service to install on your language.  SyntaxEditor is fully extensible for any custom parsers, so this can be added easily.  It's just that whatever code you need to do to generate an AST or other parse data by walking the parse tree must now be custom written.

What Do You Want?

We are writing this blog post to see what you, our customers, would like to see from us in terms of ANTLR support.  Do you still wish to have our add-on support ANTLR v3 as we move forward? 

The only piece that is really useful from our ANTLR add-on when used with the newer v4 design is the ICharStream implementation that allows the parser to directly read from our text storage facility.  Since it's only one class, do we just include it open source somewhere or make a separate v4 binary with it in there?

We'd love to hear your thoughts… Please comment below or email our support address!

TaskDownload TaskLiveDemo TaskBuyNow

Tags: syntaxeditor

Comments (2)

Posted 10 years ago by Claus Topholt
Avatar
Would just like to say that ANTLR4 support in SyntaxEditor would be extremely welcome. I'm am about to do an ANTLR4-based DSL project and I had thought it would be a slam-dunk to use SyntaxEditor. Only to find it doesn't currently integrate.
Posted 10 years ago by Bill Henning (Actipro) - Actipro Software LLC
Avatar
Hi Claus, We've started looking into how to support ANTLR4 however due to the many changes they made, there isn't nearly as much for us to do in terms of an add-on since everything would have to be custom integrated on your end. We can discuss more privately since I'd love to get your thoughts.

Add Comment

Please log in to a validated account to post comments.