I am trying to solve the following context free grammar problem with hashtag approach but i can't figure it out. Can anyone help please?

Show a context-free grammar for the following languages: $$\{w\in\{a,b\}^*: \#_a(w)=2\#_b(w)\} $$

  • $\begingroup$ Can you explain what is hashtag approach? $\endgroup$ – Apass.Jack Dec 7 '18 at 11:37
  • $\begingroup$ The exercise has a hashtag and that's what is confusing me. $\endgroup$ – csandreas1 Dec 7 '18 at 11:43
  • 1
    $\begingroup$ $\#_a(w)$ probably means simply the number of "a"s in $w$... $\endgroup$ – dkaeae Dec 7 '18 at 13:09
  • $\begingroup$ Why do you copy-paste a grammar for the language $\{ a^ ib^ jc^k \mid i=j \text{ or } j=k\}$ in your question? $\endgroup$ – Hendrik Jan Dec 7 '18 at 18:49
  • $\begingroup$ My comment is irrelevant to the question, but what a veteran of formal grammar @HendrikJan is! $\endgroup$ – Apass.Jack Dec 7 '18 at 20:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.