Given the alphabet $ = \{a, b, c\}$, i need to write a grammar for this language: $$L=\{ \mid ^+  aaa \notin \}$$I know that in my language the sequence of three consecutive $a$ cannot occur in any string, but how do I make a grammar of it? I'd need the thinking behind the construction of the grammar (like what's the first thing you should consider?), because so far I only manage to go by instinct and this doesn't always work.
How to write a grammar for this language?
formal languages;formal grammars
Your language is regular, and so one way to construct a context-free grammar for it is to first consider a finite state automaton, and then convert it to a grammar. Of course, this methodology only works for regular languages, and is not necessarily the easiest way in every case.