Program coversion

Nov 15 2009 1:57 AM
Hello friends,

This is something special Task. what i want to do here is to convert my own written syntax into C# syntax. its like below;

assume my program is like this,

+c Vehicle {
+string Vname;
}

Syntax:- + is for Public & "c" is for class likewise i have so many sysntax

i need to convert this program into C# program as shown below

public class Vehicle {
private string Vname;
public string Vname {
get { return this.Vname; }
set { this.Vname = value; }
}
}


can anybody give me a help to do this, actually i need a class conversion here.
At the same time i need to parse the user program using a parser. something like this--> parser does the parsing process
based on a Grammer like below,

this is my own written Grammer (dont concerntarte much on it)

<class>::=<className><OCB><Fields><Properties><Constructor><Method><CCB>
<className>::=<AccessModifier><TypeDeclaration><cname>
<Fields>::=<AccessModifier><TypeDeclaration><variableName>
<Properties>::=get and set////////
<Constructor>::=<className><OB><CB><OCB><CCB>
<Method>::=<AccessModifier><TypeDeclaration><MethodName><OB><Parameters><CB><OCB><CCB>

<AccessModifier>::=<Private>|<Public>|<Protect>.......

As a summary you need to handle the user written class file using a parser based on a grammer.
I think this grammer thing can be developed using seperate language. and it can be referenced as a dll file.
I have the concept in my mind...but i can not implement it...
If anyone can please help me........its a big big help..



charith


Answers (1)