3

I am writing a small DSL. It consists of a simple Grammar such as this

Program =  Commands*
Commands = Keywords '(' STRING ')' ';' 
Keywords = Connect | Disconnect

So it matches stuff like

Connect("xyz");

Are there any built in tools in VS 2013 that will help me NOT have to spin up my own Parser & AST code as well as tools to bind and generate to c#? I am looking at the purest way to do this without loading ANTLR, T4 and all the other 3rd party libs (not yet, this is a prototype). if Visual Studio has something readily available in 2013 without installing Roslyn pre-release, I would appreciate some direction on how to build this micro DSL the fastest and cleanest way.

Mark Irvin
  • 830
  • 1
  • 6
  • 16
  • 1
    Even if you could generate C# code from it "natively" (IL Emit), you would still need to parse your input somehow. – Mephy Apr 20 '15 at 22:21
  • 1
    What, this kind of thing? [How to programmatically compile code using C# compiler](https://support.microsoft.com/en-us/kb/304655) or [Is it possible to dynamically compile and execute C# code fragments?](http://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-code-fragments) – Nathan Cooper Apr 20 '15 at 22:29
  • @Mephy Right! I have tried a couple of Parser tools that seem to complicate things because they are not up to date and I found some bugs in the Open source Parser code so I didn't want to spend any more time patching. I am trying to be resourceful and use whatever VS has to offer. I guess I am going to just keep the parser that I have. The IL Emit seems it will come in later when a little later on but for now, I might hand map the parse tree to C#. Thanks! – Mark Irvin Apr 21 '15 at 01:24
  • @NathanCooper Not necessarily what I am looking for but thanks for the good links. The CodeDom seems to be valuable when I tinker with an interpreter soon. – Mark Irvin Apr 21 '15 at 01:34

0 Answers0