Hi folks, I believe I posted this query earlier as well but didn't really receive a response, so here it is again:
Is there any work being done on algorithms for creating an object model based on a grammar? To give a simple example to illustrate what I mean, consider the following rules. name: addressbook-style-name / western-style-name / eastern-style-name addressbook-style-name: last-name comma whitespace first-name western-name: first-name whitespace last-name eastern-style-name: last-name whitespace first-name last-name: [a-zA-Z] first-name: [a-zA-Z] comma: [,] whitespace: # list of whitespace characters here An object model (in C#) corresponding to the above rules could be: public class Name { } public class AddressBookStyleName : Name { public string FirstName { get; set; } public string LastName { get; set; } public string ToString() { return LastName + ", " + FirstName; } } public class WesternStyleName : Name { public string FirstName { get; set; } public string LastName { get; set; } public string ToString() { return FirstName + " " + LastName; } } public class EasternStyleName : Name { public string LastName { get; set; } public string FirstName { get; set; } public string ToString() { return LastName + " " + FirstName; } } Therefore, the algorithm should take in a set of rules and put out a class structure to represent the semantic structure of those rules. Looking forward to a response (comments, criticisms welcome). Regards, Umar Farooq Khawaja.
_______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg