Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. %option noyywrap
  2.  
  3. %{
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. #include "y.tab.h"
  9.  
  10. extern void yerror(char *s);
  11.  
  12. %}
  13.  
  14. %%
  15. print   {return print;}
  16. [0-9]+  {yylval.v=atoi(yytext); return num;}
  17. [a-zA-Z]+ {strcpy(yylval.s,yytext); return id;}
  18. \=  {return op_dodele;}
  19. \;  {return ';';}
  20. \+  {return '+';}
  21. \-  {return '-';}
  22. \*  {return '*';}
  23. \/  {return '/';}
  24. \(  {return '(';}
  25. \)  {return ')';}
  26. .   {yyerror("Leks. greska");}
  27. [ \n\t] {}
  28. %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement