Unfortunately, both Solution 1 or 2 are off-topic. They don't tell you a word on how build your own language with the "real" compiler. You need to compile from your language to CIL, and nothing else. Compilation to C#, being quite possible, will be, first of all, inefficient (extra compilation step will eat up build time) and inflexible. You really need to compile into CIL.
And this is not too hard to do if you use CodeDOM. You can compile your language into CodeDOM tree. This is how:
Using the CodeDOM[
^].
See also:
How to: Create a Class Using CodeDOM[
^].
Ideally, you should create your own
code provided for your language in the form of
CodeDomProvider
. This way, you can extend CodeDOM to use your language. Note that this is not the same as compilation of your language to CIL. Please see:
CodeDomProvider Class (System.CodeDom.Compiler)[
^].
For deeper analysis of this problem, please see this CodeProject article:
Creating a CodeDOM: Modeling the Semantics of Code (Part 2)[
^].
—SA