We’ve been hammering out the dynamic language object model over the past few days. If you are familiar with SyntaxEditor 4.0, dynamic languages are languages in which the lexical parser is defined via patterns, both explicit and regular expression patterns. It’s a fast way to get any custom language configured and can be loaded from XML definitions.
Dynamic languages become dynamic lexical parsers
In SyntaxEditor for WinForms, dynamic languages all had to inherit DynamicSyntaxLanguage. In our next generation design, while the object model of dynamic languages and how you define lexical states/patterns is mostly the same, we’ve moved things out a level so that they are all part of a dynamic lexical parser and not specifically on the language class. This means that for any given inherited SyntaxLanguage class, you’d be able to swap in and out a dynamic lexical parser for another lexical parser.
Say you start on a custom SyntaxLanguage to use with SyntaxEditor. You could prototype your lexer out with the “dynamic” lexical parser, defining the patterns to use for parsing tokens in an XML file. Then once you develop your language more, say you want to squeeze out some enhanced performance. All you’d do is create a programmatic lexical parser for your language and swap it in place of the dynamic lexical parser. Typically programmatic lexical parsers can perform faster than dynamic lexical parsers, since programmatic ones are geared and optimized specifically for a particular language. Since the “dynamic” lexical parser is just a lexical parser now, it’s easy to swap in and out for others within the language class.
Loading SyntaxEditor for WinForms dynamic language XML definitions
We’ve written up a quick and dirty class to deserialize the dynamic language XML definitions created for SyntaxEditor for WinForms. It is able to load any dynamic language XML definition, even custom ones you’ve created. Our WPF sample now demos loading all of the dynamic languages found in SyntaxEditor 4.0, including ones that perform language transitions such as HTML.
|

SyntaxEditor for WPF with the HTML dynamic language definition loaded… note the multiple language transitions
|
We will be writing a more robust XML definition deserializer once we finalize the object model a bit more, however this update at least paves the way for closed alpha testing to finally begin after we tie up several other small loose ends!