Circular definition grammar in programming? [closed]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I was set some homework, and got stuck on one of the questions, in fact I cant see how I am wrong. I was hoping someone could explain?



If the only rule we have for making words is
word -> counter-word
how many words can we make, starting with word?


Options are



None
1
2
Infinitely Many


I guessed Infinitely Many as I can think of millions of words I can make, just looping the process of appending counter- before the word.



Apparently its None, how can it be none? He says its none because its a circular definition, but I don't understand this? Can someone explain.



He says that we can never stop. So if we can never stop surely it can't be none? Heres a video on YouTube talking about it.










share|improve this question







New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as primarily opinion-based by Jason Bassford, Mitch, sumelic, JJJ, TrevorD Apr 2 at 14:15


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

    – Richard Z
    Apr 1 at 18:21








  • 1





    It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

    – Jason Bassford
    Apr 1 at 18:47








  • 1





    Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

    – Mitch
    Apr 1 at 21:45











  • Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

    – Jim
    Apr 1 at 21:56











  • I'm voting to close this question as off-topic because it is about formal languages, not about English.

    – sumelic
    Apr 2 at 5:38


















0















I was set some homework, and got stuck on one of the questions, in fact I cant see how I am wrong. I was hoping someone could explain?



If the only rule we have for making words is
word -> counter-word
how many words can we make, starting with word?


Options are



None
1
2
Infinitely Many


I guessed Infinitely Many as I can think of millions of words I can make, just looping the process of appending counter- before the word.



Apparently its None, how can it be none? He says its none because its a circular definition, but I don't understand this? Can someone explain.



He says that we can never stop. So if we can never stop surely it can't be none? Heres a video on YouTube talking about it.










share|improve this question







New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as primarily opinion-based by Jason Bassford, Mitch, sumelic, JJJ, TrevorD Apr 2 at 14:15


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

    – Richard Z
    Apr 1 at 18:21








  • 1





    It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

    – Jason Bassford
    Apr 1 at 18:47








  • 1





    Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

    – Mitch
    Apr 1 at 21:45











  • Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

    – Jim
    Apr 1 at 21:56











  • I'm voting to close this question as off-topic because it is about formal languages, not about English.

    – sumelic
    Apr 2 at 5:38














0












0








0


1






I was set some homework, and got stuck on one of the questions, in fact I cant see how I am wrong. I was hoping someone could explain?



If the only rule we have for making words is
word -> counter-word
how many words can we make, starting with word?


Options are



None
1
2
Infinitely Many


I guessed Infinitely Many as I can think of millions of words I can make, just looping the process of appending counter- before the word.



Apparently its None, how can it be none? He says its none because its a circular definition, but I don't understand this? Can someone explain.



He says that we can never stop. So if we can never stop surely it can't be none? Heres a video on YouTube talking about it.










share|improve this question







New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I was set some homework, and got stuck on one of the questions, in fact I cant see how I am wrong. I was hoping someone could explain?



If the only rule we have for making words is
word -> counter-word
how many words can we make, starting with word?


Options are



None
1
2
Infinitely Many


I guessed Infinitely Many as I can think of millions of words I can make, just looping the process of appending counter- before the word.



Apparently its None, how can it be none? He says its none because its a circular definition, but I don't understand this? Can someone explain.



He says that we can never stop. So if we can never stop surely it can't be none? Heres a video on YouTube talking about it.







british-english programming






share|improve this question







New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 1 at 18:01









Adam GAdam G

1




1




New contributor




Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Adam G is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




closed as primarily opinion-based by Jason Bassford, Mitch, sumelic, JJJ, TrevorD Apr 2 at 14:15


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as primarily opinion-based by Jason Bassford, Mitch, sumelic, JJJ, TrevorD Apr 2 at 14:15


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.















  • The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

    – Richard Z
    Apr 1 at 18:21








  • 1





    It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

    – Jason Bassford
    Apr 1 at 18:47








  • 1





    Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

    – Mitch
    Apr 1 at 21:45











  • Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

    – Jim
    Apr 1 at 21:56











  • I'm voting to close this question as off-topic because it is about formal languages, not about English.

    – sumelic
    Apr 2 at 5:38



















  • The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

    – Richard Z
    Apr 1 at 18:21








  • 1





    It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

    – Jason Bassford
    Apr 1 at 18:47








  • 1





    Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

    – Mitch
    Apr 1 at 21:45











  • Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

    – Jim
    Apr 1 at 21:56











  • I'm voting to close this question as off-topic because it is about formal languages, not about English.

    – sumelic
    Apr 2 at 5:38

















The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

– Richard Z
Apr 1 at 18:21







The rule will never terminate. It starts constructing the first word and the just goes on for ever and ever. So it never finishes constructing even the first word, i.e. it forms 0 words. A crucial aspect that must be included though is that “word” is a non-terminal in that grammar.

– Richard Z
Apr 1 at 18:21






1




1





It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

– Jason Bassford
Apr 1 at 18:47







It depends on if it's talking about unique words. You can keep making the same words, but they won't be unique. Also, it depends on how many words you have to start with. If it's only is talking about unique words, and the existing set of words do not include any that their counter, then you can only double what you started with. (This also presume that you cannot have counter-counter-word.) The question, as it stands, is flawed, because there are too many unstated assumptions.

– Jason Bassford
Apr 1 at 18:47






1




1





Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

– Mitch
Apr 1 at 21:45





Ask your teacher. We don't know what they intended. Also, this is a question for computer science or programming concepts and their technical labels, not about English.

– Mitch
Apr 1 at 21:45













Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

– Jim
Apr 1 at 21:56





Where does the first word come from? It takes a word to make a word. The seed had to come first (from some other rule) in order to apply this rule- But it has been stipulated that this is the only rule.

– Jim
Apr 1 at 21:56













I'm voting to close this question as off-topic because it is about formal languages, not about English.

– sumelic
Apr 2 at 5:38





I'm voting to close this question as off-topic because it is about formal languages, not about English.

– sumelic
Apr 2 at 5:38










2 Answers
2






active

oldest

votes


















0














* Quick Explanation*
Rule: "Word ----> counter-word"
Question: How many words can we generate?
Answer: If Word --> counter-word = true
then
word = counter - word
and
word = x
where x = "Any other word not equal to "counter-word"
then print("Keep reading cause this dont make no sense ;)



The opposite of hot is cold, so "Word" -> "Counter-word" in that example is "hot" -> "cold" , another example would be "stop" -> "go" , "left" -> "right" and on and on until the amount of possible pairs is exhausted.
Now, "word" has no opposite except "counter-word, non-word, etc" But the reason no other answer id accepted is because this is a logical primer meant to teach you to take syntax very literally and to pay close attention to the semantics if you will.
Computer science and language run hand in hand and logic is the staple of computer science ;).






share|improve this answer








New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

    – Richard Z
    Apr 1 at 19:46











  • what exactly do you mean?

    – user342390
    Apr 1 at 21:49











  • “"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

    – Richard Z
    Apr 1 at 22:14



















0














None is correct and it is because of his reason. If the grammar never terminates, the 'words' it generates are never actually formed because the grammar just keeps appending more and more symbols. For example:




Grammar:

S -> aS



Generation:

aS > aaS > aaaS > aaaaS > ...




This grammar will just keep appending a's forever. Because of this, it will never be able to output any finished words because the string will always contain a non-terminal and will continue processing them indefinitely.



Another phrase to describe this is that the grammar is recursive and non-terminating.



If we add another rule,




Grammar:
S -> aS | a




We can now generate any length of a's because the S will eventually be replaced with a terminal, giving us a string consisting of only terminals (i.e. a finished word).






share|improve this answer


























  • Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

    – Richard Z
    Apr 1 at 19:47











  • @RichardZ Yeah, that's a much better way to phrase it. Thanks

    – Veskah
    Apr 1 at 19:49


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














* Quick Explanation*
Rule: "Word ----> counter-word"
Question: How many words can we generate?
Answer: If Word --> counter-word = true
then
word = counter - word
and
word = x
where x = "Any other word not equal to "counter-word"
then print("Keep reading cause this dont make no sense ;)



The opposite of hot is cold, so "Word" -> "Counter-word" in that example is "hot" -> "cold" , another example would be "stop" -> "go" , "left" -> "right" and on and on until the amount of possible pairs is exhausted.
Now, "word" has no opposite except "counter-word, non-word, etc" But the reason no other answer id accepted is because this is a logical primer meant to teach you to take syntax very literally and to pay close attention to the semantics if you will.
Computer science and language run hand in hand and logic is the staple of computer science ;).






share|improve this answer








New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

    – Richard Z
    Apr 1 at 19:46











  • what exactly do you mean?

    – user342390
    Apr 1 at 21:49











  • “"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

    – Richard Z
    Apr 1 at 22:14
















0














* Quick Explanation*
Rule: "Word ----> counter-word"
Question: How many words can we generate?
Answer: If Word --> counter-word = true
then
word = counter - word
and
word = x
where x = "Any other word not equal to "counter-word"
then print("Keep reading cause this dont make no sense ;)



The opposite of hot is cold, so "Word" -> "Counter-word" in that example is "hot" -> "cold" , another example would be "stop" -> "go" , "left" -> "right" and on and on until the amount of possible pairs is exhausted.
Now, "word" has no opposite except "counter-word, non-word, etc" But the reason no other answer id accepted is because this is a logical primer meant to teach you to take syntax very literally and to pay close attention to the semantics if you will.
Computer science and language run hand in hand and logic is the staple of computer science ;).






share|improve this answer








New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

    – Richard Z
    Apr 1 at 19:46











  • what exactly do you mean?

    – user342390
    Apr 1 at 21:49











  • “"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

    – Richard Z
    Apr 1 at 22:14














0












0








0







* Quick Explanation*
Rule: "Word ----> counter-word"
Question: How many words can we generate?
Answer: If Word --> counter-word = true
then
word = counter - word
and
word = x
where x = "Any other word not equal to "counter-word"
then print("Keep reading cause this dont make no sense ;)



The opposite of hot is cold, so "Word" -> "Counter-word" in that example is "hot" -> "cold" , another example would be "stop" -> "go" , "left" -> "right" and on and on until the amount of possible pairs is exhausted.
Now, "word" has no opposite except "counter-word, non-word, etc" But the reason no other answer id accepted is because this is a logical primer meant to teach you to take syntax very literally and to pay close attention to the semantics if you will.
Computer science and language run hand in hand and logic is the staple of computer science ;).






share|improve this answer








New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










* Quick Explanation*
Rule: "Word ----> counter-word"
Question: How many words can we generate?
Answer: If Word --> counter-word = true
then
word = counter - word
and
word = x
where x = "Any other word not equal to "counter-word"
then print("Keep reading cause this dont make no sense ;)



The opposite of hot is cold, so "Word" -> "Counter-word" in that example is "hot" -> "cold" , another example would be "stop" -> "go" , "left" -> "right" and on and on until the amount of possible pairs is exhausted.
Now, "word" has no opposite except "counter-word, non-word, etc" But the reason no other answer id accepted is because this is a logical primer meant to teach you to take syntax very literally and to pay close attention to the semantics if you will.
Computer science and language run hand in hand and logic is the staple of computer science ;).







share|improve this answer








New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered Apr 1 at 19:39









user342390user342390

112




112




New contributor




user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user342390 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

    – Richard Z
    Apr 1 at 19:46











  • what exactly do you mean?

    – user342390
    Apr 1 at 21:49











  • “"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

    – Richard Z
    Apr 1 at 22:14



















  • This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

    – Richard Z
    Apr 1 at 19:46











  • what exactly do you mean?

    – user342390
    Apr 1 at 21:49











  • “"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

    – Richard Z
    Apr 1 at 22:14

















This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

– Richard Z
Apr 1 at 19:46





This is very unclear. The question is about a context free grammar where “counter” is a terminal and “word” a non-terminal symbol. They are not variables to be substituted with natural language words like cold, go or right. You’re mischaracterizing the core of the question.

– Richard Z
Apr 1 at 19:46













what exactly do you mean?

– user342390
Apr 1 at 21:49





what exactly do you mean?

– user342390
Apr 1 at 21:49













“"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

– Richard Z
Apr 1 at 22:14





“"Counter-word" in that example is "hot" -> "cold" ” - that’s not what the question is about. “Counter” can be any symbol. Say “a” or “foo” or “blupp”. It is NOT intended as a short form for “opposite.” Are you familiar with Context Free Grammar?

– Richard Z
Apr 1 at 22:14













0














None is correct and it is because of his reason. If the grammar never terminates, the 'words' it generates are never actually formed because the grammar just keeps appending more and more symbols. For example:




Grammar:

S -> aS



Generation:

aS > aaS > aaaS > aaaaS > ...




This grammar will just keep appending a's forever. Because of this, it will never be able to output any finished words because the string will always contain a non-terminal and will continue processing them indefinitely.



Another phrase to describe this is that the grammar is recursive and non-terminating.



If we add another rule,




Grammar:
S -> aS | a




We can now generate any length of a's because the S will eventually be replaced with a terminal, giving us a string consisting of only terminals (i.e. a finished word).






share|improve this answer


























  • Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

    – Richard Z
    Apr 1 at 19:47











  • @RichardZ Yeah, that's a much better way to phrase it. Thanks

    – Veskah
    Apr 1 at 19:49
















0














None is correct and it is because of his reason. If the grammar never terminates, the 'words' it generates are never actually formed because the grammar just keeps appending more and more symbols. For example:




Grammar:

S -> aS



Generation:

aS > aaS > aaaS > aaaaS > ...




This grammar will just keep appending a's forever. Because of this, it will never be able to output any finished words because the string will always contain a non-terminal and will continue processing them indefinitely.



Another phrase to describe this is that the grammar is recursive and non-terminating.



If we add another rule,




Grammar:
S -> aS | a




We can now generate any length of a's because the S will eventually be replaced with a terminal, giving us a string consisting of only terminals (i.e. a finished word).






share|improve this answer


























  • Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

    – Richard Z
    Apr 1 at 19:47











  • @RichardZ Yeah, that's a much better way to phrase it. Thanks

    – Veskah
    Apr 1 at 19:49














0












0








0







None is correct and it is because of his reason. If the grammar never terminates, the 'words' it generates are never actually formed because the grammar just keeps appending more and more symbols. For example:




Grammar:

S -> aS



Generation:

aS > aaS > aaaS > aaaaS > ...




This grammar will just keep appending a's forever. Because of this, it will never be able to output any finished words because the string will always contain a non-terminal and will continue processing them indefinitely.



Another phrase to describe this is that the grammar is recursive and non-terminating.



If we add another rule,




Grammar:
S -> aS | a




We can now generate any length of a's because the S will eventually be replaced with a terminal, giving us a string consisting of only terminals (i.e. a finished word).






share|improve this answer















None is correct and it is because of his reason. If the grammar never terminates, the 'words' it generates are never actually formed because the grammar just keeps appending more and more symbols. For example:




Grammar:

S -> aS



Generation:

aS > aaS > aaaS > aaaaS > ...




This grammar will just keep appending a's forever. Because of this, it will never be able to output any finished words because the string will always contain a non-terminal and will continue processing them indefinitely.



Another phrase to describe this is that the grammar is recursive and non-terminating.



If we add another rule,




Grammar:
S -> aS | a




We can now generate any length of a's because the S will eventually be replaced with a terminal, giving us a string consisting of only terminals (i.e. a finished word).







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 1 at 19:48

























answered Apr 1 at 18:49









VeskahVeskah

31415




31415













  • Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

    – Richard Z
    Apr 1 at 19:47











  • @RichardZ Yeah, that's a much better way to phrase it. Thanks

    – Veskah
    Apr 1 at 19:49



















  • Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

    – Richard Z
    Apr 1 at 19:47











  • @RichardZ Yeah, that's a much better way to phrase it. Thanks

    – Veskah
    Apr 1 at 19:49

















Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

– Richard Z
Apr 1 at 19:47





Change “keeps appending more and more rules” to “more and more symbols”. There is only one rule in this grammar.

– Richard Z
Apr 1 at 19:47













@RichardZ Yeah, that's a much better way to phrase it. Thanks

– Veskah
Apr 1 at 19:49





@RichardZ Yeah, that's a much better way to phrase it. Thanks

– Veskah
Apr 1 at 19:49



Popular posts from this blog

Bruad Bilen | Luke uk diar | NawigatsjuunCommonskategorii: BruadCommonskategorii: RunstükenWikiquote: Bruad

What is the offset in a seaplane's hull?

Slayer Innehåll Historia | Stil, komposition och lyrik | Bandets betydelse och framgångar | Sidoprojekt och samarbeten | Kontroverser | Medlemmar | Utmärkelser och nomineringar | Turnéer och festivaler | Diskografi | Referenser | Externa länkar | Navigeringsmenywww.slayer.net”Metal Massacre vol. 1””Metal Massacre vol. 3””Metal Massacre Volume III””Show No Mercy””Haunting the Chapel””Live Undead””Hell Awaits””Reign in Blood””Reign in Blood””Gold & Platinum – Reign in Blood””Golden Gods Awards Winners”originalet”Kerrang! Hall Of Fame””Slayer Looks Back On 37-Year Career In New Video Series: Part Two””South of Heaven””Gold & Platinum – South of Heaven””Seasons in the Abyss””Gold & Platinum - Seasons in the Abyss””Divine Intervention””Divine Intervention - Release group by Slayer””Gold & Platinum - Divine Intervention””Live Intrusion””Undisputed Attitude””Abolish Government/Superficial Love””Release “Slatanic Slaughter: A Tribute to Slayer” by Various Artists””Diabolus in Musica””Soundtrack to the Apocalypse””God Hates Us All””Systematic - Relationships””War at the Warfield””Gold & Platinum - War at the Warfield””Soundtrack to the Apocalypse””Gold & Platinum - Still Reigning””Metallica, Slayer, Iron Mauden Among Winners At Metal Hammer Awards””Eternal Pyre””Eternal Pyre - Slayer release group””Eternal Pyre””Metal Storm Awards 2006””Kerrang! Hall Of Fame””Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Bullet-For My Valentine booed at Metal Hammer Golden Gods Awards””Unholy Aliance””The End Of Slayer?””Slayer: We Could Thrash Out Two More Albums If We're Fast Enough...””'The Unholy Alliance: Chapter III' UK Dates Added”originalet”Megadeth And Slayer To Co-Headline 'Canadian Carnage' Trek”originalet”World Painted Blood””Release “World Painted Blood” by Slayer””Metallica Heading To Cinemas””Slayer, Megadeth To Join Forces For 'European Carnage' Tour - Dec. 18, 2010”originalet”Slayer's Hanneman Contracts Acute Infection; Band To Bring In Guest Guitarist””Cannibal Corpse's Pat O'Brien Will Step In As Slayer's Guest Guitarist”originalet”Slayer’s Jeff Hanneman Dead at 49””Dave Lombardo Says He Made Only $67,000 In 2011 While Touring With Slayer””Slayer: We Do Not Agree With Dave Lombardo's Substance Or Timeline Of Events””Slayer Welcomes Drummer Paul Bostaph Back To The Fold””Slayer Hope to Unveil Never-Before-Heard Jeff Hanneman Material on Next Album””Slayer Debut New Song 'Implode' During Surprise Golden Gods Appearance””Release group Repentless by Slayer””Repentless - Slayer - Credits””Slayer””Metal Storm Awards 2015””Slayer - to release comic book "Repentless #1"””Slayer To Release 'Repentless' 6.66" Vinyl Box Set””BREAKING NEWS: Slayer Announce Farewell Tour””Slayer Recruit Lamb of God, Anthrax, Behemoth + Testament for Final Tour””Slayer lägger ner efter 37 år””Slayer Announces Second North American Leg Of 'Final' Tour””Final World Tour””Slayer Announces Final European Tour With Lamb of God, Anthrax And Obituary””Slayer To Tour Europe With Lamb of God, Anthrax And Obituary””Slayer To Play 'Last French Show Ever' At Next Year's Hellfst””Slayer's Final World Tour Will Extend Into 2019””Death Angel's Rob Cavestany On Slayer's 'Farewell' Tour: 'Some Of Us Could See This Coming'””Testament Has No Plans To Retire Anytime Soon, Says Chuck Billy””Anthrax's Scott Ian On Slayer's 'Farewell' Tour Plans: 'I Was Surprised And I Wasn't Surprised'””Slayer””Slayer's Morbid Schlock””Review/Rock; For Slayer, the Mania Is the Message””Slayer - Biography””Slayer - Reign In Blood”originalet”Dave Lombardo””An exclusive oral history of Slayer”originalet”Exclusive! Interview With Slayer Guitarist Jeff Hanneman”originalet”Thinking Out Loud: Slayer's Kerry King on hair metal, Satan and being polite””Slayer Lyrics””Slayer - Biography””Most influential artists for extreme metal music””Slayer - Reign in Blood””Slayer guitarist Jeff Hanneman dies aged 49””Slatanic Slaughter: A Tribute to Slayer””Gateway to Hell: A Tribute to Slayer””Covered In Blood””Slayer: The Origins of Thrash in San Francisco, CA.””Why They Rule - #6 Slayer”originalet”Guitar World's 100 Greatest Heavy Metal Guitarists Of All Time”originalet”The fans have spoken: Slayer comes out on top in readers' polls”originalet”Tribute to Jeff Hanneman (1964-2013)””Lamb Of God Frontman: We Sound Like A Slayer Rip-Off””BEHEMOTH Frontman Pays Tribute To SLAYER's JEFF HANNEMAN””Slayer, Hatebreed Doing Double Duty On This Year's Ozzfest””System of a Down””Lacuna Coil’s Andrea Ferro Talks Influences, Skateboarding, Band Origins + More””Slayer - Reign in Blood””Into The Lungs of Hell””Slayer rules - en utställning om fans””Slayer and Their Fans Slashed Through a No-Holds-Barred Night at Gas Monkey””Home””Slayer””Gold & Platinum - The Big 4 Live from Sofia, Bulgaria””Exclusive! Interview With Slayer Guitarist Kerry King””2008-02-23: Wiltern, Los Angeles, CA, USA””Slayer's Kerry King To Perform With Megadeth Tonight! - Oct. 21, 2010”originalet”Dave Lombardo - Biography”Slayer Case DismissedArkiveradUltimate Classic Rock: Slayer guitarist Jeff Hanneman dead at 49.”Slayer: "We could never do any thing like Some Kind Of Monster..."””Cannibal Corpse'S Pat O'Brien Will Step In As Slayer'S Guest Guitarist | The Official Slayer Site”originalet”Slayer Wins 'Best Metal' Grammy Award””Slayer Guitarist Jeff Hanneman Dies””Kerrang! Awards 2006 Blog: Kerrang! Hall Of Fame””Kerrang! Awards 2013: Kerrang! Legend”originalet”Metallica, Slayer, Iron Maien Among Winners At Metal Hammer Awards””Metal Hammer Golden Gods Awards””Bullet For My Valentine Booed At Metal Hammer Golden Gods Awards””Metal Storm Awards 2006””Metal Storm Awards 2015””Slayer's Concert History””Slayer - Relationships””Slayer - Releases”Slayers officiella webbplatsSlayer på MusicBrainzOfficiell webbplatsSlayerSlayerr1373445760000 0001 1540 47353068615-5086262726cb13906545x(data)6033143kn20030215029