Describing a grammar and associated parser
if you don't count rembering the symbols of previous lines it's a regular language here's the regex as I see it (&lt;char&gt; is translated to [a-z])

[a-z]\s*,\s*([a-z]|None)\s*,\s*(R|L|P[a-z](R|L))\s*,\s*[a-z]\n


use capturing groups as necessary ;)