Compiler compiler in C#

后端 未结 7 1068
遥遥无期
遥遥无期 2021-02-03 13:28

I\'m looking for a customizable parser and/or lexer that can allow me to build a custom syntax checker in C#. Essentially the user will enter code a line of code (custom), and t

7条回答
  •  渐次进展
    2021-02-03 14:07

    That's Irony. Be sure to read the discussion, because it's a lot going on there. Use the old release from November or use the latest, but then make sure you understand what is in that release and what not.

    For most things, the November release should work well (using it in a pet project).

    Irony allows to build an abstract syntax tree (AST) from any grammar you can define directly in C# code. It also supports evaluation (i.e. interpreting the code), and it's even not hard to build code from it. Or, well, convert it into a DLR (Dynamic Language Runtime) AST.

提交回复
热议问题