title: Types of Errors during Compilation and at Runtime
body: <p>I have this question in a homework assignment for my Computer Languages class. I'm trying to figure out what each one means, but I'm getting stuck.</p>
  
  <blockquote>
    <p>Errors in a computer program can be
    classified according to when they are
    detected and, if they are detected at
    compile time, what part of the
    compiler detects them. Using your
    favorite programming language, give an
    example of:</p>
    
    <p>(a) A lexical error, detected by the
    scanner.</p>
    
    <p>(b) A syntax error, detected by the
    parser.</p>
    
    <p>(c) A static semantic error, detected
    (at compile-time) by semantic
    analysis.</p>
    
    <p>(d) A dynamic semantic error, detected
    (at run-time) by code generated by the
    compiler.</p>
  </blockquote>
  
  <p>For (a), I think this is would be correct: <code>int char foo;</code></p>
  
  <p>For (b), <code>int foo</code> (no semicolon)</p>
  
  <p>For (c) and (d), I'm not sure what is being asked.</p>
  
  <p>Thanks for the help.</p>