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

你可能感兴趣的:(parse,stack,overflow,开发经验)