1

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?

2
  • I don't see the question? You wanted to what? Commented Apr 21, 2010 at 15:14
  • Couple Questions: What are the whitespace rules for this language? What are the terminals? Is this only going to be XML? Commented Apr 21, 2010 at 15:14

2 Answers 2

1

If you want to implement this by yourself, look at Interpreter Design Pattern.

Sign up to request clarification or add additional context in comments.

Comments

0

If you want to parse a specific input of some complexity, use ANTLR. See C# instructions to get started.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.