A general process to construct a CFG.

  1. Start with the root, and define the all left characters and a variable for the right-end
  2. Continuously fill in the non-terminal left-sides until the right-end is the same as a previously defined variable

Examples