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?
如果您想自己实现,请查看解释器设计模式。
If you want to parse a specific input of some complexity, use ANTLR . See C# instructions to get started.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.