title: Best modern text parsing? AKA When to use Lex and Yacc?
body: <p>I have as input blocks of text with commands and arguments, one per line, such as</p>
  
  <pre><code>XYZ ARG1,ARG2,ARG3,...,ARGN
  </code></pre>
  
  <p>And I want to verify that the arguments to <code>XYZ</code> are well formed for that particular command and execute the correct block of code if they are. There are something like ~100 commands, some of which have variable numbers of arguments, different relationships (i.e. if command <code>XYZ</code> was called then I need to have command <code>ABC</code> called as well).</p>
  
  <p>Also commands exist such as:</p>
  
  <pre><code>COMMAND
  XYZ ARG1
  BEF ARG1 ARG2
  ENDCOMMAND
  </code></pre>
  
  <p>It is important that the text is contained within <code>COMMAND</code> and <code>ENDCOMMAND</code>.</p>
  
  <p>Typically for something like this I would use Lex and Yacc rather than regex's, but is there anything more modern?  The code is written in C#. Is there anything in MSDN that does this rather than old school C Lex and Yacc?</p>