• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Sdd Syntax Descriptions
 

Sdd Syntax Descriptions

on

  • 1,216 views

 

Statistics

Views

Total Views
1,216
Views on SlideShare
1,200
Embed Views
16

Actions

Likes
0
Downloads
40
Comments
0

2 Embeds 16

http://pmonline.parramarist.nsw.edu.au 12
http://www.slideshare.net 4

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sdd Syntax Descriptions Sdd Syntax Descriptions Presentation Transcript

    • Implementing Software Solutions Language Syntax Required for Software Solutions
    • What is a Metalanguage?
      • Metalanguages provide an understanding of rules implemented into programming languages.
      • They represent a languages syntax which is used like a checklist when compiling a program to remove errors before execution takes place.
    • Why Do We Need Them?
      • Computers operate in an environmnet full of rules. The use of syntax descriptions enables the computer and programmer to understand the boundaries of its environment.
      • All data types, data structures and control structures used must have their own set of syntax developed to adhere to.
    • Types of Metalanguages?
      • BNF or EBNF – Which is a text based description of syntax.
      • Railroad Diagram – Is the graphical based description which is easier to understand.
    • BNF Symbols Is defined as :: = Indicates choice between elements | Non terminal symbol < > Meaning Symbol
    • EBNF Symbols Encloses optional elements [ ] Encloses elements to be repeated { } Is defined as = Indicates choice between elements | Non terminal symbol < > Meaning Symbol
    • Railroad Symbols Predefined element Fixed element Path lines Meaning Symbol
    • Activity 1
      • Consider the following EBNF diagram.
      • <Digit> = 1 | 2| 3
      • <Number> = <Digit> * <Digit>
      • <Sum> = {<Number>} – {<Number>}
      • Identify which of the following statements are legal and illegal.
          • Sum = (1 * 2) – (2 * 3)
          • Sum = (1 * 4) – (2 * 3)
          • Sum = (1 * 2) – (2 + 3)
    • Activity 1
      • Consider the following Railroad diagram.
      • Identify which of the following statements are legal and illegal.
          • String = 5a$
          • String = a$
          • String = aa43
          • String = $b56
          • String = aaac11bc$
      String Letter Number Letter $
    • Data Structure Syntax
      • Arrays
      • The declaration of an array is:
      • Arrayname(5)
      • Therefore, the syntax description would be:
      • <Digit> = 0 | 1 | 2 …| 9
      • <Letter> = a | b | c … |z
      • <Index> = {<Digit>}
      • <Arrayname> = {<Letter>}
      • <Array> = <Arrayname> (<Index>)
    • Data Structure Syntax
      • Arrays
      • So therefore if we typed in our code the following processes would be incorrect:
        • Dogs (10)
        • cat [1]
        • trees (index)
    • Data Structure Syntax
      • Multidimensional Arrays
      • The declaration of a multidimensional array is: Arrayname(Digit, Digit)
      Using this knowledge create a set syntax descriptions in railroad format for the above multidimensional array.
    • Data Structure Syntax
      • Array of Records
      • Below is an example of a Array of Records
      Create a set of syntax descriptions for an Array of records using EBNF 12 Ben 11 John Age Name
    • Activity 2
      • The following EBNF describes the rules for an array of records.
      • <Digit> = 1 | 2| 3…| 9
      • <Ucharacter> = A | B | C …..| Z
      • <LCharacter> = a | b | c ……| z
      • <Character> = <UCharacter> | <LCharacter>
      • <Boolean> = [Y|N] | [T|F]
      • <Fieldname> = {<Character>}
      • <Fieldentry> = {<Character> | <Digit> | <Boolean>}
      • <Record> = <Fieldname> {<Fieldentry>}
      • <Arrayofrecords> = <Record> {<Record>}
    • Activity 2
      • Identify whether the following are valid or invalid.
      a) b) c) 17 Dina Andys Age First Name Surname 78 Case 25 17 Ball 12 Cost Item ID1 F 23/4/02 John T 25/4/99 Jenny Medication Visit Patient
    • Activity 2
      • Below is a VB statement for opening a file via random access.
      • Open “MYFIL.FIL” For Random AS FileNum Len = Max
      Using either EBNF or Railroad create a set of syntax diagrams for this procedure.
    • Answer
      • <Digit> = 1 | 2| 3…| 9
      • <Ucharacter> = A | B | C …..| Z
      • <LCharacter> = a | b | c ……| z
      • <Character> = <UCharacter> | <LCharacter>
      • <Variable> = {<Character>}
      • <Filenumber> = {<Digit>}
      • <Accesstype> = Random | Sequential
      • <Pathname> = “ {<Character>} . {<Character} “
      • <Fileaccess> = Open <Pathname> For <Accesstype> As <Filenumber>
      • Len = <Variable>