CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf

上传人:Iclinic170 文档编号:590580 上传时间:2018-12-15 格式:PDF 页数:28 大小:1.96MB
下载 相关 举报
CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf_第1页
第1页 / 共28页
CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf_第2页
第2页 / 共28页
CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf_第3页
第3页 / 共28页
CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf_第4页
第4页 / 共28页
CAN CSA-ISO IEC 14977-2002 Information Technology - Syntactic Metalanguage - Extended BNF.pdf_第5页
第5页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、 National Standard of CanadaCAN/CSA-ISO/IEC 14977-02(ISO/IEC 14977:1996)International Standard ISO/IEC 14977:1996 (first edition, 1996-12-15), has been adopted withoutmodification (IDT) as CSA Standard CAN/CSA-ISO/IEC 14977-02, which has been approved as a NationalStandard of Canada by the Standards

2、 Council of Canada.ISBN 1-55324-329-3 March 2002Reference numberISO/IEC 14977:1996(E)The Canadian Standards Association (CSA), The Standards Council of Canada is theunder whose auspices this National Standard has been coordinating body of the National Standards system, produced, was chartered in 191

3、9 and accredited by a federation of independent, autonomousthe Standards Council of Canada to the National organizations working towards the furtherStandards system in 1973. It is a not-for-profit, development and improvement of voluntarynonstatutory, voluntary membership association standardization

4、 in the national interest.engaged in standards development and certification The principal objects of the Council are to foster activities. and promote voluntary standardization as a means CSA standards reflect a national consensus of of advancing the national economy, benefiting theproducers and us

5、ers including manufacturers, health, safety, and welfare of the public, assisting consumers, retailers, unions and professional and protecting the consumer, facilitating domestic organizations, and governmental agencies. The and international trade, and furthering internationalstandards are used wid

6、ely by industry and commerce cooperation in the field of standards.and often adopted by municipal, provincial, and A National Standard of Canada is a standard whichfederal governments in their regulations, particularly in has been approved by the Standards Council ofthe fields of health, safety, bui

7、lding and construction, Canada and one which reflects a reasonableand the environment. agreement among the views of a number of capableIndividuals, companies, and associations across individuals whose collective interests provide to theCanada indicate their support for CSAs standards greatest practi

8、cable extent a balance ofdevelopment by volunteering their time and skills to representation of producers, users, consumers, andCSA Committee work and supporting the Associations others with relevant interests, as may be appropriateobjectives through sustaining memberships. The more to the subject i

9、n hand. It normally is a standardthan 7000 committee volunteers and the 2000 which is capable of making a significant and timelysustaining memberships together form CSAs total contribution to the national interest.membership from which its Directors are chosen. Approval of a standard as a National S

10、tandard ofSustaining memberships represent a major source of Canada indicates that a standard conforms to theincome for CSAs standards development activities. criteria and procedures established by the StandardsThe Association offers certification and testing Council of Canada. Approval does not ref

11、er to theservices in support of and as an extension to its technical content of the standard; this remains thestandards development activities. To ensure the continuing responsibility of the accreditedintegrity of its certification process, the Association standards-development organization.regularl

12、y and continually audits and inspects products Those who have a need to apply standards arethat bear the CSA Mark. encouraged to use National Standards of CanadaIn addition to its head office and laboratory complex whenever practicable. These standards are subject in Toronto, CSA has regional branch

13、 offices in major to periodic review; therefore, users are cautioned centres across Canada and inspection and testing to obtain the latest edition from the organizationagencies in eight countries. Since 1919, the preparing the standard.Association has developed the necessary expertise to The respons

14、ibility for approving National Standards meet its corporate mission: CSA is an independent of Canada rests with theservice organization whose mission is to provide an Standards Council of Canadaopen and effective forum for activities facilitating the 270 Albert Street, Suite 200exchange of goods and

15、 services through the use of Ottawa, Ontario, K1P 6N7standards, certification and related services to meet Canadanational and international needs.For further information on CSA services, write toCanadian Standards Association178 Rexdale BoulevardToronto, Ontario, M9W 1R3CanadaAlthough the intended p

16、rimary application of this Standard is stated in its Scope, it is importantto note that it remains the responsibility of the users to judge its suitability for their particular purpose.Registered trade-mark of Canadian Standards AssociationCAN/CSA-ISO/IEC 14977-02 Information technology Syntactic me

17、talanguage Extended BNFMarch 2002 Canadian Standards Association CSA/1CAN/CSA-ISO/IEC 14977-02Information technology Syntacticmetalanguage Extended BNFCSA PrefaceStandards development within the Information Technology sector is harmonized with internationalstandards development. Through the CSA Tech

18、nical Committee on Information Technology (TCIT),Canadians serve as the Canadian Advisory Committee (CAC) on ISO/IEC Joint Technical Committee 1 onInformation Technology (ISO/IEC JTC1) for the Standards Council of Canada (SCC), the ISO memberbody for Canada and sponsor of the Canadian National Commi

19、ttee of the IEC. Also, as a member of theInternational Telecommunication Union (ITU), Canada participates in the International Telegraph andTelephone Consultative Committee (ITU-T).This International Standard was reviewed by the CSA TCIT under the jurisdiction of the StrategicSteering Committee on I

20、nformation Technology and deemed acceptable for use in Canada. (A committeemembership list is available on request from the CSA Project Manager.) From time to time, ISO/IEC maypublish addenda, corrigenda, etc. The CSA TCIT will review these documents for approval and publication. For a listing, refe

21、r to the CSA Information Products catalogue or CSA Info Update or contact a CSA Salesrepresentative. This Standard has been formally approved, without modification, by these Committeesand has been approved as a National Standard of Canada by the Standards Council of Canada.March 2002 Canadian Standa

22、rds Association 2002All rights reserved. No part of this publication may be reproduced in any form whatsoever without the prior permission ofthe publisher. ISO/IEC material is reprinted with permission. Where the words “this International Standard” appear in thetext, they should be interpreted as “t

23、his National Standard of Canada”. Inquiries regarding this National Standard of Canada should be addressed to Canadian Standards Association 178 Rexdale Boulevard, Toronto, Ontario, Canada M9W 1R31-800-463-6727 416-747-4044www.csa.caINTERNATIONAL STANDARD ISO/IEC First edition 1996-l 2-l 5 Informati

24、on technology - Syntactic metalanguage - Extended BNF Technologies de /information - Mbtalangage syntaxique - BNF b) C it shows which sequences of symbols are valid sentences of the language; it shows the syntactic structure of any sentence of the language. The need for a standard syntactic metalang

25、uage Without a standard syntactic metalanguage every programming language definition starts by specifying the metalanguage used to define its syntax. This causes various problems: ISO/IEC 14977 : 1996(E) ISO/IEC Many different notations - It is unusual for two different programming languages to use

26、the same metalanguage. Thus human readers are handicapped by having to learn a new metalanguage before they can study a new language. Concepts not widely understood - The lack the use of rigorous unambiguous definitions. of a standard notation hinders Imperfect notations - Because a metalanguage nee

27、ds to be defined for every programming language, almost inevitably, the metalanguage contains defects. For example errors occurred in the drafting of RTL/2 (BS5904) and CORAL 66 (BS5905) because the metalanguages could not be typed easily. Special purpose notations - A metalanguage defined for a par

28、ticular pro- gramming language is often simplified by taking advantage of special features in the language to be defined. However, the metalanguage is then unsuitable for other programming languages. Few general syntax processors - The multiplicity of syntactic meta- languages has limited the availa

29、bility of computer programs to analyse and process syntaxes, e.g. to list a syntax neatly, to make an index of the symbols used in the syntax, to produce a syntax-checker for programs written in the language. In practice experienced readers have little difficulty in picking up and learning a new not

30、ation, but even so the differences obscure mutual understanding and hinder communication. A standard metalanguage enables more people to crystallize vague ideas into an unambiguous definition. It is also useful because other people needing to provide formal definitions no longer need to reinvent sim

31、ilar concepts. The objectives to be satisfied It is desirable that a standard syntactic metalanguage should be: a concise, so that languages can be defined briefly and thus be more easily understood; b) C precise, so that the rules are unambiguous; formal, so computer when that the rules can be requ

32、ired; parsed, or otherwise processed, bY a d) natural, so that the notation and format are relatively simple to learn and understand, even for those who are not themselves language designers; (The meaning of a symbol should not be surprising. It should also be possible to define the syntax of a lang

33、uage in a way that helps to indicate the meaning of the constructions.) e) general, so that the notation is suitable for many purposes including the description of many different languages; f-l simple in its character set and with a notation that avoids, as far as is practicable, using characters th

34、at are not generally available on standard keyboards (both typewriters and computer terminals) so that the rules can be typed and can be processed by computer programs; self describing, so that the notation is able to describe itself; vi 0 ISO/IEC ISO/IEC 14977 : 1996(E) h) linear, so that the synta

35、x can be expressed as a single stream of characters. (This simplifies printing a syntax. Computer processing of a syntax is also simpler.) Some common syntactic metalanguages Unfortunately n one of the existing sy adoption as the standard, for example: ntactic metalanguages was suitable for a) COBOL

36、 (IS0 1989:1985) lists alternatives vertically and uses brackets spreading over many lines. This is inconvenient for computer processing and cannot be prepared on typewriters. b) Backus-Naur Form (used in ALGOL 60) has problems if the metasymbols 1 := occur in the language being defined. Some common

37、 forms of construction (e.g. comments) cannot be expressed naturally, other constructions (e.g. repetition) are long-winded. c) The obsolete FORTRAN 77 (IS0 1539: 1980) had railroad tracks. These are easy to understand but difficult to prepare and to process on a computer or typewriter. The current

38、version, FORTRAN 90 (ISO/IEC 1539:1991), no longer uses this notation. Most other languages use a variant of one of these metalanguages. Most of them cannot be candidates for standardization because they use characters not in the language being defined as metasymbols of the metalanguage. This simpli

39、fies the metalanguage but prevents it from being used generally. POSIX (ISO/IEC 9945-2: 1993) includes two complementary facilities which both assume an ISO/IEC 646: 1991 character set is applicable: LEX permits the definition and lexical analysis of regular expressions, but is inadequate for the de

40、scription of an arbitrary context-free grammar, and YACC (Yet Another Compiler Compiler) is a parser generator for an LALR(l) grammar. The standard metalanguage Extended BNF Extended BNF, the metalanguage defined in this International Standard, is based on a suggestion by Niklaus Wirth (Wirth, 1977)

41、 that is based on Backus-Naur Form and that contains the most common extensions, i.e.: a) Terminal symbols of the language are quoted so that any character, including one used in Extended BNF, can be defined as a terminal symbol of the language being defined. b) and I indicate optional symbols. and

42、indicate repetition. d) Each rule has an explicit final character so that there is never any ambiguity about where a rule ends. e Brackets group ) in their ordinary items together. It is an obvious convenience to use ( and mathematical sense. The main differences in Extended BNF are further features

43、 that shown are often required when providing a formal definition: experience has vii ISOIIEC 14977 : 1996(E) ISO/IEC a) De$ning an explicit number of items. Fortran contains a rule that a label field contains exactly five characters; an identifier in PWI or COBOL has up to 32 characters: rules such

44、 as these can be expressed only with difficulty in Backus-Naur Form. In practice, such definitions are often left incomplete and the rules qualified informally in English. b) DeJining something by specifying the few exceptional cases. An Algol end-comment ends at the first end, else or semicolon. A

45、rule like this cannot be expressed concisely or clearly in Backus-Naur Form and is also usually specified informally in English. C Including comments. Programming a complicated syntax need many rules be clearer if explanations and cross-refe Extended BNF contains a comment facili to a syntax for the

46、 benefit of a human meaning of the syntax. languages and other structures with to define them. The syntax will rences can be provided; accordingly ty so that ordinary text can be added reader without affecting the formal d) Meta-identifier: A meta-identifier (the narne of a non-terminal symbol in th

47、e language) need not be a single word or enclosed in brackets because there is an explicit concatenate symbol. This also ensures that the layout of a syntax (except in a terminal symbol) does not affect the language being defined. e) Extensions. A user may wish to extend Extended BNF. A special-sequ

48、ence is provided for this purpose, the format and meaning of which are not defined in the standard except to ensure that the start and end of an extension can always be seen easily. Various possible extensions are outlined in the following paragraphs. Limitations and extensions The main limitation o

49、f Extended BNF is that the language being defined needs to be linear, i.e. the symbols in a sentence of the language can be placed in an ordered sequence. For example knitting patterns and recipes in cooking are linear languages, but electric circuit diagrams are not. A further limitation is that Extended BNF is inadequate for defining more complex forms of grammars. Such facilities were not provided because it was thought the main need was to define a notation sufficient for the simpler and commoner requirements. Instead Extended BNF has been designed so

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 标准规范 > 国际标准 > 其他

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1