views:

156

answers:

3

Hello,

I've already tried to develop languages using C and C++, but how can I create a interpreted language using C#? Thanks.

PS: I want to build it to run in Windows Mobile devices.

+3  A: 

Well... what have you tried in C and C++?

Developing a language isn't exactly childs play. Do you understand lexical analysis? Do you understand different types of parsers? Where an LR parser might be more appropriate than an LALR parser? Or vice-versa? Do you understand context free grammars? Regular expressions?

That doesn't even begin to cover code generation, optimization, etc... (which may not all apply for an interpreted language, but you're still going to want to know a thing or two about them before you dive in).

unforgiven3
I want to build it to run on Windows Mobile devices, then I want to know about parsers and lexical analysis.
Nathan Campos
I think you should first learn about lexical analysis and parsers before you worry about the Windows Mobile part. Those are the basics. You need to know them if you're going to produce a good interpreter.
unforgiven3
Thanks for your tips, I'm going to do this ;)
Nathan Campos
+1  A: 

You seem to be familiar with compiler construction, so I'll just point to the tools: MPLEX and MPPG are respectively scanner and parser generators that generate a lot of what you need to build a compiler or interpreter using the C# language.

It seems that more documentation can be found in the .NET SDK, but I don't have it at hand so I'll just leave a pointer to MSDN.

Joaquim Rendeiro
Thanks very much for your indications!
Nathan Campos
+2  A: 

If you want an interpreteded language developing it for C# is no different than developing it in C or C++.

If you want to compile to a (.Net) compiled language then .Net offers lots of possibilities through System.Reflection.Emit.

Foxfire
Reflection.Emit doesn't exist in the COmpact Framework.
ctacke