开发者

Are there metalanguages that are used to describe source-code properties to enforce coding guidelines?

Today there are a lot of different guidelines and standards (internal and external) for coding. There are also some tools that enforce that coding guidelines.

I wonder if there are any languages helping to formulate coding guidelines that tools could make use of?

I im开发者_如何学编程agine they should be language-specific and be based on other metalanguages such as Backus–Naur Form. So that the rule "goto statement not allowed" could be described as:

rule_goto_statement_not_allowed ::= statement_delimiter + "goto" + 
                                    statement_delimiter + label + ";"

rule_goto_statement_not_allowed_error_message ::= line + "goto not allowed!"


PMD has a rule language based on an AST for this purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜