Code parser for own DSL in C# [closed]

2019-05-18 17:35发布

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.

标签: c# parsing dsl
3条回答
在下西门庆
2楼-- · 2019-05-18 17:44

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楼-- · 2019-05-18 17:58

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

查看更多
forever°为你锁心
4楼-- · 2019-05-18 18:05

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/

查看更多
登录 后发表回答