生成文件语法 [英] Makefile Grammar
问题描述
是否有精确 makefile 语法定义?或者至少是一些常见的子集,因为我猜有一些口味.这样的语法,可以用来写解析器.
Is there anywhere a precise makefile grammar definition? Or at least some common subset since I guess that there are some flavors. Such a grammar that could be used for writing a parser.
GNU Make 手册 似乎没有那么精确.根据该文档为 makefile 编写解析器需要一些猜测和反复试验.
GNU Make manual doesn't seem to be that precise. It would require some guessing and trial-and-error to write a parser for makefile based on that document.
我还在 ANTLR 邮件列表中找到了类似问题.但它仍然没有回答哪种暗示答案......
I also found a similar question on ANTLR mail list. But it remained unanswered which kind of suggests the answer...
推荐答案
gnu make好像没有官方的语法,而且...
It seems there is no official grammar for gnu make, and ...
为 make 写一个语法会很棘手,因为语法是非常依赖上下文.
It would be tricky to write a grammar for make, since the grammar is extremely context-dependent.
正如 Paul D. Smith 在 gnu make 邮件列表中的一条消息.Paul D. Smith 是 gnu make 的官方维护者.
As said by Paul D. Smith in a message in the gnu make mailing list. Paul D. Smith is the official maintainer of gnu make.
这篇关于生成文件语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!