Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- #include <iostream>
- using namespace std;
- #define YY_DECL extern "C" int yylex()
- %}
- %%
- [ tn] ;
- [0-9]+.[0-9]+ { cout << "Found a floating-point number:" << yytext << endl; }
- [0-9]+ { cout << "Found an integer:" << yytext << endl; }
- [a-zA-Z0-9]+ { cout << "Found a string: " << yytext << endl; }
- %%
- int main(int, char**) {
- // lex through the input:
- yylex();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement