C#/.NET Lexer Generators

前端 未结 4 629
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 08:25

I\'m looking for a decent lexical scanner generator for C#/.NET -- something that supports Unicode character categories, and generates somewhat readable & efficient code

4条回答
  •  长发绾君心
    2020-12-30 08:55

    I agree with @David Robbins, ANTLR is probably your best bet. However, the generated ANTLR code does need a seperate runtime library in order to use the generated code because there are some string parsing and other library commonalities that the generated code relies on. ANTLR generates a lexer AND a parser.

    On a side note: ANTLR is great...I wrote a 400+ line grammar to generate over 10k or C# code to efficiently parse a language. This included built in error checking for every possible thing that could go wrong in the parsing of the language. Try to do that by hand, and you'll never keep up with the bugs.

提交回复
热议问题