diff --git a/topics/grammars/c/iso-9899-1999/Makefile b/topics/grammars/c/iso-9899-1999/Makefile new file mode 100644 index 00000000..de4969c8 --- /dev/null +++ b/topics/grammars/c/iso-9899-1999/Makefile @@ -0,0 +1,9 @@ +all: + ../../../../shared/tools/pdf2bgf iso-is-annex.txt iso-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/checkxml bgf iso-output.bgf + ../../../../shared/tools/normbgf iso-output.bgf iso-is-grammar.bgf + ../../../../shared/tools/bgf2bnf iso-is-grammar.bgf iso-is.bnf + rm -f iso-output.bgf + +clean: + rm -f iso-output.bgf iso-is-grammar.bgf iso-is.bnf diff --git a/topics/grammars/c/iso-9899-1999/README.txt b/topics/grammars/c/iso-9899-1999/README.txt new file mode 100644 index 00000000..98a3b16f --- /dev/null +++ b/topics/grammars/c/iso-9899-1999/README.txt @@ -0,0 +1,20 @@ +INTERNATIONAL STANDARD ISO/IEC 9899 +Second edition +1999-12-01 + +Programming languages — C + +Reference number +ISO/IEC 9899:1999(E) + +© ISO/IEC 1999 +All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic +or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body +in the country of the requester. +ISO copyright office +Case postale 56 CH-1211 Geneva 20 +Tel. + 41 22 749 01 11 +Fax + 41 22 734 10 79 +E-mail copyright@iso.ch +Web www.iso.ch +Printed in Switzerland diff --git a/topics/grammars/c/iso-9899-1999/banned-lines.lst b/topics/grammars/c/iso-9899-1999/banned-lines.lst new file mode 100644 index 00000000..8b15c505 --- /dev/null +++ b/topics/grammars/c/iso-9899-1999/banned-lines.lst @@ -0,0 +1,3 @@ +9899:1999 +A.2 +Language syntax summary diff --git a/topics/grammars/c/iso-9899-1999/iso-is-annex.txt b/topics/grammars/c/iso-9899-1999/iso-is-annex.txt new file mode 100644 index 00000000..8a7ca0a3 --- /dev/null +++ b/topics/grammars/c/iso-9899-1999/iso-is-annex.txt @@ -0,0 +1,273 @@ +A.2 Phrase structure grammar +A.2.1 Expressions +(6.5.1) primary-expression: +identifier +constant +string-literal +(expression ) +(6.5.2) postfix-expression: +primary-expression +postfix-expression [expression ] +postfix-expression (argument-expression-listopt ) +postfix-expression . identifier +postfix-expression ->identifier +postfix-expression ++ +postfix-expression -- +(type-name ) {initializer-list } +(type-name ) {initializer-list , } +(6.5.2) argument-expression-list: +assignment-expression +argument-expression-list ,assignment-expression +(6.5.3) unary-expression: +postfix-expression +++ unary-expression +-- unary-expression +unary-operator cast-expression +sizeof unary-expression +sizeof (type-name ) +(6.5.3) unary-operator: one of +& * + - ~ ! +(6.5.4) cast-expression: +unary-expression +(type-name )cast-expression +(6.5.5) multiplicative-expression: +cast-expression +multiplicative-expression *cast-expression +multiplicative-expression /cast-expression +multiplicative-expression %cast-expression +408 Language syntax summary §A.2.1 +©ISO/IEC ISO/IEC 9899:1999 (E) +(6.5.6) additive-expression: +multiplicative-expression +additive-expression +multiplicative-expression +additive-expression -multiplicative-expression +(6.5.7) shift-expression: +additive-expression +shift-expression <>additive-expression +(6.5.8) relational-expression: +shift-expression +relational-expression < shift-expression +relational-expression > shift-expression +relational-expression <=shift-expression +relational-expression >=shift-expression +(6.5.9) equality-expression: +relational-expression +equality-expression ==relational-expression +equality-expression !=relational-expression +(6.5.10) AND-expression: +equality-expression +AND-expression &equality-expression +(6.5.11) exclusive-OR-expression: +AND-expression +exclusive-OR-expression ^AND-expression +(6.5.12) inclusive-OR-expression: +exclusive-OR-expression +inclusive-OR-expression |exclusive-OR-expression +(6.5.13) logical-AND-expression: +inclusive-OR-expression +logical-AND-expression &&inclusive-OR-expression +(6.5.14) logical-OR-expression: +logical-AND-expression +logical-OR-expression ||logical-AND-expression +(6.5.15) conditional-expression: +logical-OR-expression +logical-OR-expression ?expression :conditional-expression +§A.2.1 Language syntax summary 409 +ISO/IEC 9899:1999 (E) ©ISO/IEC +(6.5.16) assignment-expression: +conditional-expression +unary-expression assignment-operator assignment-expression +(6.5.16) assignment-operator: one of += *= /= %= += -= <<= >>= &= ^= |= +(6.5.17) expression: +assignment-expression +expression ,assignment-expression +(6.6) constant-expression: +conditional-expression +A.2.2 Declarations +(6.7) declaration: +declaration-specifiers init-declarator-listopt ; +(6.7) declaration-specifiers: +storage-class-specifier declaration-specifiersopt +type-specifier declaration-specifiersopt +type-qualifier declaration-specifiersopt +function-specifier declaration-specifiersopt +(6.7) init-declarator-list: +init-declarator +init-declarator-list ,init-declarator +(6.7) init-declarator: +declarator +declarator =initializer +(6.7.1) storage-class-specifier: +typedef +extern +static +auto +register +410 Language syntax summary §A.2.2 +©ISO/IEC ISO/IEC 9899:1999 (E) +(6.7.2) type-specifier: +void +char +short +int +long +float +double +signed +unsigned +_Bool +_Complex +_Imaginary +struct-or-union-specifier +enum-specifier +typedef-name +(6.7.2.1) struct-or-union-specifier: +struct-or-union identifieropt {struct-declaration-list } +struct-or-union identifier +(6.7.2.1) struct-or-union: +struct +union +(6.7.2.1) struct-declaration-list: +struct-declaration +struct-declaration-list struct-declaration +(6.7.2.1) struct-declaration: +specifier-qualifier-list struct-declarator-list ; +(6.7.2.1) specifier-qualifier-list: +type-specifier specifier-qualifier-listopt +type-qualifier specifier-qualifier-listopt +(6.7.2.1) struct-declarator-list: +struct-declarator +struct-declarator-list ,struct-declarator +(6.7.2.1) struct-declarator: +declarator +declaratoropt :constant-expression +§A.2.2 Language syntax summary 411 +ISO/IEC 9899:1999 (E) ©ISO/IEC +(6.7.2.2) enum-specifier: +enumidentifieropt {enumerator-list } +enumidentifieropt {enumerator-list , } +enumidentifier +(6.7.2.2) enumerator-list: +enumerator +enumerator-list ,enumerator +(6.7.2.2) enumerator: +enumeration-constant +enumeration-constant =constant-expression +(6.7.3) type-qualifier: +const +restrict +volatile +(6.7.4) function-specifier: +inline +(6.7.5) declarator: +pointeropt direct-declarator +(6.7.5) direct-declarator: +identifier +(declarator ) +direct-declarator[type-qualifier-listopt assignment-expressionopt ] +direct-declarator[statictype-qualifier-listopt assignment-expression] +direct-declarator[type-qualifier-list staticassignment-expression] +direct-declarator[type-qualifier-listopt *] +direct-declarator(parameter-type-list) +direct-declarator(identifier-listopt ) +(6.7.5) pointer: +*type-qualifier-listopt +*type-qualifier-listopt pointer +(6.7.5) type-qualifier-list: +type-qualifier +type-qualifier-list type-qualifier +(6.7.5) parameter-type-list: +parameter-list +parameter-list ,... +412 Language syntax summary §A.2.2 +©ISO/IEC ISO/IEC 9899:1999 (E) +(6.7.5) parameter-list: +parameter-declaration +parameter-list ,parameter-declaration +(6.7.5) parameter-declaration: +declaration-specifiers declarator +declaration-specifiers abstract-declaratoropt +(6.7.5) identifier-list: +identifier +identifier-list ,identifier +(6.7.6) type-name: +specifier-qualifier-list abstract-declaratoropt +(6.7.6) abstract-declarator: +pointer +pointeropt direct-abstract-declarator +(6.7.6) direct-abstract-declarator: +(abstract-declarator ) +direct-abstract-declaratoropt [assignment-expressionopt ] +direct-abstract-declaratoropt [ * ] +direct-abstract-declaratoropt (parameter-type-listopt ) +(6.7.7) typedef-name: +identifier +(6.7.8) initializer: +assignment-expression +{initializer-list } +{initializer-list , } +(6.7.8) initializer-list: +designationopt initializer +initializer-list ,designationopt initializer +(6.7.8) designation: +designator-list = +(6.7.8) designator-list: +designator +designator-list designator +§A.2.2 Language syntax summary 413 +ISO/IEC 9899:1999 (E) ©ISO/IEC +(6.7.8) designator: +[constant-expression ] +.identifier +A.2.3 Statements +(6.8) statement: +labeled-statement +compound-statement +expression-statement +selection-statement +iteration-statement +jump-statement +(6.8.1) labeled-statement: +identifier :statement +caseconstant-expression :statement +default :statement +(6.8.2) compound-statement: +{block-item-listopt } +(6.8.2) block-item-list: +block-item +block-item-list block-item +(6.8.2) block-item: +declaration +statement +(6.8.3) expression-statement: +expressionopt ; +(6.8.4) selection-statement: +if (expression )statement +if (expression )statement elsestatement +switch (expression )statement +(6.8.5) iteration-statement: +while ( expression )statement +do statement while (expression ) ; +for ( expressionopt ;expressionopt ;expressionopt )statement +for ( declaration expressionopt ;expressionopt )statement +414 Language syntax summary §A.2.3 +©ISO/IEC ISO/IEC 9899:1999 (E) +(6.8.6) jump-statement: +gotoidentifier ; +continue ; +break ; +return expressionopt ; +A.2.4 External definitions +(6.9) translation-unit: +external-declaration +translation-unit external-declaration +(6.9) external-declaration: +function-definition +declaration +(6.9.1) function-definition: +declaration-specifiers declarator declaration-listopt compound-statement +(6.9.1) declaration-list: +declaration +declaration-list declaration diff --git a/topics/grammars/c/iso-9899-1999/keywords.lst b/topics/grammars/c/iso-9899-1999/keywords.lst new file mode 100644 index 00000000..298778df --- /dev/null +++ b/topics/grammars/c/iso-9899-1999/keywords.lst @@ -0,0 +1,44 @@ +auto +break +case +char +const +continue +default +do +double +else +enum +extern +float +for +goto +if +inline +int +long +register +restrict +return +short +signed +sizeof +static +struct +switch +typedef +union unsigned +void +volatile +while +_Bool +_Complex +_Imaginary + +[ ] ( ) { } . -> +++ -- & * + - ~ ! +/ % << >> < > <= >= == != ^ | && || +? : ; ... += *= /= %= += -= <<= >>= &= ^= |= +, # ## +<: :> <% %> %: %:%: diff --git a/topics/grammars/c/iso-9899-tc2/Makefile b/topics/grammars/c/iso-9899-tc2/Makefile new file mode 100644 index 00000000..de4969c8 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc2/Makefile @@ -0,0 +1,9 @@ +all: + ../../../../shared/tools/pdf2bgf iso-is-annex.txt iso-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/checkxml bgf iso-output.bgf + ../../../../shared/tools/normbgf iso-output.bgf iso-is-grammar.bgf + ../../../../shared/tools/bgf2bnf iso-is-grammar.bgf iso-is.bnf + rm -f iso-output.bgf + +clean: + rm -f iso-output.bgf iso-is-grammar.bgf iso-is.bnf diff --git a/topics/grammars/c/iso-9899-tc2/README.txt b/topics/grammars/c/iso-9899-tc2/README.txt new file mode 100644 index 00000000..260f0ab8 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc2/README.txt @@ -0,0 +1,19 @@ +INTERNATIONAL STANDARD ISO/IEC 9899 +Committee Draft +May 6, 2005 + +Programming languages — C + +http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf + +Reference number +WG14/N1124 ISO/IEC 9899:TC2 + +© ISO/IEC 2005 + +Errors spotted right away: + + page 412, §A.2.2: + struct-or-union-specifier ∗ + (strange asterisk at the end of the line is manually removed) + (perhaps it indicates that the preceding line is the only change in the standard) \ No newline at end of file diff --git a/topics/grammars/c/iso-9899-tc2/banned-lines.lst b/topics/grammars/c/iso-9899-tc2/banned-lines.lst new file mode 100644 index 00000000..59b9cab4 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc2/banned-lines.lst @@ -0,0 +1,3 @@ +9899:TC2 +A.2 +Language syntax summary diff --git a/topics/grammars/c/iso-9899-tc2/iso-is-annex.txt b/topics/grammars/c/iso-9899-tc2/iso-is-annex.txt new file mode 100644 index 00000000..540fba81 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc2/iso-is-annex.txt @@ -0,0 +1,272 @@ +A.2 Phrasestructuregrammar +A.2.1 Expressions +(6.5.1) primary-expression: +identifier +constant +string-literal +(expression ) +(6.5.2) postfix-expression: +primary-expression +postfix-expression [expression ] +postfix-expression (argument-expression-listopt ) +postfix-expression . identifier +postfix-expression -> identifier +postfix-expression ++ +postfix-expression -- +(type-name ) { initializer-list } +(type-name ) { initializer-list , } +(6.5.2) argument-expression-list: +assignment-expression +argument-expression-list ,assignment-expression +(6.5.3) unary-expression: +postfix-expression +++ unary-expression +-- unary-expression +unary-operator cast-expression +sizeof unary-expression +sizeof ( type-name ) +(6.5.3) unary-operator: one of +& * + - ~ ! +(6.5.4) cast-expression: +unary-expression +(type-name )cast-expression +(6.5.5) multiplicative-expression: +cast-expression +multiplicative-expression *cast-expression +multiplicative-expression /cast-expression +multiplicative-expression %cast-expression +§A.2.1 Language syntax summary 409 +ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124 +(6.5.6) additive-expression: +multiplicative-expression +additive-expression +multiplicative-expression +additive-expression -multiplicative-expression +(6.5.7) shift-expression: +additive-expression +shift-expression << additive-expression +shift-expression >> additive-expression +(6.5.8) relational-expression: +shift-expression +relational-expression < shift-expression +relational-expression > shift-expression +relational-expression <= shift-expression +relational-expression >= shift-expression +(6.5.9) equality-expression: +relational-expression +equality-expression == relational-expression +equality-expression != relational-expression +(6.5.10) AND-expression: +equality-expression +AND-expression &equality-expression +(6.5.11) exclusive-OR-expression: +AND-expression +exclusive-OR-expression ^AND-expression +(6.5.12) inclusive-OR-expression: +exclusive-OR-expression +inclusive-OR-expression |exclusive-OR-expression +(6.5.13) logical-AND-expression: +inclusive-OR-expression +logical-AND-expression && inclusive-OR-expression +(6.5.14) logical-OR-expression: +logical-AND-expression +logical-OR-expression || logical-AND-expression +(6.5.15) conditional-expression: +logical-OR-expression +logical-OR-expression ?expression :conditional-expression +410 Language syntax summary §A.2.1 +WG14/N1124 CommitteeDraft — May 6, 2005 ISO/IEC 9899:TC2 +(6.5.16) assignment-expression: +conditional-expression +unary-expression assignment-operator assignment-expression +(6.5.16) assignment-operator: one of += *= /= %= += -= <<= >>= &= ^= |= +(6.5.17) expression: +assignment-expression +expression ,assignment-expression +(6.6) constant-expression: +conditional-expression +A.2.2 Declarations +(6.7) declaration: +declaration-specifiers init-declarator-listopt ; +(6.7) declaration-specifiers: +storage-class-specifier declaration-specifiersopt +type-specifier declaration-specifiersopt +type-qualifier declaration-specifiersopt +function-specifier declaration-specifiersopt +(6.7) init-declarator-list: +init-declarator +init-declarator-list ,init-declarator +(6.7) init-declarator: +declarator +declarator =initializer +(6.7.1) storage-class-specifier: +typedef +extern +static +auto +register +§A.2.2 Language syntax summary 411 +ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124 +(6.7.2) type-specifier: +void +char +short +int +long +float +double +signed +unsigned +_Bool +_Complex +struct-or-union-specifier +enum-specifier +typedef-name +(6.7.2.1) struct-or-union-specifier: +struct-or-union identifieropt {struct-declaration-list } +struct-or-union identifier +(6.7.2.1) struct-or-union: +struct +union +(6.7.2.1) struct-declaration-list: +struct-declaration +struct-declaration-list struct-declaration +(6.7.2.1) struct-declaration: +specifier-qualifier-list struct-declarator-list ; +(6.7.2.1) specifier-qualifier-list: +type-specifier specifier-qualifier-listopt +type-qualifier specifier-qualifier-listopt +(6.7.2.1) struct-declarator-list: +struct-declarator +struct-declarator-list ,struct-declarator +(6.7.2.1) struct-declarator: +declarator +declaratoropt :constant-expression +412 Language syntax summary §A.2.2 +WG14/N1124 CommitteeDraft — May 6, 2005 ISO/IEC 9899:TC2 +(6.7.2.2) enum-specifier: +enum identifieropt {enumerator-list } +enum identifieropt {enumerator-list , } +enum identifier +(6.7.2.2) enumerator-list: +enumerator +enumerator-list ,enumerator +(6.7.2.2) enumerator: +enumeration-constant +enumeration-constant =constant-expression +(6.7.3) type-qualifier: +const +restrict +volatile +(6.7.4) function-specifier: +inline +(6.7.5) declarator: +pointeropt direct-declarator +(6.7.5) direct-declarator: +identifier +(declarator ) +direct-declarator[type-qualifier-listopt assignment-expressionopt ] +direct-declarator[static type-qualifier-listopt assignment-expression] +direct-declarator[type-qualifier-list static assignment-expression] +direct-declarator[type-qualifier-listopt *] +direct-declarator(parameter-type-list) +direct-declarator(identifier-listopt ) +(6.7.5) pointer: +*type-qualifier-listopt +*type-qualifier-listopt pointer +(6.7.5) type-qualifier-list: +type-qualifier +type-qualifier-list type-qualifier +(6.7.5) parameter-type-list: +parameter-list +parameter-list ,... +§A.2.2 Language syntax summary 413 +ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124 +(6.7.5) parameter-list: +parameter-declaration +parameter-list ,parameter-declaration +(6.7.5) parameter-declaration: +declaration-specifiers declarator +declaration-specifiers abstract-declaratoropt +(6.7.5) identifier-list: +identifier +identifier-list ,identifier +(6.7.6) type-name: +specifier-qualifier-list abstract-declaratoropt +(6.7.6) abstract-declarator: +pointer +pointeropt direct-abstract-declarator +(6.7.6) direct-abstract-declarator: +(abstract-declarator ) +direct-abstract-declaratoropt [assignment-expressionopt ] +direct-abstract-declaratoropt [ * ] +direct-abstract-declaratoropt (parameter-type-listopt ) +(6.7.7) typedef-name: +identifier +(6.7.8) initializer: +assignment-expression +{initializer-list } +{initializer-list , } +(6.7.8) initializer-list: +designationopt initializer +initializer-list ,designationopt initializer +(6.7.8) designation: +designator-list = +(6.7.8) designator-list: +designator +designator-list designator +414 Language syntax summary §A.2.2 +WG14/N1124 CommitteeDraft — May 6, 2005 ISO/IEC 9899:TC2 +(6.7.8) designator: +[constant-expression ] +.identifier +A.2.3 Statements +(6.8) statement: +labeled-statement +compound-statement +expression-statement +selection-statement +iteration-statement +jump-statement +(6.8.1) labeled-statement: +identifier :statement +case constant-expression :statement +default : statement +(6.8.2) compound-statement: +{block-item-listopt } +(6.8.2) block-item-list: +block-item +block-item-list block-item +(6.8.2) block-item: +declaration +statement +(6.8.3) expression-statement: +expressionopt ; +(6.8.4) selection-statement: +if ( expression )statement +if ( expression )statement else statement +switch ( expression )statement +(6.8.5) iteration-statement: +while ( expression )statement +do statement while ( expression ) ; +for ( expressionopt ;expressionopt ;expressionopt )statement +for ( declaration expressionopt ;expressionopt )statement +§A.2.3 Language syntax summary 415 +ISO/IEC 9899:TC2 Committee Draft — May 6, 2005 WG14/N1124 +(6.8.6) jump-statement: +goto identifier ; +continue ; +break ; +return expressionopt ; +A.2.4 External definitions +(6.9) translation-unit: +external-declaration +translation-unit external-declaration +(6.9) external-declaration: +function-definition +declaration +(6.9.1) function-definition: +declaration-specifiers declarator declaration-listopt compound-statement +(6.9.1) declaration-list: +declaration +declaration-list declaration \ No newline at end of file diff --git a/topics/grammars/c/iso-9899-tc2/keywords.lst b/topics/grammars/c/iso-9899-tc2/keywords.lst new file mode 100644 index 00000000..d576e520 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc2/keywords.lst @@ -0,0 +1,45 @@ +auto +break +case +char +const +continue +default +do +double +else +enum +extern +float +for +goto +if +inline +int +long +register +restrict +return +short +signed +sizeof +static +struct +switch +typedef +union +unsigned +void +volatile +while +_Bool +_Complex +_Imaginary + +[ ] ( ) { } . -> +++ -- & * + - ~ ! +/ % << >> < > <= >= == != ^ | && || +? : ; ... += *= /= %= += -= <<= >>= &= ^= |= +, # ## +<: :> <% %> %: %:%: diff --git a/topics/grammars/c/iso-9899-tc3/Makefile b/topics/grammars/c/iso-9899-tc3/Makefile new file mode 100644 index 00000000..de4969c8 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc3/Makefile @@ -0,0 +1,9 @@ +all: + ../../../../shared/tools/pdf2bgf iso-is-annex.txt iso-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/checkxml bgf iso-output.bgf + ../../../../shared/tools/normbgf iso-output.bgf iso-is-grammar.bgf + ../../../../shared/tools/bgf2bnf iso-is-grammar.bgf iso-is.bnf + rm -f iso-output.bgf + +clean: + rm -f iso-output.bgf iso-is-grammar.bgf iso-is.bnf diff --git a/topics/grammars/c/iso-9899-tc3/README.txt b/topics/grammars/c/iso-9899-tc3/README.txt new file mode 100644 index 00000000..f937832e --- /dev/null +++ b/topics/grammars/c/iso-9899-tc3/README.txt @@ -0,0 +1,19 @@ +INTERNATIONAL STANDARD ISO/IEC 9899 +Committee Draft +September 7, 2007 + +Programming languages — C + +http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf + +Reference number +WG14/N1256 ISO/IEC 9899:TC3 + +© ISO/IEC 2007 + +Errors spotted right away: + + page 412, §A.2.2: + struct-or-union-specifier ∗ + (strange asterisk at the end of the line is manually removed) + (perhaps it indicates that the preceding line is the only change in the standard) \ No newline at end of file diff --git a/topics/grammars/c/iso-9899-tc3/banned-lines.lst b/topics/grammars/c/iso-9899-tc3/banned-lines.lst new file mode 100644 index 00000000..da0f8b84 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc3/banned-lines.lst @@ -0,0 +1,3 @@ +9899:TC3 +A.2 +Language syntax summary diff --git a/topics/grammars/c/iso-9899-tc3/iso-is-annex.txt b/topics/grammars/c/iso-9899-tc3/iso-is-annex.txt new file mode 100644 index 00000000..ca3a6891 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc3/iso-is-annex.txt @@ -0,0 +1,277 @@ +A.2 Phrasestructuregrammar +A.2.1 Expressions +(6.5.1) primary-expression: +identifier +constant +string-literal +(expression ) +(6.5.2) postfix-expression: +primary-expression +postfix-expression [expression ] +postfix-expression (argument-expression-listopt ) +postfix-expression . identifier +postfix-expression ->identifier +postfix-expression ++ +postfix-expression -- +(type-name ){initializer-list } +(type-name ){initializer-list ,} +(6.5.2) argument-expression-list: +assignment-expression +argument-expression-list ,assignment-expression +(6.5.3) unary-expression: +postfix-expression +++unary-expression +--unary-expression +unary-operator cast-expression +sizeofunary-expression +sizeof (type-name ) +(6.5.3) unary-operator: one of +& * + - ~ ! +(6.5.4) cast-expression: +unary-expression +(type-name )cast-expression +(6.5.5) multiplicative-expression: +cast-expression +multiplicative-expression *cast-expression +multiplicative-expression /cast-expression +multiplicative-expression %cast-expression +§A.2.1 Languagesyntax summary 409 +ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256 +(6.5.6) additive-expression: +multiplicative-expression +additive-expression +multiplicative-expression +additive-expression -multiplicative-expression +(6.5.7) shift-expression: +additive-expression +shift-expression << additive-expression +shift-expression >> additive-expression +(6.5.8) relational-expression: +shift-expression +relational-expression < shift-expression +relational-expression > shift-expression +relational-expression <=shift-expression +relational-expression >=shift-expression +(6.5.9) equality-expression: +relational-expression +equality-expression == relational-expression +equality-expression != relational-expression +(6.5.10) AND-expression: +equality-expression +AND-expression &equality-expression +(6.5.11) exclusive-OR-expression: +AND-expression +exclusive-OR-expression ^AND-expression +(6.5.12) inclusive-OR-expression: +exclusive-OR-expression +inclusive-OR-expression |exclusive-OR-expression +(6.5.13) logical-AND-expression: +inclusive-OR-expression +logical-AND-expression && inclusive-OR-expression +(6.5.14) logical-OR-expression: +logical-AND-expression +logical-OR-expression ||logical-AND-expression +(6.5.15) conditional-expression: +logical-OR-expression +logical-OR-expression ?expression :conditional-expression +410 Languagesyntax summary §A.2.1 +WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3 +(6.5.16) assignment-expression: +conditional-expression +unary-expression assignment-operator assignment-expression +(6.5.16) assignment-operator: one of += *= /= %= += -= <<= >>= &= ^= |= +(6.5.17) expression: +assignment-expression +expression ,assignment-expression +(6.6) constant-expression: +conditional-expression +A.2.2 Declarations +(6.7) declaration: +declaration-specifiers init-declarator-listopt ; +(6.7) declaration-specifiers: +storage-class-specifier declaration-specifiersopt +type-specifier declaration-specifiersopt +type-qualifier declaration-specifiersopt +function-specifier declaration-specifiersopt +(6.7) init-declarator-list: +init-declarator +init-declarator-list ,init-declarator +(6.7) init-declarator: +declarator +declarator =initializer +(6.7.1) storage-class-specifier: +typedef +extern +static +auto +register +§A.2.2 Languagesyntax summary 411 +ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256 +(6.7.2) type-specifier: +void +char +short +int +long +float +double +signed +unsigned +_Bool +_Complex +struct-or-union-specifier +enum-specifier +typedef-name +(6.7.2.1) struct-or-union-specifier: +struct-or-union identifieropt {struct-declaration-list } +struct-or-union identifier +(6.7.2.1) struct-or-union: +struct +union +(6.7.2.1) struct-declaration-list: +struct-declaration +struct-declaration-list struct-declaration +(6.7.2.1) struct-declaration: +specifier-qualifier-list struct-declarator-list ; +(6.7.2.1) specifier-qualifier-list: +type-specifier specifier-qualifier-listopt +type-qualifier specifier-qualifier-listopt +(6.7.2.1) struct-declarator-list: +struct-declarator +struct-declarator-list ,struct-declarator +(6.7.2.1) struct-declarator: +declarator +declaratoropt :constant-expression +412 Languagesyntax summary §A.2.2 +WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3 +(6.7.2.2) enum-specifier: +enumidentifieropt {enumerator-list } +enumidentifieropt {enumerator-list ,} +enumidentifier +(6.7.2.2) enumerator-list: +enumerator +enumerator-list ,enumerator +(6.7.2.2) enumerator: +enumeration-constant +enumeration-constant =constant-expression +(6.7.3) type-qualifier: +const +restrict +volatile +(6.7.4) function-specifier: +inline +(6.7.5) declarator: +pointeropt direct-declarator +(6.7.5) direct-declarator: +identifier +(declarator ) +direct-declarator[type-qualifier-listopt assignment-expressionopt ] +direct-declarator[statictype-qualifier-listopt assignment-expression] +direct-declarator[type-qualifier-list staticassignment-expression] +direct-declarator[type-qualifier-listopt *] +direct-declarator(parameter-type-list) +direct-declarator(identifier-listopt ) +(6.7.5) pointer: +*type-qualifier-listopt +*type-qualifier-listopt pointer +(6.7.5) type-qualifier-list: +type-qualifier +type-qualifier-list type-qualifier +(6.7.5) parameter-type-list: +parameter-list +parameter-list ,... +§A.2.2 Languagesyntax summary 413 +ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256 +(6.7.5) parameter-list: +parameter-declaration +parameter-list ,parameter-declaration +(6.7.5) parameter-declaration: +declaration-specifiers declarator +declaration-specifiers abstract-declaratoropt +(6.7.5) identifier-list: +identifier +identifier-list ,identifier +(6.7.6) type-name: +specifier-qualifier-list abstract-declaratoropt +(6.7.6) abstract-declarator: +pointer +pointeropt direct-abstract-declarator +(6.7.6) direct-abstract-declarator: +(abstract-declarator ) +direct-abstract-declaratoropt [type-qualifier-listopt + assignment-expressionopt ] +direct-abstract-declaratoropt [ static type-qualifier-listopt + assignment-expression ] +direct-abstract-declaratoropt [type-qualifier-list static + assignment-expression ] +direct-abstract-declaratoropt [* ] +direct-abstract-declaratoropt (parameter-type-listopt ) +(6.7.7) typedef-name: +identifier +(6.7.8) initializer: +assignment-expression +{initializer-list } +{initializer-list ,} +(6.7.8) initializer-list: +designationopt initializer +initializer-list ,designationopt initializer +(6.7.8) designation: +designator-list = +414 Languagesyntax summary §A.2.2 +WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3 +(6.7.8) designator-list: +designator +designator-list designator +(6.7.8) designator: +[constant-expression ] +.identifier +A.2.3 Statements +(6.8) statement: +labeled-statement +compound-statement +expression-statement +selection-statement +iteration-statement +jump-statement +(6.8.1) labeled-statement: +identifier :statement +caseconstant-expression :statement +default :statement +(6.8.2) compound-statement: +{block-item-listopt } +(6.8.2) block-item-list: +block-item +block-item-list block-item +(6.8.2) block-item: +declaration +statement +(6.8.3) expression-statement: +expressionopt ; +(6.8.4) selection-statement: +if (expression )statement +if (expression )statement elsestatement +switch (expression )statement +§A.2.3 Languagesyntax summary 415 +ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256 +(6.8.5) iteration-statement: +while ( expression )statement +dostatement while (expression ); +for (expressionopt ;expressionopt ;expressionopt )statement +for (declaration expressionopt ;expressionopt )statement +(6.8.6) jump-statement: +gotoidentifier ; +continue ; +break ; +returnexpressionopt ; +A.2.4 External definitions +(6.9) translation-unit: +external-declaration +translation-unit external-declaration +(6.9) external-declaration: +function-definition +declaration +(6.9.1) function-definition: +declaration-specifiers declarator declaration-listopt compound-statement +(6.9.1) declaration-list: +declaration +declaration-list declaration \ No newline at end of file diff --git a/topics/grammars/c/iso-9899-tc3/keywords.lst b/topics/grammars/c/iso-9899-tc3/keywords.lst new file mode 100644 index 00000000..d576e520 --- /dev/null +++ b/topics/grammars/c/iso-9899-tc3/keywords.lst @@ -0,0 +1,45 @@ +auto +break +case +char +const +continue +default +do +double +else +enum +extern +float +for +goto +if +inline +int +long +register +restrict +return +short +signed +sizeof +static +struct +switch +typedef +union +unsigned +void +volatile +while +_Bool +_Complex +_Imaginary + +[ ] ( ) { } . -> +++ -- & * + - ~ ! +/ % << >> < > <= >= == != ^ | && || +? : ; ... += *= /= %= += -= <<= >>= &= ^= |= +, # ## +<: :> <% %> %: %:%: diff --git a/topics/grammars/csharp/iso-23270-2006/Makefile b/topics/grammars/csharp/iso-23270-2006/Makefile new file mode 100644 index 00000000..de4969c8 --- /dev/null +++ b/topics/grammars/csharp/iso-23270-2006/Makefile @@ -0,0 +1,9 @@ +all: + ../../../../shared/tools/pdf2bgf iso-is-annex.txt iso-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/checkxml bgf iso-output.bgf + ../../../../shared/tools/normbgf iso-output.bgf iso-is-grammar.bgf + ../../../../shared/tools/bgf2bnf iso-is-grammar.bgf iso-is.bnf + rm -f iso-output.bgf + +clean: + rm -f iso-output.bgf iso-is-grammar.bgf iso-is.bnf diff --git a/topics/grammars/csharp/iso-23270-2006/README.txt b/topics/grammars/csharp/iso-23270-2006/README.txt new file mode 100644 index 00000000..1c771ca1 --- /dev/null +++ b/topics/grammars/csharp/iso-23270-2006/README.txt @@ -0,0 +1,29 @@ +INTERNATIONAL STANDARD ISO/IEC 23270 +Second edition +2006-09-01 + +Information technology — Programming languages — C# + +http://standards.iso.org/ittf/PubliclyAvailableStandards/c042926_ISO_IEC_23270_2006(E).zip + +Reference number +ISO/IEC 23270:2006(E) + +© ISO/IEC 2006 +All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, +electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or +ISO's member body in the country of the requester. +ISO copyright office +Case postale 56 • CH-1211 Geneva 20 +Tel. + 41 22 749 01 11 +Fax + 41 22 749 09 47 +E-mail copyright@iso.org +Web www.iso.org +Published in Switzerland + + + +Errors spotted right away: + page 446, §A.1.7 + the definition of keyword lacks: yield partial add remove get set where alias + (added manually to keywords.lst) diff --git a/topics/grammars/csharp/iso-23270-2006/banned-lines.lst b/topics/grammars/csharp/iso-23270-2006/banned-lines.lst new file mode 100644 index 00000000..85b63861 --- /dev/null +++ b/topics/grammars/csharp/iso-23270-2006/banned-lines.lst @@ -0,0 +1,4 @@ +23270:2006 +45 +46 +A.2 diff --git a/topics/grammars/csharp/iso-23270-2006/iso-is-annex.txt b/topics/grammars/csharp/iso-23270-2006/iso-is-annex.txt new file mode 100644 index 00000000..85710e87 --- /dev/null +++ b/topics/grammars/csharp/iso-23270-2006/iso-is-annex.txt @@ -0,0 +1,978 @@ +450 ©ISO/IEC 2006 – All rights reserved +A.2 Syntactic grammar +A.2.1 Basic concepts +compilation-unit: +extern-alias-directivesopt using-directivesopt global-attributesopt + namespace-member-declarationsopt +namespace-name: +namespace-or-type-name +type-name: +namespace-or-type-name +namespace-or-type-name: +identifier type-argument-listopt +qualified-alias-member +namespace-or-type-name . identifier type-argument-listopt + + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 451 +A.2.2 Types +type: +value-type +reference-type +type-parameter +value-type: +struct-type +enum-type +struct-type: +type-name +simple-type +nullable-type +simple-type: +numeric-type +bool +numeric-type: +integral-type +floating-point-type +decimal +integral-type: +sbyte +byte +short +ushort +int +uint +long +ulong +char +floating-point-type: +float +double +enum-type: +type-name +nullable-type: +non-nullable-value-type ? +non-nullable-value-type: +enum-type +type-name +simple-type +reference-type: +class-type +interface-type +array-type +delegate-type +class-type: +type-name +object +string +ISO/IEC 23270:2006(E) +452 ©ISO/IEC 2006 – All rights reserved +interface-type: +type-name +array-type: +non-array-type rank-specifiers +non-array-type: +value-type +class-type +interface-type +delegate-type +type-parameter +rank-specifiers: +rank-specifier +rank-specifiers rank-specifier +rank-specifier: +[ dim-separatorsopt ] +dim-separators: +, +dim-separators , +delegate-type: +type-name + +A.2.3 Variables +variable-reference: +expression + +A.2.4 Expressions +argument-list: +argument +argument-list , argument +argument: +expression +ref variable-reference +out variable-reference +primary-expression: +array-creation-expression +primary-no-array-creation-expression + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 453 +primary-no-array-creation-expression: +literal +simple-name +parenthesized-expression +member-access +invocation-expression +element-access +this-access +base-access +post-increment-expression +post-decrement-expression +object-creation-expression +delegate-creation-expression +typeof-expression +checked-expression +unchecked-expression +default-value-expression +anonymous-method-expression +simple-name: +identifier type-argument-listopt +parenthesized-expression: +( expression ) +member-access: +primary-expression . identifier type-argument-listopt +predefined-type . identifier type-argument-listopt +qualified-alias-member . identifier type-argument-listopt +predefined-type: one of +bool byte char decimal double float int long +object sbyte short string uint ulong ushort +invocation-expression: +primary-expression ( argument-listopt ) +element-access: +primary-no-array-creation-expression [ expression-list ] +expression-list: +expression +expression-list , expression +this-access: +this +base-access: +base . identifier type-argument-listopt +base [ expression-list ] +post-increment-expression: +primary-expression ++ +post-decrement-expression: +primary-expression -- +object-creation-expression: +new type ( argument-listopt ) +ISO/IEC 23270:2006(E) +454 ©ISO/IEC 2006 – All rights reserved +array-creation-expression: +new non-array-type [ expression-list ] rank-specifiersopt array-initializeropt +new array-type array-initializer +delegate-creation-expression: +new delegate-type ( expression ) +typeof-expression: +typeof ( type ) +typeof ( unbound-type-name ) +typeof ( void ) +unbound-type-name: +identifier generic-dimension-specifieropt +identifier :: identifier generic-dimension-specifieropt +unbound-type-name . identifier generic-dimension-specifieropt +generic-dimension-specifier: +< commasopt > +commas: +, +commas , +checked-expression: +checked ( expression ) +unchecked-expression: +unchecked ( expression ) +default-value-expression: +default ( type ) +anonymous-method-expression: +delegate anonymous-method-signatureopt block +anonymous-method-signature: +( anonymous-method-parameter-listopt ) +anonymous-method-parameter-list: +anonymous-method-parameter +anonymous-method-parameter-list , anonymous-method-parameter +anonymous-method-parameter: +parameter-modifieropt type identifier +unary-expression: +primary-expression ++ unary-expression +- unary-expression +! unary-expression +~ unary-expression +pre-increment-expression +pre-decrement-expression +cast-expression +pre-increment-expression: +++ unary-expression +pre-decrement-expression: +-- unary-expression +cast-expression: +( type ) unary-expression + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 455 +multiplicative-expression: +unary-expression +multiplicative-expression * unary-expression +multiplicative-expression / unary-expression +multiplicative-expression % unary-expression +additive-expression: +multiplicative-expression +additive-expression + multiplicative-expression +additive-expression – multiplicative-expression +shift-expression: +additive-expression +shift-expression << additive-expression +shift-expression right-shift additive-expression +relational-expression: +shift-expression +relational-expression < shift-expression +relational-expression > shift-expression +relational-expression <= shift-expression +relational-expression >= shift-expression +relational-expression is type +relational-expression as type +equality-expression: +relational-expression +equality-expression == relational-expression +equality-expression != relational-expression +and-expression: +equality-expression +and-expression & equality-expression +exclusive-or-expression: +and-expression +exclusive-or-expression ^ and-expression +inclusive-or-expression: +exclusive-or-expression +inclusive-or-expression | exclusive-or-expression +conditional-and-expression: +inclusive-or-expression +conditional-and-expression && inclusive-or-expression +conditional-or-expression: +conditional-and-expression +conditional-or-expression || conditional-and-expression +null-coalescing-expression: +conditional-or-expression +conditional-or-expression ?? null-coalescing-expression +conditional-expression: +null-coalescing-expression +null-coalescing-expression ? expression : expression +assignment: +unary-expression assignment-operator expression +ISO/IEC 23270:2006(E) +456 ©ISO/IEC 2006 – All rights reserved +assignment-operator: one of += += -= *= /= %= &= |= ^= <<= right-shift-assignment +expression: +conditional-expression +assignment +constant-expression: +expression +boolean-expression: +expression + +A.2.5 Statements +statement: +labeled-statement +declaration-statement +embedded-statement +embedded-statement: +block +empty-statement +expression-statement +selection-statement +iteration-statement +jump-statement +try-statement +checked-statement +unchecked-statement +lock-statement +using-statement +yield-statement +block: +{ statement-listopt } +statement-list: +statement +statement-list statement +empty-statement: +; +labeled-statement: +identifier : statement +declaration-statement: +local-variable-declaration ; +local-constant-declaration ; +local-variable-declaration: +type local-variable-declarators +local-variable-declarators: +local-variable-declarator +local-variable-declarators , local-variable-declarator +local-variable-declarator: +identifier +identifier = local-variable-initializer + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 457 +local-variable-initializer: +expression +array-initializer +local-constant-declaration: +const type constant-declarators +constant-declarators: +constant-declarator +constant-declarators , constant-declarator +constant-declarator: +identifier = constant-expression +expression-statement: +statement-expression ; +statement-expression: +invocation-expression +object-creation-expression +assignment +post-increment-expression +post-decrement-expression +pre-increment-expression +pre-decrement-expression +selection-statement: +if-statement +switch-statement +if-statement: +if ( boolean-expression ) embedded-statement +if ( boolean-expression ) embedded-statement else embedded-statement +switch-statement: +switch ( expression ) switch-block +switch-block: +{ switch-sectionsopt } +switch-sections: +switch-section +switch-sections switch-section +switch-section: +switch-labels statement-list +switch-labels: +switch-label +switch-labels switch-label +switch-label: +case constant-expression : +default : +iteration-statement: +while-statement +do-statement +for-statement +foreach-statement +while-statement: +while ( boolean-expression ) embedded-statement +ISO/IEC 23270:2006(E) +458 ©ISO/IEC 2006 – All rights reserved +do-statement: +do embedded-statement while ( boolean-expression ) ; +for-statement: +for ( for-initializeropt ; for-conditionopt ; for-iteratoropt ) embedded-statement +for-initializer: +local-variable-declaration +statement-expression-list +for-condition: +boolean-expression +for-iterator: +statement-expression-list +statement-expression-list: +statement-expression +statement-expression-list , statement-expression +foreach-statement: +foreach ( type identifier in expression ) embedded-statement +jump-statement: +break-statement +continue-statement +goto-statement +return-statement +throw-statement +break-statement: +break ; +continue-statement: +continue ; +goto-statement: +goto identifier ; +goto case constant-expression ; +goto default ; +return-statement: +return expressionopt ; +throw-statement: +throw expressionopt ; +try-statement: +try block catch-clauses +try block catch-clausesopt finally-clause +catch-clauses: +specific-catch-clauses +specific-catch-clausesopt general-catch-clause +specific-catch-clauses: +specific-catch-clause +specific-catch-clauses specific-catch-clause +specific-catch-clause: +catch ( class-type identifieropt ) block +general-catch-clause: +catch block + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 459 +finally-clause: +finally block +checked-statement: +checked block +unchecked-statement: +unchecked block +lock-statement: +lock ( expression ) embedded-statement +using-statement: +using ( resource-acquisition ) embedded-statement +resource-acquisition: +local-variable-declaration +expression +yield-statement: +yield return expression ; +yield break ; + namespace-declaration: +namespace qualified-identifier namespace-body ;opt +qualified-identifier: +identifier +qualified-identifier . identifier +namespace-body: +{ extern-alias-directivesopt using-directivesopt namespace-member-declarationsopt } +extern-alias-directives: +extern-alias-directive +extern-alias-directives extern-alias-directive +extern-alias-directive: +extern alias identifier ; +using-directives: +using-directive +using-directives using-directive +using-directive: +using-alias-directive +using-namespace-directive +using-alias-directive: +using identifier = namespace-or-type-name ; +using-namespace-directive: +using namespace-name ; +namespace-member-declarations: +namespace-member-declaration +namespace-member-declarations namespace-member-declaration +namespace-member-declaration: +namespace-declaration +type-declaration +ISO/IEC 23270:2006(E) +460 ©ISO/IEC 2006 – All rights reserved +type-declaration: +class-declaration +struct-declaration +interface-declaration +enum-declaration +delegate-declaration + +qualified-alias-member: +identifier :: identifier type-argument-listopt + +A.2.6 Classes +class-declaration: +attributesopt class-modifiersopt partialopt class identifier type-parameter-listopt + class-baseopt type-parameter-constraints-clausesopt class-body ;opt +class-modifiers: +class-modifier +class-modifiers class-modifier +class-modifier: +new +public +protected +internal +private +abstract +sealed +static +class-base: +: class-type +: interface-type-list +: class-type , interface-type-list +interface-type-list: +interface-type +interface-type-list , interface-type +class-body: +{ class-member-declarationsopt } +class-member-declarations: +class-member-declaration +class-member-declarations class-member-declaration + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 461 +class-member-declaration: +constant-declaration +field-declaration +method-declaration +property-declaration +event-declaration +indexer-declaration +operator-declaration +constructor-declaration +finalizer-declaration +static-constructor-declaration +type-declaration +constant-declaration: +attributesopt constant-modifiersopt const type constant-declarators ; +constant-modifiers: +constant-modifier +constant-modifiers constant-modifier +constant-modifier: +new +public +protected +internal +private +constant-declarators: +constant-declarator +constant-declarators , constant-declarator +constant-declarator: +identifier = constant-expression +field-declaration: +attributesopt field-modifiersopt type variable-declarators ; +field-modifiers: +field-modifier +field-modifiers field-modifier +field-modifier: +new +public +protected +internal +private +static +readonly +volatile +variable-declarators: +variable-declarator +variable-declarators , variable-declarator +variable-declarator: +identifier +identifier = variable-initializer +ISO/IEC 23270:2006(E) +462 ©ISO/IEC 2006 – All rights reserved +variable-initializer: +expression +array-initializer +method-declaration: +method-header method-body +method-header: +attributesopt method-modifiersopt return-type member-name type-parameter-listopt + ( formal-parameter-listopt ) type-parameter-constraints-clausesopt +method-modifiers: +method-modifier +method-modifiers method-modifier +method-modifier: +new +public +protected +internal +private +static +virtual +sealed +override +abstract +extern +return-type: +type +void +member-name: +identifier +interface-type . identifier +method-body: +block +; +formal-parameter-list: +fixed-parameters +fixed-parameters , parameter-array +parameter-array +fixed-parameters: +fixed-parameter +fixed-parameters , fixed-parameter +fixed-parameter: +attributesopt parameter-modifieropt type identifier +parameter-modifier: +ref +out +parameter-array: +attributesopt params array-type identifier +property-declaration: +attributesopt property-modifiersopt type member-name { accessor-declarations } + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 463 +property-modifiers: +property-modifier +property-modifiers property-modifier +property-modifier: +new +public +protected +internal +private +static +virtual +sealed +override +abstract +extern +accessor-declarations: +get-accessor-declaration set-accessor-declarationopt +set-accessor-declaration get-accessor-declarationopt +get-accessor-declaration: +attributesopt accessor-modifieropt get accessor-body +set-accessor-declaration: +attributesopt accessor-modifieropt set accessor-body +accessor-modifier: +protected +internal +private +protected internal +internal protected +accessor-body: +block +; +event-declaration: +attributesopt event-modifiersopt event type variable-declarators ; +attributesopt event-modifiersopt event type member-name + { event-accessor-declarations } +event-modifiers: +event-modifier +event-modifiers event-modifier +event-modifier: +new +public +protected +internal +private +static +virtual +sealed +override +abstract +extern +ISO/IEC 23270:2006(E) +464 ©ISO/IEC 2006 – All rights reserved +event-accessor-declarations: +add-accessor-declaration remove-accessor-declaration +remove-accessor-declaration add-accessor-declaration +add-accessor-declaration: +attributesopt add block +remove-accessor-declaration: +attributesopt remove block +indexer-declaration: +attributesopt indexer-modifiersopt indexer-declarator { accessor-declarations } +indexer-modifiers: +indexer-modifier +indexer-modifiers indexer-modifier +indexer-modifier: +new +public +protected +internal +private +virtual +sealed +override +abstract +extern +indexer-declarator: +type this [ formal-parameter-list ] +type interface-type . this [ formal-parameter-list ] +operator-declaration: +attributesopt operator-modifiers operator-declarator operator-body +operator-modifiers: +operator-modifier +operator-modifiers operator-modifier +operator-modifier: +public +static +extern +operator-declarator: +unary-operator-declarator +binary-operator-declarator +conversion-operator-declarator +unary-operator-declarator: +type operator overloadable-unary-operator ( type identifier ) +overloadable-unary-operator: one of ++ - ! ~ ++ -- true false +binary-operator-declarator: +type operator overloadable-binary-operator ( type identifier , type identifier ) + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 465 +overloadable-binary-operator: one of ++ - * / % +& | ^ +<< right-shift +== != > < >= <= +conversion-operator-declarator: +implicit operator type ( type identifier ) +explicit operator type ( type identifier ) +operator-body: +block +; +constructor-declaration: +attributesopt constructor-modifiersopt constructor-declarator constructor-body +constructor-modifiers: +constructor-modifier +constructor-modifiers constructor-modifier +constructor-modifier: +public +protected +internal +private +extern +constructor-declarator: +identifier ( formal-parameter-listopt ) constructor-initializeropt +constructor-initializer: +: base ( argument-listopt ) +: this ( argument-listopt ) +constructor-body: +block +; +static-constructor-declaration: +attributesopt static-constructor-modifiers identifier ( ) static-constructor-body +static-constructor-modifiers: +externopt static +static externopt +static-constructor-body: +block +; +finalizer-declaration: +attributesopt externopt ~ identifier ( ) finalizer-body +finalizer-body: +block +; +A.2.7 Structs +struct-declaration: +attributesopt struct-modifiersopt partialopt struct identifier type-parameter-listopt + struct-interfacesopt type-parameter-constraints-clausesopt struct-body ;opt +ISO/IEC 23270:2006(E) +466 ©ISO/IEC 2006 – All rights reserved +struct-modifiers: +struct-modifier +struct-modifiers struct-modifier +struct-modifier: +new +public +protected +internal +private +struct-interfaces: +: interface-type-list +struct-body: +{ struct-member-declarationsopt } +struct-member-declarations: +struct-member-declaration +struct-member-declarations struct-member-declaration +struct-member-declaration: +constant-declaration +field-declaration +method-declaration +property-declaration +event-declaration +indexer-declaration +operator-declaration +constructor-declaration +static-constructor-declaration +type-declaration + +A.2.8 Arrays +array-type: +non-array-type rank-specifiers +non-array-type: +value-type +class-type +interface-type +delegate-type +type-parameter +rank-specifiers: +rank-specifier +rank-specifiers rank-specifier +rank-specifier: +[ dim-separatorsopt ] +dim-separators: +, +dim-separators , +array-initializer: +{ variable-initializer-listopt } +{ variable-initializer-list , } + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 467 +variable-initializer-list: +variable-initializer +variable-initializer-list , variable-initializer +variable-initializer: +expression +array-initializer + +A.2.9 Interfaces +interface-declaration: +attributesopt interface-modifiersopt partialopt interface identifier type-parameter-listopt + interface-baseopt type-parameter-constraints-clausesopt interface-body ;opt +interface-modifiers: +interface-modifier +interface-modifiers interface-modifier +interface-modifier: +new +public +protected +internal +private +interface-base: +: interface-type-list +interface-body: +{ interface-member-declarationsopt } +interface-member-declarations: +interface-member-declaration +interface-member-declarations interface-member-declaration +interface-member-declaration: +interface-method-declaration +interface-property-declaration +interface-event-declaration +interface-indexer-declaration +interface-method-declaration: +attributesopt newopt return-type identifier type-parameter-listopt + ( formal-parameter-listopt ) type-parameter-constraints-clausesopt ; +interface-property-declaration: +attributesopt newopt type identifier { interface-accessors } +interface-accessors: +attributesopt get ; +attributesopt set ; +attributesopt get ; attributesopt set ; +attributesopt set ; attributesopt get ; +interface-event-declaration: +attributesopt newopt event type identifier ; +interface-indexer-declaration: +attributesopt newopt type this [ formal-parameter-list ] { interface-accessors } + +ISO/IEC 23270:2006(E) +468 ©ISO/IEC 2006 – All rights reserved +A.2.10 Enums +enum-declaration: +attributesopt enum-modifiersopt enum identifier enum-baseopt enum-body ;opt +enum-base: +: integral-type +enum-body: +{ enum-member-declarationsopt } +{ enum-member-declarations , } +enum-modifiers: +enum-modifier +enum-modifiers enum-modifier +enum-modifier: +new +public +protected +internal +private +enum-member-declarations: +enum-member-declaration +enum-member-declarations , enum-member-declaration +enum-member-declaration: +attributesopt identifier +attributesopt identifier = constant-expression + +A.2.11 Delegates +delegate-declaration: +attributesopt delegate-modifiersopt delegate return-type identifier type-parameter-listopt + ( formal-parameter-listopt ) type-parameter-constraints-clausesopt ; +delegate-modifiers: +delegate-modifier +delegate-modifiers delegate-modifier +delegate-modifier: +new +public +protected +internal +private + +A.2.12 Attributes +global-attributes: +global-attribute-sections +global-attribute-sections: +global-attribute-section +global-attribute-sections global-attribute-section + ISO/IEC 23270:2006(E) + +©ISO/IEC 2006 – All rights reserved 469 +global-attribute-section: +[ global-attribute-target-specifier attribute-list ] +[ global-attribute-target-specifier attribute-list , ] +global-attribute-target-specifier: +global-attribute-target : +global-attribute-target: +identifier +keyword +attributes: +attribute-sections +attribute-sections: +attribute-section +attribute-sections attribute-section +attribute-section: +[ attribute-target-specifieropt attribute-list ] +[ attribute-target-specifieropt attribute-list , ] +attribute-target-specifier: +attribute-target : +attribute-target: +identifier +keyword +attribute-list: +attribute +attribute-list , attribute +attribute: +attribute-name attribute-argumentsopt +attribute-name: +type-name +attribute-arguments: +( positional-argument-listopt ) +( positional-argument-list , named-argument-list ) +( named-argument-list ) +positional-argument-list: +positional-argument +positional-argument-list , positional-argument +positional-argument: +attribute-argument-expression +named-argument-list: +named-argument +named-argument-list , named-argument +named-argument: +identifier = attribute-argument-expression +attribute-argument-expression: +expression + +ISO/IEC 23270:2006(E) +A.2.13 Generics +type-parameter-list: +< type-parameters > +type-parameters: +attributesopt type-parameter +type-parameters , attributesopt type-parameter +type-parameter: +identifier +type-argument-list: +< type-arguments > +type-arguments: +type-argument +type-arguments , type-argument +type-argument: +type +type-parameter-constraints-clauses: +type-parameter-constraints-clause +type-parameter-constraints-clauses type-parameter-constraints-clause +type-parameter-constraints-clause: +where type-parameter : type-parameter-constraints +type-parameter-constraints: +primary-constraint +secondary-constraints +constructor-constraint +primary-constraint , secondary-constraints +primary-constraint , constructor-constraint +secondary-constraints , constructor-constraint +primary-constraint , secondary-constraints , constructor-constraint +primary-constraint: +class-type +class +struct +secondary-constraints: +interface-type +type-parameter +secondary-constraints , interface-type +secondary-constraints , type-parameter +constructor-constraint: +new ( ) diff --git a/topics/grammars/csharp/iso-23270-2006/keywords.lst b/topics/grammars/csharp/iso-23270-2006/keywords.lst new file mode 100644 index 00000000..d2e52856 --- /dev/null +++ b/topics/grammars/csharp/iso-23270-2006/keywords.lst @@ -0,0 +1,24 @@ +abstract as base bool break +byte case catch char checked +class const continue decimal default +delegate do double else enum +event explicit extern false finally +fixed float for foreach goto +if implicit in int interface +internal is lock long namespace +new null object operator out +override params private protected public +readonly ref return sbyte sealed +short sizeof stackalloc static string +struct switch this throw true +try typeof uint ulong unchecked +unsafe ushort using virtual void +volatile while + +{ } [ ] ( ) . , : ; ++ - * / % & | ^ ! ~ += < > ? ?? :: ++ -- && || +-> == != <= >= += -= *= /= %= +&= |= ^= << <<= + +yield partial add remove get set where alias diff --git a/topics/grammars/csharp/msft-ls-1.0/Makefile b/topics/grammars/csharp/msft-ls-1.0/Makefile index 711427c4..f32ec47e 100644 --- a/topics/grammars/csharp/msft-ls-1.0/Makefile +++ b/topics/grammars/csharp/msft-ls-1.0/Makefile @@ -1,6 +1,9 @@ all: - ../../../../shared/tools/pdf2bgf msft-ls-1.0-annex.txt msft-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/pdf2bgf msft-ls-annex.txt msft-output.bgf banned-lines.lst keywords.lst ../../../../shared/tools/checkxml bgf msft-output.bgf - ../../../../shared/tools/normbgf msft-output.bgf msft-ls-1.0-grammar.bgf - ../../../../shared/tools/bgf2bnf msft-ls-1.0-grammar.bgf msft-ls-1.0.bnf + ../../../../shared/tools/normbgf msft-output.bgf msft-ls-grammar.bgf + ../../../../shared/tools/bgf2bnf msft-ls-grammar.bgf msft-ls.bnf rm -f msft-output.bgf + +clean: + rm -f msft-output.bgf msft-ls-grammar.bgf msft-ls.bnf diff --git a/topics/grammars/csharp/msft-ls-1.0/README.txt b/topics/grammars/csharp/msft-ls-1.0/README.txt index c069d408..d6b8c367 100644 --- a/topics/grammars/csharp/msft-ls-1.0/README.txt +++ b/topics/grammars/csharp/msft-ls-1.0/README.txt @@ -2,6 +2,8 @@ C# Language Specification Version 1.0 +http://download.microsoft.com/download/a/9/e/a9e229b9-fee5-4c3e-8476-917dee385062/CSharp%20Language%20Specification%20v1.0.doc + Copyright © Microsoft Corporation 1999-2002. All Rights Reserved. Please send corrections, comments, and other feedback to sharp@microsoft.com @@ -20,4 +22,4 @@ Errors spotted right away: [ global-attribute-target-specifier attribute-list ,] instead of [ global-attribute-target-specifier attribute-list , ] - (changed manually in msft-ls-1.0-annex.txt) \ No newline at end of file + (changed manually in msft-ls-1.0-annex.txt) diff --git a/topics/grammars/csharp/msft-ls-1.0/msft-ls-1.0-annex.txt b/topics/grammars/csharp/msft-ls-1.0/msft-ls-annex.txt similarity index 100% rename from topics/grammars/csharp/msft-ls-1.0/msft-ls-1.0-annex.txt rename to topics/grammars/csharp/msft-ls-1.0/msft-ls-annex.txt diff --git a/topics/grammars/csharp/msft-ls-3.0/Makefile b/topics/grammars/csharp/msft-ls-3.0/Makefile index 9e997e9f..f32ec47e 100644 --- a/topics/grammars/csharp/msft-ls-3.0/Makefile +++ b/topics/grammars/csharp/msft-ls-3.0/Makefile @@ -1,6 +1,9 @@ all: - ../../../../shared/tools/pdf2bgf msft-ls-3.0-annex.txt msft-output.bgf banned-lines.lst keywords.lst + ../../../../shared/tools/pdf2bgf msft-ls-annex.txt msft-output.bgf banned-lines.lst keywords.lst ../../../../shared/tools/checkxml bgf msft-output.bgf - ../../../../shared/tools/normbgf msft-output.bgf msft-ls-3.0-grammar.bgf - ../../../../shared/tools/bgf2bnf msft-ls-3.0-grammar.bgf msft-ls-3.0.bnf + ../../../../shared/tools/normbgf msft-output.bgf msft-ls-grammar.bgf + ../../../../shared/tools/bgf2bnf msft-ls-grammar.bgf msft-ls.bnf rm -f msft-output.bgf + +clean: + rm -f msft-output.bgf msft-ls-grammar.bgf msft-ls.bnf diff --git a/topics/grammars/csharp/msft-ls-3.0/msft-ls-3.0-annex.txt b/topics/grammars/csharp/msft-ls-3.0/msft-ls-annex.txt similarity index 100% rename from topics/grammars/csharp/msft-ls-3.0/msft-ls-3.0-annex.txt rename to topics/grammars/csharp/msft-ls-3.0/msft-ls-annex.txt