100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS3701 - Notes (Summary) R61,48   Add to cart

Summary

COS3701 - Notes (Summary)

 20 views  0 purchase

COS3701 - Notes (Summary) S - The study-notes marketplace Context Free Language (CFL) CFL is a language generated by some Context Free Grammer(CFG) CFGs CFG formal definition: Nonterminals are capital letters and terminals (since they can terminate, i.e end) are small values. Example: So...

[Show more]

Preview 4 out of 182  pages

  • May 7, 2022
  • 182
  • 2021/2022
  • Summary
All documents for this subject (26)
avatar-seller
Tutor23
COS3701 -
Notes
(Summary)

, Stuvia.com - The study-notes marketplace




Context Free Language (CFL)
CFL is a language generated by some Context Free Grammer(CFG)



CFGs
CFG formal definition:




Nonterminals are capital letters and terminals (since they can terminate, i.e end)
are small values.
Example:




So the general formulae is 𝑎𝑛 which is the language a*. Thus this CFG
generated the language a*. Remember a* means any certain number of a’s.
a* means any number of a’s. Can be 0 as well.

Note: -> is used in production and means ‘can be replaced by’ but the
double arrow means ‘çan develop into’.
Example:




Downloaded by: examsummaries29 | sarikanaidoo29@gmail.com
Distribution of this document is illegal

, Stuvia.com - The study-notes marketplace




This is also the language a*. So both CFG’s in the 1 st example and 2 nd example
generated the language a*. This illustrated that more than 1 CFG can generate
the same language.
Example




The language generated by the CFG is the set of all possible strings of the
letters a and b except for the null string. Thus it is not (a+b)* because this
includes the null string.
In my own words: So we can start of with either making S aS or bS. Then again
we can replace that S with either aS or bS again for any number of times. Then
we can end it by replacing S with either a or b which makes the language all
possible strings of the letters a and b except for the null string.
Example




Downloaded by: examsummaries29 | sarikanaidoo29@gmail.com
Distribution of this document is illegal

, Stuvia.com - The study-notes marketplace




From the start symbol S we can go to either X or Y. Notice then that X can only
produce the empty string .
Y can produce the same language as the previous example, i.e. all strings of a
and b excluding the empty string.




So adding then X production and Y productions then this CFG generates the
language (a+b)*. (a+b)* is any strings of a and b including the empty string .


Example




Also the word ab can be generated like this:
S=> aS
=>ab (S->b)




Downloaded by: examsummaries29 | sarikanaidoo29@gmail.com
Distribution of this document is illegal

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Tutor23. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R61,48. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67096 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R61,48
  • (0)
  Buy now