parse in programming

最近在参与gnome项目,在与gnome-logs开发者David King交流时,他说道:"This task involves doing some extra parsing of the systemd catalog"。没有开发经验更没有太多英文专业词汇的我就搞不懂这里parse是什么意思了。有道词典将该词翻译为解析,可是这样太宽泛了啊。

最开始没有去搞懂这个词的意思,就直接看了bug相关的几个链接。这么一来,对这个词有了一定的认识。之后就直接google搜索how to parse && programming。在搜索出来的结果中看到stack overflow的一个解答非常精彩,在此记录一下。

问题是What's the best way to explain parsing to a new programmer?

答案是这样的:

I'd explain parsing as the process of turning some kind of data into another kind of data.

In practice, for me this is almost always turning a string, or binary data, into a data structure inside my Program.

For example, turning

":Nick!User@Host PRIVMSG #channel :Hello!"

into (C)

struct irc_line {
    char *nick;
    char *user;
    char *host;
    char *command;
    char **arguments;
    char *message;
} sample = { "Nick", "User", "Host", "PRIVMSG", { "#channel" }, "Hello!" }

stack overflow链接:http://stackoverflow.com/questions/2933192/whats-the-best-way-to-explain-parsing-to-a-new-programmer

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值