Meta Languages
-
Upload
liam-dunphy -
Category
Education
-
view
2.085 -
download
0
description
Transcript of Meta Languages
![Page 1: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/1.jpg)
Meta Languages in SDD
Software Design and Development
![Page 2: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/2.jpg)
Contents
2. EBNF2. EBNF
1. BNF1. BNF
3. Railroad diagram3. Railroad diagram
Course Specifications
NSW BOS Course Specifications
4. examples4. examples
![Page 3: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/3.jpg)
BNF
Abbreviation for Backus-Naur form.
BNF is a metalanguage used to define the syntax of a programming language.
It uses the following symbols:
Contents
![Page 4: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/4.jpg)
BNFexamples
This translates into English as:
•A postal address consists of a name-part, followed by a street-address part, followed by a zip-code part. •A name-part consists of either: a personal-part followed by a last name followed by an optional "jr-part" (Jr., Sr., or dynastic number) and end-of-line, or a personal part followed by a name part (this rule illustrates the use of recursion in BNFs, covering the case of people who use multiple first and middle names and/or initials). •A personal-part consists of either a first name or an initial followed by a dot. •A street address consists of a house number, followed by a street name, followed by an optional apartment specifier, followed by an end-of-line. •A zip-part consists of a town-name, followed by a comma, followed by a state code, followed by a ZIP-code followed by an end-of-line.
Note that many things (such as the format of a first-name, apartment specifier, ZIP-code, and Roman numeral) are left unspecified here. If necessary, they may be described using additional BNF rules.
Contents
![Page 5: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/5.jpg)
EBNF
Abbreviation for extended Backus-Naur form.EBNF is a metalanguage used to define the syntax of a programming language.
In this extended form the following symbols are used:
Interpretation:An identifier is defined to be a Letter followed by one or more Letters or Digits.Letter is a non-terminal symbol and is defined elsewhere, and Digit is another non-terminal symbol defined elsewhere.
Contents
![Page 6: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/6.jpg)
EBNFexampleContents
![Page 7: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/7.jpg)
Railroad diagram
This is an alternative, graphical method used to define the syntax of a programming language.
• Rectangles are used to enclose non-terminal symbols (that is, symbols that will be further defined).
• Circles or rounded rectangles are used to enclose terminal symbols.
These elements are linked by paths to show all legal combinations.
1. By starting at the left-hand side of the diagram and 2. tracing any path in a forward direction 3. to reach the right-hand side of the diagram, 4. a syntactically correct construct will be covered.
(‘Railroad’ in this context means a branch in the diagram is legal if it is treated as a set of points in a railroad layout and a train can take the branch in a forward direction only).
Contents
![Page 8: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/8.jpg)
Railroad diagramexampleContents
![Page 9: Meta Languages](https://reader033.fdocuments.us/reader033/viewer/2022061116/54664875b4af9f533f8b5432/html5/thumbnails/9.jpg)
BNF, EBNF, Railroad Diagramexample
One possible set of syntax diagrams for this grammar is:
Contents