Meta Languages Railroad Diagrams

1,658 views 27 slides Jul 20, 2009
Slide 1
Slide 1 of 27
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27

About This Presentation

Meta Languages. Railroad Diagrams for Prelim Software Design and Development


Slide Content

Kelly Bauer Meta Languages

Why? Describes the syntax of a computer language Rules that govern the arrangement of elements in a language eg . The ran cat OR The cat ran

Why not just learn the language? Programming languages are very complex. You cant possibly know every way to do everything that you want. The likelihood is that you won’t program in the language you learn.

Why not just learn the language? Programming languages are very complex. You cant possibly know every way to do everything that you want. The likelihood is that you won’t program in the language you learn. Allows language specifications be understood by programmers and allows more learnability between languages

2 Basic Forms Railroad diagram (aka syntax structure diagrams) BNF/EBNF

Railroad diagrams

Elements Allowable Paths

Pre defined langauge elements Eg , letter, sentence, program, variable name Variable

Fixed Elements Reserved words, eg , Dim, -+, 0, 1 Dim As

The elements can be combined to give options Eg , A Boolean Constant T F

Or to repeat elements Eg , A word Letter

And these can then be combined Eg , a number that can be either positive or negative _ Digit

Textbook Pg 168 Defines the Winston language in railroad diagrams Is the following legitimate conditions Abcd = +99

Abcd = +99 Abcd is a legitimate identifier, because it starts with an uppercase followed by a number of lower case +99 is a legitimate constant because it is a negative followed by a number of digits The statement follows the correct order of Identifier condition constant Davis, Sam (2008) Software Design and Development: The Preliminary Course, Parramatta Education Centre, Sydney

Abcd = +99 Abcd is a legitimate identifier, because it starts with an uppercase followed by a number of lower case +99 is a legitimate constant because it is a negative followed by a number of digits The statement follows the correct order of Identifier condition constant

Complete 2 nd activity on pg 168 TEXT ACTIVITY

an example

In Visual Basic Construct a railroad diagram to describe a best practice, legal variable declaration. Should follow the following structure: Dim Public or Private Variable Name As Data Type

Dim Public Private Variable As Data Type From this, what needs to be further defined?

Data type In Visual Basic, this can be Boolean, Byte, Char, Date, Time, Decimal, Double, Int , Long, Object, Short, Single

Boolean Byte Char Date Time Decimal Double Int Long Short Single

Variables in VB Must begin with an uppercase letter Can be lower or upper case or digits after first letter

Upper Case LowerCase UpperCase Digit

1 2 3 4 5 6 7 8 9

Images from http :// www.trs-80.com/trs80-mag-books.htm http://homepages.cwi.nl/~ dik/english/codes/punched.html http://www.borislavdopudja.net/en/writings/cheating_google /