Code parser for own DSL in C# [closed]

人走茶凉 提交于 2019-12-10 11:23:54

问题


I'm looking for something like flex/bison that works with C# code. I want to be able to provide some language descriptors and a parser should be generated.


回答1:


There are several options. I've found Irony to be good. It's powerful, and it has a novel syntax utilizing C# operator overloads to convey the syntax of your grammars directly in C#.

Irony - .NET Language Implementation Kit.
http://irony.codeplex.com/




回答2:


ANTLR is a very common parser generator with output bindings for many languages (including c#), but it is LLR which might make it a little more cumbersome than flex/bison if that's what you are accustomed to.




回答3:


I've had my best luck with ANTLR, it can generate C# code as well. Good Language design support as well with ANTLR Works, an IDE for designing and testing your grammars, and quite a few tutorials to explain the whole thing.

Other option is the F# powerpack that has fsLex and fsYacc. Only brielfy poked at it, seems powerful but very little documentation.

For C# that's the two first thing to look at i think.

GJ



来源:https://stackoverflow.com/questions/5060583/code-parser-for-own-dsl-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!