Posted 13 years ago by Dave Sparks
Avatar
So far your component has been working very well for these sometimes very odd languages I work with. I have all the syntax highlighting and text-editing features I could ever ask for. Now, I'd like to go one step further.

One of the languages used is an extremely simple C-style structure for defining groups of objects.

[code]class Name : BaseName
{
propertyA = 1;
propertyB = "string";
propertyC[] = {"string1","string2","string3"};

class Subclass : AnotherClass
{
etc.....
};
};[/code]

I have the Dynamic Language XML working flawlessly. What I'd like to do now is create a tabbed form: Design on one tab and Code on the other. I didnt read much into semantic parsing before I started and now I wish I would have.

I want to create a graphical designer (like UML) in which editing on the Design tab will reflect changes on the text tab and vice-versa.

The only real trick is that I need to know which "Class" I am in at any moment because the properties are not dynamic. Each class type (defined by name) has a unique and strictly defined list of properties to choose from. If I misspell a property or use the wrong one in a class, the engine this code is used in will continue without error IIRC. So I thought a graphical editor with predifned shapes and properties would help in editing. Coupled intelliprompt properties when hand editing and with the "wavy lines" for typographical errors, this would enhance production about 200-fold (Most editing is currently done by hand in notepad-like applications).

What is my best course of action from here? Should I try using the semantic parser on the Main UI thread? Do I make it multi-threaded? Do I scrap the dynamic language and use something else?

What have others done?

[Modified at 03/22/2007 11:34 AM]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Dave,

If you just have small snippets you could do simplistic scanning to determine your context. Just by scanning backwards through tokens in the same thread and looking for class keywords, etc.

However the best way to do it (although much more time consuming for development) is to build a semantic parser that runs in a separate thread and builds an AST of your document. That way you can use that info to better understand what is in your document. Our "Simple" language sample shows a very basic implementation of a full parsing language.

Note that you CAN use dynamic languages with the semantic parser stuff. Dynamic languages simply implement the lexers and outlining. But in our XML add-on that we're working on we use a dynamic language lexer and override the outlining to have it based on the AST that gets built. Don't want to confuse you but just making the point that it can be done.


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.