3

I'm looking to produce an educational tool to be used in a Code Club for teenagers.

My eventual goal is to produce a rule-based, non-graphical DSL (and accompanying IDE) that facilitates the creation of "bots" for an online game.

For now though, I just want to mock up the IDE using an established language. I was thinking of Prolog as I'm familiar with it and it is rule based, but I'm not too fussed.

Where I'm at:

  1. I've seen a couple of good code editing components I could use.
  2. I've seen Prolog.Net, which I figure could somehow be used to do the heavy lifting

What I need to know:

  • How do I run script that has been entered into a textbox at run-time?

If it matters, I generally use C# in Visual Studio.

Community
  • 1
  • 1
Tom Wright
  • 11,278
  • 15
  • 74
  • 148
  • Take a look at the [`System.CodeDom`](http://msdn.microsoft.com/en-us/library/system.codedom.aspx) namespace or [Microsoft `Roslyn` CTP](http://msdn.microsoft.com/en-gb/roslyn) – mellamokb May 22 '12 at 13:05
  • You can also have a look at the DLR and the SymPL language implementation: http://dlr.codeplex.com/wikipage?title=Docs%20and%20specs&referringTitle=Home – David Brabant May 22 '12 at 13:14

2 Answers2

1

Have you taken a look at the GOLD Parser? I used it in a project (created a DSL for users to define custom business rules) about a year ago, and it did what I needed. You can define your own grammars with it.

Greg Bair
  • 670
  • 6
  • 20
0

Visual Studio itself is quite a decent code editing component (and you can even ship it with your package, see the Isolated Shell). It is relatively easy to implement language extensions for it. Parsing Prolog is trivial, even with an ad hoc parser, you don't have to use any heavyweight parser generators.

If you're going to implement your own Prolog or a Prolog-based language, read this brilliant tutorial: http://wambook.sourceforge.net/

SK-logic
  • 9,605
  • 1
  • 23
  • 35