3

I need to create a very simple scripting language, as an evolution of a macro language (where placeholders were present and were exchanged for the realdata) which is based essentially on statements that need to be executed in order. I need to support nesting of statements and maybe possibly if conditions.

I think I need a parser to properly detect the statements

For example one statement could be:

Input("Message"=#Clipboard())

In this case, I would need to execute the #Clipboard() statement first and then the #Input.

Any suggestion of what's the approach for it? I guess I need to contruct a tree and execute it. Thanks.

4
  • I would suggest reading msdn.microsoft.com/en-us/magazine/cc136756.aspx . Commented Oct 29, 2010 at 5:10
  • Who is the end user of the macro Language? Commented Oct 29, 2010 at 16:16
  • What about embedding another language within the c#. Is the emphasis on allowing none coding savvied people to run simple scripts or is it running code on the fly? Commented Oct 29, 2010 at 16:21
  • The end user is not technically savvy. I need to create a simple high level language with very basic functionalities. I don't want to user to have to write C# code or compile it on the fly. Basically it's a matter of creating a series of statements and execute them. The problem is with statement nesting. Commented Nov 10, 2010 at 7:32

1 Answer 1

2

See my answer to a similar question here:

Basically, you parse your string using Postfix Notation.

Also, if you are going to use something more complex, look into building a Recursive Descent Parser. Eric White's blog has a great set of articles on the topic.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.