How to use CompilationUnit.cs

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Joe
Version: 4.0.0284
Avatar
Hi!

Firstly I have to say that the SyntaxEditor is a cool tool!
I now try to work with it. Unfortunately I don't have a lot of programming experience...so hopefully you can help me.
I'd like to extend the Simple Language Add-On and create my own language.
Now my current problem:
I would like to have functions and procedures. I have two classes for them. Similar to the FunctionDeclaration.cs in the SimpleAddon.
But now I don't know how to work with both classes with reference to the CompilationUnit class. Do I need a further class or ist the CompilationUnit.cs sufficient?

Can you give me a roughly concept how I can reach what I want? That would be great!

Regards, Joe

[Modified at 06/01/2010 02:51 PM]

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

If you look in the C# sample's "/Languages/SimpleAddon" folder, you can see a grammar XML file. That is the file we used to generate the AST classes and semantic parser. You run it through the Grammar Designer, and that outputs the class files for you.

Since the generated AST nodes are based on our AST framework, they automatically track parent nodes, etc. So you can use the IAstNode interface on any AST node to get the root CompilationUnit. IAstNode has a RootNode property and a GetAncestor property, either of which will probably work for your needs.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.