莱克斯/ Yacc的为C#? [英] Lex/Yacc for C#?

查看:274
本文介绍了莱克斯/ Yacc的为C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实,也许没有完全成熟的Lex / Yacc的。我采取了一个命令间preTER前端管理web应用程序。我在寻找的东西会采取语法定义,使之成为直接调用我的对象上的方法解析器。类似于ASP.NET MVC如何找出调用哪个控制器的方法,以及如何从腰包里掏出的参数。

Actually, maybe not full-blown Lex/Yacc. I'm implementing a command-interpreter front-end to administer a webapp. I'm looking for something that'll take a grammar definition and turn it into a parser that directly invokes methods on my object. Similar to how ASP.NET MVC can figure out which controller method to invoke, and how to pony up the arguments.

因此​​,如果用户键入创建富在我的命令提示符下,就应该透明地调用一个方法:

So, if the user types "create foo" at my command-prompt, it should transparently call a method:

private void Create(string id) { /* ... */ }

哦,如果它可以生成(例如)这些控制器方法属性帮助文本,那简直是真棒,太。

Oh, and if it could generate help text from (e.g.) attributes on those controller methods, that'd be awesome, too.

推荐答案

我不知道的Lex / Yacc的将是任何帮助。你只需要一个基本的标记生成器和跨preTER这是更快的手工编写。如果你还在为解析路径看反讽

I'm not sure Lex/Yacc will be of any help. You'll just need a basic tokenizer and an interpreter which are faster to write by hand. If you're still into parsing route see Irony.

:你有没有考虑PowerShell和命令行开关及其

As a sidenote: have you considered PowerShell and its commandlets?

这篇关于莱克斯/ Yacc的为C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆