MedVision ad

Ebnf :( (2 Viewers)

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
13. Write an EBNF description for the pseudocode pre-test iteration structure. Assume that identifier, digit and statement have been previously defined with the usual meaning.

Any pointers here? ~lost :(
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
well pre-test is WHILE ENDWHILE

so.... you'd probably have to define those two keywords, and hmmm i duno the syntax for ebnf lol i forgot it.
 

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
because the bloody forum parses all my EBNF as tags i attached the response as a text file

anyone know how to avoid that? :vcross:
 

Attachments

Last edited:
I

Iota

Guest
raymes said:
because the bloody forum parses all my EBNF as tags i attached the response as a text file

anyone know how to avoid that? :vcross:
Code:
well since we dont have any specific information regarding predefined elements (except statement, digit and identifier) it becomes trickier. 

also, since in psuedocode (im assumin thats what we're doing), carriage returns are used for separators, ive used # to represent a carriage return

pretest repetition = WHILE <condition> # <statement> # {<statement> #} END WHILE

condition = <identifier> <operator> (<identifier> | <value>)

operator =  "=" | "<" | ">" | "<=" | ">="      
 (^^ note here that quotation marks are often used when defining symbols as reserved words, as to avoid confusion)

value = <digit> {<digit>}

and thats about it - ask if u need any more help
this is a simplified version, for example the condition definition could have repetition added on to the end, with logical operators, e.g. in the statement:

alive = true AND funny > 4 OR notfunny < 2
[ code ]stuff here[ /code ]
 

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
:)
danke
as those nazis say when you show them your identification in WW2 FPSs
 

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
technically you do need them because you couldnt write a 'while' statement in psuedocode without them.

for example, in psuedocode, you couldnt write

Code:
While number< 3 number = number + 1 end while
it would be
Code:
while number<3
     number = number + 1
end while
thats where the #'s come in
theyre not actually # in the code, i just used them to represent carriage returns and a carriage return is an integral part of the psuedocode language as ive shown above so you really do need them
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Top