Patterns to implement this grammar into C# code

Posted by MexicanHacker on Stack Overflow See other posts from Stack Overflow or by MexicanHacker
Published on 2010-04-21T15:11:34Z Indexed on 2010/04/21 15:13 UTC
Read the original article Hit count: 324

Filed under:
|
|

Hey guys, I'm creating this little BNF grammar and I wanted to

<template>::= <types><editors>
<types>::= <type>+
<type>::= <property>+
<property>::= <name><type>
<editors>::= <editor>+
<editor>::= <name><type>(<textfield>|<form>|<list>|<pulldown>)+
<textfield>::= <label><property>[<editable>]
<form>::= <label><property><editor>
<list>::= <label><property><item-editor>
<pulldown>::= <label><property><option>+
<option>::= <value>

One possible solution we have in mind is to create POCO's that have annotations of the XMLSerialization namespace, like this, for example:

[XMLRoot("template")]
public class Template{ 
    [XMLElement("types")]        
    public Types types{

    }
}

However I want to explore more solutions, what do you guys think?

© Stack Overflow or respective owner

Related posts about c#

Related posts about design-patterns