Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help5501

This forum is provided to promote discussion amongst students enrolled in CITS5501 Software Testing and Quality Assurance.

Before posting a question here, you might like to (1) search the forum for previous posts asking the same question, and (2) read the article How To Ask Questions The Smart Way .
And please keep the discussion civil (as required by UWA's Computer Use Policy, #9).
 

Options:
RSS cloud
Jump to:

project question 2

1 of 124 articles shown, currently no other people reading this forum.
photo
From: Arran S.
Date: Thu 28th May, 10:53am
Actions: 
        Login-to-reply

 

I was asked:

> for the example of 
> 
> <greetings> ::= "hello" <statement> | "hi" <statement>
> <statement> ::=  "you" | "world"
>
> Would I be correct in saying there are 4 terminal symbols (eg. hello, hi, you, world)?


Yes, there are four terminal symbols in that grammar - I've labelled them in this image:

https://gist.github.com/arranstewart/41d5d9576b3cde97ed7762ba66f44eac#file-symbols-png

> [and 4 productions?]

Yup. You can just think of "production" as meaning a "branch" or "alternative". As you say:  <greetings> has two alternatives, and 
<statement> has two alternatives. So 4 total.

I've labelled them in this image:

https://gist.github.com/arranstewart/41d5d9576b3cde97ed7762ba66f44eac#file-productions-png

So, note that the definition of "production" we're using means there are three productions in the following grammar, let's call it 
grammar A:

<outerthing> := <middlething>
<middlething> := <innerthing>
<innerthing> := "good morning"

But there is only one production in *this* grammar, let's call it grammar B:

<onlything> := "good morning"

So if we want production coverage, grammar A needs more tests than grammar B, even though they ultimately define exactly the same 
language. But that's okay. If we had some reason for using Grammar A instead of Grammar B (maybe we're leaving room in our language 
for future expansion, for instance), well, Grammar A definitely has more "parts" to it where failures might occur in an implementation 
- so we intuitively should expect there to be more tests.

Cheers

Arran

Related articles

project question 2 (both) RSS
├─ THIS   Thu 28th May, 10:53am, Arran S.
└─ reply 1   Thu 28th May, 10:56am, Arran S.  O.P.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  3:57pm Aug 06 2020