title: Unable to compile Lex and Yacc programs
body: <p>I am trying to compile few lex and yacc programs. In college we use Fedora Core 4. I use the same OS on a virtual machine at home but I am unable compile the program. The following are the lex and yacc codes</p>
  
  <p>LEX Code</p>
  
  <pre><code>%{
  #include "y.tab.h"
  %}
  %%
  [ \t]+ {;}
  \n {return;}
  [a-zA-Z][a-zA-Z0-9]* {return ID;}
  [0-9]+ {return NUMBER;}
  . {return yytext[0];} 
  %%
  </code></pre>
  
  <p>YACC Code</p>
  
  <pre><code>%{
  #include&lt;stdio.h&gt;
  %}
  %token NUMBER ID
  %left '+' '-'
  %left '*' '/'
  %%
  input:e'+'e
  |e'-'e
  |e'*'e
  |e'/'e
  |'('e')'
  ;
  e:NUMBER
  |ID
  ;
  %%
  int main()
  {
  printf("\n\nEnter an expression");
  yyparse();
  printf("\n\nValid Expression\n\n");
  }
  void yyerror()
  {
  printf("\n\nInvalid Expression\n\n");
  exit(0);
  }
  
  While executing the above code, I get the following linker error
  
  $ lex program_name.l                      //executes without error
  $ yacc -d program_name.y                  //executes without error
  $ cc lex.yy.c y.tab.c -ll -ly
  /usr/bin/ld: cannot find -ly
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Please help me solve this error. Thanks in advance</p>