C#: How to parse arbitrary strings into expression trees?

后端 未结 3 982
旧巷少年郎
旧巷少年郎 2020-12-17 04:09

In a project that I\'m working on I have to work with a rather weird data source. I can give it a \"query\" and it will return me a DataTable. But the query is not a traditi

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 04:47

    Bison or JavaCC or the like will generate a parser from a grammar. You can then augment the nodes of the tree with your own code to transform the expression.

    OP comments: I really don't want to ship 3rd party executables with my soft. I want it to be compiled in my code.

    Both tools generate source code, which you link with.

提交回复
热议问题