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)
::=
::=
::=
::=get and set////////
::=
::=
::=||.......
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
theLizardPosted Nov 29, 2009, 2:57 AM
All you have to do is read a text file with your syntax and strip out the keywords (+c would be a key word) and replace it with whatever you want but you are going to have a lot of problems that you will need to deal with.
Forget what this person said Nikhil Kumar there will NOT be a converter on the net for a syntax that you created.
I HAVE already created an application in C++ that reads a text (script) files and creates C# code, and NO this application would not suit what you may want.
I can help you but the first thing you need to do is write some code in c# or C++ that will read in a text file line by line when you have done that show me your code and I will tell you what the next step is, it may be something like
sLine.Trim();
string sTmpLine = "";
if(s.Pos(sLine.Substring(0,2)) =="+c")
sTmpLine += "\tpublic class" + Environment.NewLine +"\t{";
Personally I cant' see why you would want to do something like this but good luck.