none
词法文法的文法产生式 RRS feed

  • 问题

  • 词法文法的文法产生式:

        statement-list:
           statement
           statement-list   statement

        定义一个 statement-list,它或仅含有一个 statement,或由一个 statement-list 和随后跟着的一个 statement 组成。我的问题:一个 statement-list 和随后跟着的一个 statement是什么意思?   

    hexadecimal-integer-literal:
      0x   hex-digits   integer-type-suffix opt
      0X   hex-digits   integer-type-suffix opt

      为什么下面两个0x一样 ?

    2011年5月19日 9:29

答案

  •   0x   hex-digits   integer-type-suffix opt
      0X   hex-digits   integer-type-suffix opt

    其实这里意思是对于十六进制整数文字量, 前缀写0x和0X都是一样的,都代表十六进制数.
    比如0x518A和0X518A是一样的.
    参考这篇: http://en.csharp-online.net/ECMA-334%3A_9.4.4.2_Integer_literals.



    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    -------------------------------------------------
    This response contains links reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    2011年5月20日 5:31
    版主
  • 这个文法的意思是说,statement-list 可以包含 statement,或者是嵌套包含另一个 statement-list 以及一个 statement 的子句法。

    这两种形式都合法。


    Mark Zhou
    2011年5月20日 7:17

全部回复

  •   0x   hex-digits   integer-type-suffix opt
      0X   hex-digits   integer-type-suffix opt

    其实这里意思是对于十六进制整数文字量, 前缀写0x和0X都是一样的,都代表十六进制数.
    比如0x518A和0X518A是一样的.
    参考这篇: http://en.csharp-online.net/ECMA-334%3A_9.4.4.2_Integer_literals.



    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    -------------------------------------------------
    This response contains links reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    2011年5月20日 5:31
    版主
  • 这个文法的意思是说,statement-list 可以包含 statement,或者是嵌套包含另一个 statement-list 以及一个 statement 的子句法。

    这两种形式都合法。


    Mark Zhou
    2011年5月20日 7:17