Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. %{
  2. #include <iostream>
  3. using namespace std;
  4. #define YY_DECL extern "C" int yylex()
  5. %}
  6. %%
  7. [ tn] ;
  8. [0-9]+.[0-9]+ { cout << "Found a floating-point number:" << yytext << endl; }
  9. [0-9]+ { cout << "Found an integer:" << yytext << endl; }
  10. [a-zA-Z0-9]+ { cout << "Found a string: " << yytext << endl; }
  11. %%
  12. int main(int, char**) {
  13. // lex through the input:
  14. yylex();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement