title: How to output an error using lex and yacc, to a input file containing C program which contains keywords other then the mentioned ones?
body: <p>I want to construct a compiler for a subset of the <strong>C</strong> language with following features:</p>
  
  <p>Data types: int, float, char, double<br>
  Reserved keywords: void, include, main<br>
  Control statements: while and switch<br>
  Input-output functions: printf, scanf<br>
  Operators: +, -, *, /, &lt;=, >=, ==, >, &lt;, !=<br>
  Compound statements and Arrays<br>
  Symbols: (, ), %, &amp;, ;</p>
  
  <p>Anything other than these I want it to be directed to <code>yyerror()</code>. 
  For example if the <strong>C</strong> program contains boolean as a data type, it should be an error.</p>